NewGVN miscompiles the following function:
@glb = external global i64, align 8
define i64 @src(i64 %tmp) {
%conv3 = shl nuw i64 %tmp, 32
store i64 %conv3, i64* @glb, align 8
%sext = shl i64 %tmp, 32
%r = lshr exact i64 %sext, 32
ret i64 %r
}
define i64 @tgt(i64 %tmp) {
%conv3 = shl i64 %tmp, 32
store i64 %conv3, i64* @glb, align 8
ret i64 %tmp
}
NewGVN hashes instructions ignoring attributes like 'nuw', so it assumes that conv3 and sext above are equivalent. But then it uses %conv3 as the leader, and then it calls InstSimplify with shl nuw & lshr extract and bug!
Test case from @regehr.
cc @alinas
NewGVN miscompiles the following function:
NewGVN hashes instructions ignoring attributes like 'nuw', so it assumes that conv3 and sext above are equivalent. But then it uses %conv3 as the leader, and then it calls InstSimplify with shl nuw & lshr extract and bug!
Test case from @regehr.
cc @alinas