Nikita Popov 04b944e230 [InstSimplify] Convert tests to opaque pointers (NFC)
The only interesting test change is in @PR31262, where the following
fold is now performed, while it previously was not:
https://alive2.llvm.org/ce/z/a5Qmr6

llvm/test/Transforms/InstSimplify/ConstProp/gep.ll has not been
updated, because there is a tradeoff between folding and inrange
preservation there that we may want to discuss.

Updates have been performed using:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
2022-06-10 17:16:28 +02:00

70 lines
1.5 KiB
LLVM

; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
; CHECK-LABEL: shift_undef_64
define void @shift_undef_64(ptr %p) {
%r1 = lshr i64 -1, 4294967296 ; 2^32
; CHECK: store i64 poison
store i64 %r1, ptr %p
%r2 = ashr i64 -1, 4294967297 ; 2^32 + 1
; CHECK: store i64 poison
store i64 %r2, ptr %p
%r3 = shl i64 -1, 4294967298 ; 2^32 + 2
; CHECK: store i64 poison
store i64 %r3, ptr %p
ret void
}
; CHECK-LABEL: shift_undef_65
define void @shift_undef_65(ptr %p) {
%r1 = lshr i65 2, 18446744073709551617
; CHECK: store i65 poison
store i65 %r1, ptr %p
%r2 = ashr i65 4, 18446744073709551617
; CHECK: store i65 poison
store i65 %r2, ptr %p
%r3 = shl i65 1, 18446744073709551617
; CHECK: store i65 poison
store i65 %r3, ptr %p
ret void
}
; CHECK-LABEL: shift_undef_256
define void @shift_undef_256(ptr %p) {
%r1 = lshr i256 2, 18446744073709551617
; CHECK: store i256 poison
store i256 %r1, ptr %p
%r2 = ashr i256 4, 18446744073709551618
; CHECK: store i256 poison
store i256 %r2, ptr %p
%r3 = shl i256 1, 18446744073709551619
; CHECK: store i256 poison
store i256 %r3, ptr %p
ret void
}
; CHECK-LABEL: shift_undef_511
define void @shift_undef_511(ptr %p) {
%r1 = lshr i511 -1, 1208925819614629174706276 ; 2^80 + 100
; CHECK: store i511 poison
store i511 %r1, ptr %p
%r2 = ashr i511 -2, 1208925819614629174706200
; CHECK: store i511 poison
store i511 %r2, ptr %p
%r3 = shl i511 -3, 1208925819614629174706180
; CHECK: store i511 poison
store i511 %r3, ptr %p
ret void
}