Open
Description
Godbolt link: https://godbolt.org/z/Ws1jPz4rE
Instcombine transforms this function:
define i64 @test(i64 %n) {
%trunc = trunc nuw i64 %n to i32
%zext = zext i32 %trunc to i64
ret i64 %zext
}
into this:
define i64 @test(i64 %n) {
%zext = and i64 %n, 4294967295
ret i64 %zext
}
However, because of the nuw
flag on trunc
, this could be simplified into this instead:
define i64 @test(i64 %n) {
ret i64 %n
}