diff options
Diffstat (limited to 'test/Transforms/ConstProp')
-rw-r--r-- | test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll | 2 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll | 2 | ||||
-rw-r--r-- | test/Transforms/ConstProp/div-zero.ll | 2 | ||||
-rw-r--r-- | test/Transforms/ConstProp/loads.ll | 38 | ||||
-rw-r--r-- | test/Transforms/ConstProp/shift.ll | 69 |
5 files changed, 91 insertions, 22 deletions
diff --git a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll index d68cb26..af7e8be 100644 --- a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll +++ b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll @@ -4,7 +4,7 @@ @b = external global [2 x { }] ; <[2 x { }]*> [#uses=2] define i1 @f() { - %tmp.2 = icmp eq { }* getelementptr ([2 x { }]* @b, i32 0, i32 0), getelementptr ([2 x { }]* @b, i32 0, i32 1) ; <i1> [#uses=1] + %tmp.2 = icmp eq { }* getelementptr ([2 x { }], [2 x { }]* @b, i32 0, i32 0), getelementptr ([2 x { }], [2 x { }]* @b, i32 0, i32 1) ; <i1> [#uses=1] ret i1 %tmp.2 } diff --git a/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll b/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll index fc7ff90..e93a2c0 100644 --- a/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll +++ b/test/Transforms/ConstProp/2009-09-01-GEP-Crash.ll @@ -18,7 +18,7 @@ target triple = "x86_64-unknown-linux-gnu" define void @init_hrtimers_cpu(i32 %cpu) nounwind noredzone section ".cpuinit.text" { entry: - %tmp3 = getelementptr %struct.hrtimer_cpu_base* bitcast (%1* @per_cpu__hrtimer_bases to %struct.hrtimer_cpu_base*), i32 0, i32 0 ; <%0*> [#uses=1] + %tmp3 = getelementptr %struct.hrtimer_cpu_base, %struct.hrtimer_cpu_base* bitcast (%1* @per_cpu__hrtimer_bases to %struct.hrtimer_cpu_base*), i32 0, i32 0 ; <%0*> [#uses=1] %tmp5 = bitcast %0* %tmp3 to i8* ; <i8*> [#uses=0] unreachable } diff --git a/test/Transforms/ConstProp/div-zero.ll b/test/Transforms/ConstProp/div-zero.ll index a2c59d3..f4049a9 100644 --- a/test/Transforms/ConstProp/div-zero.ll +++ b/test/Transforms/ConstProp/div-zero.ll @@ -5,7 +5,7 @@ declare void @ext() define i32 @foo(i32 %ptr) { entry: %zero = sub i32 %ptr, %ptr ; <i32> [#uses=1] - %div_zero = sdiv i32 %zero, ptrtoint (i32* getelementptr (i32* null, + %div_zero = sdiv i32 %zero, ptrtoint (i32* getelementptr (i32, i32* null, i32 1) to i32) ; <i32> [#uses=1] ret i32 %div_zero } diff --git a/test/Transforms/ConstProp/loads.ll b/test/Transforms/ConstProp/loads.ll index 5a23dad..5426ad0 100644 --- a/test/Transforms/ConstProp/loads.ll +++ b/test/Transforms/ConstProp/loads.ll @@ -9,7 +9,7 @@ ; Simple load define i32 @test1() { - %r = load i32* getelementptr ({{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) + %r = load i32, i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) ret i32 %r ; 0xDEADBEEF @@ -24,7 +24,7 @@ define i32 @test1() { ; PR3152 ; Load of first 16 bits of 32-bit value. define i16 @test2() { - %r = load i16* bitcast(i32* getelementptr ({{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*) + %r = load i16, i16* bitcast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*) ret i16 %r ; 0xBEEF @@ -37,7 +37,7 @@ define i16 @test2() { } define i16 @test2_addrspacecast() { - %r = load i16 addrspace(1)* addrspacecast(i32* getelementptr ({{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16 addrspace(1)*) + %r = load i16, i16 addrspace(1)* addrspacecast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16 addrspace(1)*) ret i16 %r ; 0xBEEF @@ -51,7 +51,7 @@ define i16 @test2_addrspacecast() { ; Load of second 16 bits of 32-bit value. define i16 @test3() { - %r = load i16* getelementptr(i16* bitcast(i32* getelementptr ({{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*), i32 1) + %r = load i16, i16* getelementptr(i16, i16* bitcast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*), i32 1) ret i16 %r ; 0xDEAD @@ -65,7 +65,7 @@ define i16 @test3() { ; Load of 8 bit field + tail padding. define i16 @test4() { - %r = load i16* getelementptr(i16* bitcast(i32* getelementptr ({{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*), i32 2) + %r = load i16, i16* getelementptr(i16, i16* bitcast(i32* getelementptr ({{i32,i8},i32}, {{i32,i8},i32}* @g1, i32 0, i32 0, i32 0) to i16*), i32 2) ret i16 %r ; 0x00BA @@ -79,7 +79,7 @@ define i16 @test4() { ; Load of double bits. define i64 @test6() { - %r = load i64* bitcast(double* @g2 to i64*) + %r = load i64, i64* bitcast(double* @g2 to i64*) ret i64 %r ; 0x3FF_0000000000000 @@ -93,7 +93,7 @@ define i64 @test6() { ; Load of double bits. define i16 @test7() { - %r = load i16* bitcast(double* @g2 to i16*) + %r = load i16, i16* bitcast(double* @g2 to i16*) ret i16 %r ; 0x0000 @@ -107,7 +107,7 @@ define i16 @test7() { ; Double load. define double @test8() { - %r = load double* bitcast({{i32,i8},i32}* @g1 to double*) + %r = load double, double* bitcast({{i32,i8},i32}* @g1 to double*) ret double %r ; LE-LABEL: @test8( @@ -120,7 +120,7 @@ define double @test8() { ; i128 load. define i128 @test9() { - %r = load i128* bitcast({i64, i64}* @g3 to i128*) + %r = load i128, i128* bitcast({i64, i64}* @g3 to i128*) ret i128 %r ; 0x00000000_06B1BFF8_00000000_0000007B @@ -134,7 +134,7 @@ define i128 @test9() { ; vector load. define <2 x i64> @test10() { - %r = load <2 x i64>* bitcast({i64, i64}* @g3 to <2 x i64>*) + %r = load <2 x i64>, <2 x i64>* bitcast({i64, i64}* @g3 to <2 x i64>*) ret <2 x i64> %r ; LE-LABEL: @test10( @@ -151,7 +151,7 @@ define <2 x i64> @test10() { define i16 @test11() nounwind { entry: - %a = load i16* bitcast ({ i8, i8 }* @g4 to i16*) + %a = load i16, i16* bitcast ({ i8, i8 }* @g4 to i16*) ret i16 %a ; 0x08A1 @@ -168,7 +168,7 @@ entry: @test12g = private constant [6 x i8] c"a\00b\00\00\00" define i16 @test12() { - %a = load i16* getelementptr inbounds ([3 x i16]* bitcast ([6 x i8]* @test12g to [3 x i16]*), i32 0, i64 1) + %a = load i16, i16* getelementptr inbounds ([3 x i16], [3 x i16]* bitcast ([6 x i8]* @test12g to [3 x i16]*), i32 0, i64 1) ret i16 %a ; 0x0062 @@ -184,7 +184,7 @@ define i16 @test12() { ; PR5978 @g5 = constant i8 4 define i1 @test13() { - %A = load i1* bitcast (i8* @g5 to i1*) + %A = load i1, i1* bitcast (i8* @g5 to i1*) ret i1 %A ; LE-LABEL: @test13( @@ -197,7 +197,7 @@ define i1 @test13() { @g6 = constant [2 x i8*] [i8* inttoptr (i64 1 to i8*), i8* inttoptr (i64 2 to i8*)] define i64 @test14() nounwind { entry: - %tmp = load i64* bitcast ([2 x i8*]* @g6 to i64*) + %tmp = load i64, i64* bitcast ([2 x i8*]* @g6 to i64*) ret i64 %tmp ; LE-LABEL: @test14( @@ -211,7 +211,7 @@ entry: @g6_as1 = constant [2 x i8 addrspace(1)*] [i8 addrspace(1)* inttoptr (i16 1 to i8 addrspace(1)*), i8 addrspace(1)* inttoptr (i16 2 to i8 addrspace(1)*)] define i16 @test14_as1() nounwind { entry: - %tmp = load i16* bitcast ([2 x i8 addrspace(1)*]* @g6_as1 to i16*) + %tmp = load i16, i16* bitcast ([2 x i8 addrspace(1)*]* @g6_as1 to i16*) ret i16 %tmp ; LE: @test14_as1 @@ -223,7 +223,7 @@ entry: define i64 @test15() nounwind { entry: - %tmp = load i64* bitcast (i8** getelementptr inbounds ([2 x i8*]* @g6, i32 0, i64 1) to i64*) + %tmp = load i64, i64* bitcast (i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @g6, i32 0, i64 1) to i64*) ret i64 %tmp ; LE-LABEL: @test15( @@ -235,7 +235,7 @@ entry: @gv7 = constant [4 x i8*] [i8* null, i8* inttoptr (i64 -14 to i8*), i8* null, i8* null] define i64 @test16.1() { - %v = load i64* bitcast ([4 x i8*]* @gv7 to i64*), align 8 + %v = load i64, i64* bitcast ([4 x i8*]* @gv7 to i64*), align 8 ret i64 %v ; LE-LABEL: @test16.1( @@ -246,7 +246,7 @@ define i64 @test16.1() { } define i64 @test16.2() { - %v = load i64* bitcast (i8** getelementptr inbounds ([4 x i8*]* @gv7, i64 0, i64 1) to i64*), align 8 + %v = load i64, i64* bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @gv7, i64 0, i64 1) to i64*), align 8 ret i64 %v ; LE-LABEL: @test16.2( @@ -257,7 +257,7 @@ define i64 @test16.2() { } define i64 @test16.3() { - %v = load i64* bitcast (i8** getelementptr inbounds ([4 x i8*]* @gv7, i64 0, i64 2) to i64*), align 8 + %v = load i64, i64* bitcast (i8** getelementptr inbounds ([4 x i8*], [4 x i8*]* @gv7, i64 0, i64 2) to i64*), align 8 ret i64 %v ; LE-LABEL: @test16.3( diff --git a/test/Transforms/ConstProp/shift.ll b/test/Transforms/ConstProp/shift.ll new file mode 100644 index 0000000..de23fe9 --- /dev/null +++ b/test/Transforms/ConstProp/shift.ll @@ -0,0 +1,69 @@ +; RUN: opt < %s -constprop -S | FileCheck %s + +; CHECK-LABEL: shift_undef_64 +define void @shift_undef_64(i64* %p) { + %r1 = lshr i64 -1, 4294967296 ; 2^32 + ; CHECK: store i64 undef + store i64 %r1, i64* %p + + %r2 = ashr i64 -1, 4294967297 ; 2^32 + 1 + ; CHECK: store i64 undef + store i64 %r2, i64* %p + + %r3 = shl i64 -1, 4294967298 ; 2^32 + 2 + ; CHECK: store i64 undef + store i64 %r3, i64* %p + + ret void +} + +; CHECK-LABEL: shift_undef_65 +define void @shift_undef_65(i65* %p) { + %r1 = lshr i65 2, 18446744073709551617 + ; CHECK: store i65 undef + store i65 %r1, i65* %p + + %r2 = ashr i65 4, 18446744073709551617 + ; CHECK: store i65 undef + store i65 %r2, i65* %p + + %r3 = shl i65 1, 18446744073709551617 + ; CHECK: store i65 undef + store i65 %r3, i65* %p + + ret void +} + +; CHECK-LABEL: shift_undef_256 +define void @shift_undef_256(i256* %p) { + %r1 = lshr i256 2, 18446744073709551617 + ; CHECK: store i256 undef + store i256 %r1, i256* %p + + %r2 = ashr i256 4, 18446744073709551618 + ; CHECK: store i256 undef + store i256 %r2, i256* %p + + %r3 = shl i256 1, 18446744073709551619 + ; CHECK: store i256 undef + store i256 %r3, i256* %p + + ret void +} + +; CHECK-LABEL: shift_undef_511 +define void @shift_undef_511(i511* %p) { + %r1 = lshr i511 -1, 1208925819614629174706276 ; 2^80 + 100 + ; CHECK: store i511 undef + store i511 %r1, i511* %p + + %r2 = ashr i511 -2, 1208925819614629174706200 + ; CHECK: store i511 undef + store i511 %r2, i511* %p + + %r3 = shl i511 -3, 1208925819614629174706180 + ; CHECK: store i511 undef + store i511 %r3, i511* %p + + ret void +} |