diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:04:03 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2013-12-22 00:04:03 +0000 |
| commit | f8af5cf600354830d4ccf59732403f0f073eccb9 (patch) | |
| tree | 2ba0398b4c42ad4f55561327538044fd2c925a8b /test/Transforms/InstSimplify | |
| parent | 59d6cff90eecf31cb3dd860c4e786674cfdd42eb (diff) | |
Notes
Diffstat (limited to 'test/Transforms/InstSimplify')
18 files changed, 268 insertions, 160 deletions
diff --git a/test/Transforms/InstSimplify/2010-12-20-Boolean.ll b/test/Transforms/InstSimplify/2010-12-20-Boolean.ll index 3aa1bd60cfd61..28c25c0e77ee7 100644 --- a/test/Transforms/InstSimplify/2010-12-20-Boolean.ll +++ b/test/Transforms/InstSimplify/2010-12-20-Boolean.ll @@ -1,28 +1,28 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i1 @add(i1 %x) { -; CHECK: @add +; CHECK-LABEL: @add( %z = add i1 %x, %x ret i1 %z ; CHECK: ret i1 false } define i1 @sub(i1 %x) { -; CHECK: @sub +; CHECK-LABEL: @sub( %z = sub i1 false, %x ret i1 %z ; CHECK: ret i1 %x } define i1 @mul(i1 %x) { -; CHECK: @mul +; CHECK-LABEL: @mul( %z = mul i1 %x, %x ret i1 %z ; CHECK: ret i1 %x } define i1 @ne(i1 %x) { -; CHECK: @ne +; CHECK-LABEL: @ne( %z = icmp ne i1 %x, 0 ret i1 %z ; CHECK: ret i1 %x diff --git a/test/Transforms/InstSimplify/2010-12-20-Distribute.ll b/test/Transforms/InstSimplify/2010-12-20-Distribute.ll index d20abd68c2008..9ea0a5e10708d 100644 --- a/test/Transforms/InstSimplify/2010-12-20-Distribute.ll +++ b/test/Transforms/InstSimplify/2010-12-20-Distribute.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i32 @factorize(i32 %x, i32 %y) { -; CHECK: @factorize +; CHECK-LABEL: @factorize( ; (X | 1) & (X | 2) -> X | (1 & 2) -> X %l = or i32 %x, 1 %r = or i32 %x, 2 @@ -11,7 +11,7 @@ define i32 @factorize(i32 %x, i32 %y) { } define i32 @factorize2(i32 %x) { -; CHECK: @factorize2 +; CHECK-LABEL: @factorize2( ; 3*X - 2*X -> X %l = mul i32 3, %x %r = mul i32 2, %x @@ -21,7 +21,7 @@ define i32 @factorize2(i32 %x) { } define i32 @factorize3(i32 %x, i32 %a, i32 %b) { -; CHECK: @factorize3 +; CHECK-LABEL: @factorize3( ; (X | (A|B)) & (X | B) -> X | ((A|B) & B) -> X | B %aORb = or i32 %a, %b %l = or i32 %x, %aORb @@ -32,7 +32,7 @@ define i32 @factorize3(i32 %x, i32 %a, i32 %b) { } define i32 @factorize4(i32 %x, i32 %y) { -; CHECK: @factorize4 +; CHECK-LABEL: @factorize4( %sh = shl i32 %y, 1 %ml = mul i32 %sh, %x %mr = mul i32 %x, %y @@ -42,7 +42,7 @@ define i32 @factorize4(i32 %x, i32 %y) { } define i32 @factorize5(i32 %x, i32 %y) { -; CHECK: @factorize5 +; CHECK-LABEL: @factorize5( %sh = mul i32 %y, 2 %ml = mul i32 %sh, %x %mr = mul i32 %x, %y @@ -52,7 +52,7 @@ define i32 @factorize5(i32 %x, i32 %y) { } define i32 @expand(i32 %x) { -; CHECK: @expand +; CHECK-LABEL: @expand( ; ((X & 1) | 2) & 1 -> ((X & 1) & 1) | (2 & 1) -> (X & 1) | 0 -> X & 1 %a = and i32 %x, 1 %b = or i32 %a, 2 diff --git a/test/Transforms/InstSimplify/2011-01-14-Thread.ll b/test/Transforms/InstSimplify/2011-01-14-Thread.ll index 8fc4dc5d5bb7a..9de06600c0c3d 100644 --- a/test/Transforms/InstSimplify/2011-01-14-Thread.ll +++ b/test/Transforms/InstSimplify/2011-01-14-Thread.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i32 @shift_select(i1 %cond) { -; CHECK: @shift_select +; CHECK-LABEL: @shift_select( %s = select i1 %cond, i32 0, i32 1 %r = lshr i32 %s, 1 ret i32 %r diff --git a/test/Transforms/InstSimplify/2011-02-01-Vector.ll b/test/Transforms/InstSimplify/2011-02-01-Vector.ll index 3039a663fa45e..3cbbf350ec128 100644 --- a/test/Transforms/InstSimplify/2011-02-01-Vector.ll +++ b/test/Transforms/InstSimplify/2011-02-01-Vector.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define <2 x i32> @sdiv(<2 x i32> %x) { -; CHECK: @sdiv +; CHECK-LABEL: @sdiv( %div = sdiv <2 x i32> %x, <i32 1, i32 1> ret <2 x i32> %div ; CHECK: ret <2 x i32> %x diff --git a/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll b/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll index d10c61fe2cf77..3514b34793748 100644 --- a/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll +++ b/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll @@ -14,7 +14,7 @@ lpad: %exc_ptr2 = insertvalue { i8*, i32 } undef, i8* %exc_ptr, 0 %filter2 = insertvalue { i8*, i32 } %exc_ptr2, i32 %filter, 1 resume { i8*, i32 } %filter2 -; CHECK: @test1 +; CHECK-LABEL: @test1( ; CHECK-NOT: extractvalue ; CHECK-NOT: insertvalue } @@ -25,5 +25,5 @@ define { i8, i32 } @test2({ i8*, i32 } %x) { %ex = extractvalue { i8*, i32 } %x, 1 %ins = insertvalue { i8, i32 } undef, i32 %ex, 1 ret { i8, i32 } %ins -; CHECK: @test2 +; CHECK-LABEL: @test2( } diff --git a/test/Transforms/InstSimplify/AndOrXor.ll b/test/Transforms/InstSimplify/AndOrXor.ll index 33a4d6b02d638..c59d6c916a6b4 100644 --- a/test/Transforms/InstSimplify/AndOrXor.ll +++ b/test/Transforms/InstSimplify/AndOrXor.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i64 @pow2(i32 %x) { -; CHECK: @pow2 +; CHECK-LABEL: @pow2( %negx = sub i32 0, %x %x2 = and i32 %x, %negx %e = zext i32 %x2 to i64 @@ -12,7 +12,7 @@ define i64 @pow2(i32 %x) { } define i64 @pow2b(i32 %x) { -; CHECK: @pow2b +; CHECK-LABEL: @pow2b( %sh = shl i32 2, %x %e = zext i32 %sh to i64 %nege = sub i64 0, %e diff --git a/test/Transforms/InstSimplify/call.ll b/test/Transforms/InstSimplify/call.ll index cf2f8476763fd..fd854c5b46627 100644 --- a/test/Transforms/InstSimplify/call.ll +++ b/test/Transforms/InstSimplify/call.ll @@ -3,7 +3,7 @@ declare {i8, i1} @llvm.uadd.with.overflow.i8(i8 %a, i8 %b) define i1 @test_uadd1() { -; CHECK: @test_uadd1 +; CHECK-LABEL: @test_uadd1( %x = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 254, i8 3) %overflow = extractvalue {i8, i1} %x, 1 ret i1 %overflow @@ -11,7 +11,7 @@ define i1 @test_uadd1() { } define i8 @test_uadd2() { -; CHECK: @test_uadd2 +; CHECK-LABEL: @test_uadd2( %x = call {i8, i1} @llvm.uadd.with.overflow.i8(i8 254, i8 44) %result = extractvalue {i8, i1} %x, 0 ret i8 %result @@ -21,7 +21,7 @@ define i8 @test_uadd2() { declare i256 @llvm.cttz.i256(i256 %src, i1 %is_zero_undef) define i256 @test_cttz() { -; CHECK: @test_cttz +; CHECK-LABEL: @test_cttz( %x = call i256 @llvm.cttz.i256(i256 10, i1 false) ret i256 %x ; CHECK-NEXT: ret i256 1 @@ -30,7 +30,7 @@ define i256 @test_cttz() { declare i256 @llvm.ctpop.i256(i256 %src) define i256 @test_ctpop() { -; CHECK: @test_ctpop +; CHECK-LABEL: @test_ctpop( %x = call i256 @llvm.ctpop.i256(i256 10) ret i256 %x ; CHECK-NEXT: ret i256 2 @@ -40,7 +40,7 @@ define i256 @test_ctpop() { declare float @fabs(float %x) define float @test_fabs_libcall() { -; CHECK: @test_fabs_libcall +; CHECK-LABEL: @test_fabs_libcall( %x = call float @fabs(float -42.0) ; This is still a real function call, so instsimplify won't nuke it -- other @@ -61,7 +61,7 @@ declare float @llvm.nearbyint.f32(float) nounwind readnone ; Test idempotent intrinsics define float @test_idempotence(float %a) { -; CHECK: @test_idempotence +; CHECK-LABEL: @test_idempotence( ; CHECK: fabs ; CHECK-NOT: fabs @@ -101,3 +101,66 @@ define float @test_idempotence(float %a) { ret float %r4 } + +define i8* @operator_new() { +entry: + %call = tail call noalias i8* @_Znwm(i64 8) + %cmp = icmp eq i8* %call, null + br i1 %cmp, label %cast.end, label %cast.notnull + +cast.notnull: ; preds = %entry + %add.ptr = getelementptr inbounds i8* %call, i64 4 + br label %cast.end + +cast.end: ; preds = %cast.notnull, %entry + %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ] + ret i8* %cast.result + +; CHECK-LABEL: @operator_new +; CHECK: br i1 false, label %cast.end, label %cast.notnull +} + +declare noalias i8* @_Znwm(i64) + +%"struct.std::nothrow_t" = type { i8 } +@_ZSt7nothrow = external global %"struct.std::nothrow_t" + +define i8* @operator_new_nothrow_t() { +entry: + %call = tail call noalias i8* @_ZnamRKSt9nothrow_t(i64 8, %"struct.std::nothrow_t"* @_ZSt7nothrow) + %cmp = icmp eq i8* %call, null + br i1 %cmp, label %cast.end, label %cast.notnull + +cast.notnull: ; preds = %entry + %add.ptr = getelementptr inbounds i8* %call, i64 4 + br label %cast.end + +cast.end: ; preds = %cast.notnull, %entry + %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ] + ret i8* %cast.result + +; CHECK-LABEL: @operator_new_nothrow_t +; CHECK: br i1 %cmp, label %cast.end, label %cast.notnull +} + +declare i8* @_ZnamRKSt9nothrow_t(i64, %"struct.std::nothrow_t"*) nounwind + +define i8* @malloc_can_return_null() { +entry: + %call = tail call noalias i8* @malloc(i64 8) + %cmp = icmp eq i8* %call, null + br i1 %cmp, label %cast.end, label %cast.notnull + +cast.notnull: ; preds = %entry + %add.ptr = getelementptr inbounds i8* %call, i64 4 + br label %cast.end + +cast.end: ; preds = %cast.notnull, %entry + %cast.result = phi i8* [ %add.ptr, %cast.notnull ], [ null, %entry ] + ret i8* %cast.result + +; CHECK-LABEL: @malloc_can_return_null +; CHECK: br i1 %cmp, label %cast.end, label %cast.notnull +} + +declare noalias i8* @malloc(i64) diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll index b764c761cfb20..abb38695e7106 100644 --- a/test/Transforms/InstSimplify/compare.ll +++ b/test/Transforms/InstSimplify/compare.ll @@ -2,7 +2,7 @@ target datalayout = "p:32:32" define i1 @ptrtoint() { -; CHECK: @ptrtoint +; CHECK-LABEL: @ptrtoint( %a = alloca i8 %tmp = ptrtoint i8* %a to i32 %r = icmp eq i32 %tmp, 0 @@ -11,7 +11,7 @@ define i1 @ptrtoint() { } define i1 @bitcast() { -; CHECK: @bitcast +; CHECK-LABEL: @bitcast( %a = alloca i32 %b = alloca i64 %x = bitcast i32* %a to i8* @@ -22,7 +22,7 @@ define i1 @bitcast() { } define i1 @gep() { -; CHECK: @gep +; CHECK-LABEL: @gep( %a = alloca [3 x i8], align 8 %x = getelementptr inbounds [3 x i8]* %a, i32 0, i32 0 %cmp = icmp eq i8* %x, null @@ -31,7 +31,7 @@ define i1 @gep() { } define i1 @gep2() { -; CHECK: @gep2 +; CHECK-LABEL: @gep2( %a = alloca [3 x i8], align 8 %x = getelementptr inbounds [3 x i8]* %a, i32 0, i32 0 %y = getelementptr inbounds [3 x i8]* %a, i32 0, i32 0 @@ -46,7 +46,7 @@ define i1 @gep2() { @gepz = extern_weak global %gept define i1 @gep3() { -; CHECK: @gep3 +; CHECK-LABEL: @gep3( %x = alloca %gept, align 8 %a = getelementptr %gept* %x, i64 0, i32 0 %b = getelementptr %gept* %x, i64 0, i32 1 @@ -56,7 +56,7 @@ define i1 @gep3() { } define i1 @gep4() { -; CHECK: @gep4 +; CHECK-LABEL: @gep4( %x = alloca %gept, align 8 %a = getelementptr %gept* @gepy, i64 0, i32 0 %b = getelementptr %gept* @gepy, i64 0, i32 1 @@ -66,7 +66,7 @@ define i1 @gep4() { } define i1 @gep5() { -; CHECK: @gep5 +; CHECK-LABEL: @gep5( %x = alloca %gept, align 8 %a = getelementptr inbounds %gept* %x, i64 0, i32 1 %b = getelementptr %gept* @gepy, i64 0, i32 0 @@ -77,7 +77,7 @@ define i1 @gep5() { define i1 @gep6(%gept* %x) { ; Same as @gep3 but potentially null. -; CHECK: @gep6 +; CHECK-LABEL: @gep6( %a = getelementptr %gept* %x, i64 0, i32 0 %b = getelementptr %gept* %x, i64 0, i32 1 %equal = icmp eq i32* %a, %b @@ -86,7 +86,7 @@ define i1 @gep6(%gept* %x) { } define i1 @gep7(%gept* %x) { -; CHECK: @gep7 +; CHECK-LABEL: @gep7( %a = getelementptr %gept* %x, i64 0, i32 0 %b = getelementptr %gept* @gepz, i64 0, i32 0 %equal = icmp eq i32* %a, %b @@ -95,7 +95,7 @@ define i1 @gep7(%gept* %x) { } define i1 @gep8(%gept* %x) { -; CHECK: @gep8 +; CHECK-LABEL: @gep8( %a = getelementptr %gept* %x, i32 1 %b = getelementptr %gept* %x, i32 -1 %equal = icmp ugt %gept* %a, %b @@ -104,7 +104,7 @@ define i1 @gep8(%gept* %x) { } define i1 @gep9(i8* %ptr) { -; CHECK: @gep9 +; CHECK-LABEL: @gep9( ; CHECK-NOT: ret ; CHECK: ret i1 true @@ -124,7 +124,7 @@ entry: } define i1 @gep10(i8* %ptr) { -; CHECK: @gep10 +; CHECK-LABEL: @gep10( ; CHECK-NOT: ret ; CHECK: ret i1 true @@ -140,7 +140,7 @@ entry: } define i1 @gep11(i8* %ptr) { -; CHECK: @gep11 +; CHECK-LABEL: @gep11( ; CHECK-NOT: ret ; CHECK: ret i1 true @@ -153,7 +153,7 @@ entry: } define i1 @gep12(i8* %ptr) { -; CHECK: @gep12 +; CHECK-LABEL: @gep12( ; CHECK-NOT: ret ; CHECK: ret i1 %cmp @@ -166,7 +166,7 @@ entry: } define i1 @gep13(i8* %ptr) { -; CHECK: @gep13 +; CHECK-LABEL: @gep13( ; We can prove this GEP is non-null because it is inbounds. %x = getelementptr inbounds i8* %ptr, i32 1 %cmp = icmp eq i8* %x, null @@ -175,7 +175,7 @@ define i1 @gep13(i8* %ptr) { } define i1 @gep14({ {}, i8 }* %ptr) { -; CHECK: @gep14 +; CHECK-LABEL: @gep14( ; We can't simplify this because the offset of one in the GEP actually doesn't ; move the pointer. %x = getelementptr inbounds { {}, i8 }* %ptr, i32 0, i32 1 @@ -185,7 +185,7 @@ define i1 @gep14({ {}, i8 }* %ptr) { } define i1 @gep15({ {}, [4 x {i8, i8}]}* %ptr, i32 %y) { -; CHECK: @gep15 +; CHECK-LABEL: @gep15( ; We can prove this GEP is non-null even though there is a user value, as we ; would necessarily violate inbounds on one side or the other. %x = getelementptr inbounds { {}, [4 x {i8, i8}]}* %ptr, i32 0, i32 1, i32 %y, i32 1 @@ -195,7 +195,7 @@ define i1 @gep15({ {}, [4 x {i8, i8}]}* %ptr, i32 %y) { } define i1 @gep16(i8* %ptr, i32 %a) { -; CHECK: @gep16 +; CHECK-LABEL: @gep16( ; We can prove this GEP is non-null because it is inbounds and because we know ; %b is non-zero even though we don't know its value. %b = or i32 %a, 1 @@ -206,7 +206,7 @@ define i1 @gep16(i8* %ptr, i32 %a) { } define i1 @zext(i32 %x) { -; CHECK: @zext +; CHECK-LABEL: @zext( %e1 = zext i32 %x to i64 %e2 = zext i32 %x to i64 %r = icmp eq i64 %e1, %e2 @@ -215,7 +215,7 @@ define i1 @zext(i32 %x) { } define i1 @zext2(i1 %x) { -; CHECK: @zext2 +; CHECK-LABEL: @zext2( %e = zext i1 %x to i32 %c = icmp ne i32 %e, 0 ret i1 %c @@ -223,7 +223,7 @@ define i1 @zext2(i1 %x) { } define i1 @zext3() { -; CHECK: @zext3 +; CHECK-LABEL: @zext3( %e = zext i1 1 to i32 %c = icmp ne i32 %e, 0 ret i1 %c @@ -231,7 +231,7 @@ define i1 @zext3() { } define i1 @sext(i32 %x) { -; CHECK: @sext +; CHECK-LABEL: @sext( %e1 = sext i32 %x to i64 %e2 = sext i32 %x to i64 %r = icmp eq i64 %e1, %e2 @@ -240,7 +240,7 @@ define i1 @sext(i32 %x) { } define i1 @sext2(i1 %x) { -; CHECK: @sext2 +; CHECK-LABEL: @sext2( %e = sext i1 %x to i32 %c = icmp ne i32 %e, 0 ret i1 %c @@ -248,7 +248,7 @@ define i1 @sext2(i1 %x) { } define i1 @sext3() { -; CHECK: @sext3 +; CHECK-LABEL: @sext3( %e = sext i1 1 to i32 %c = icmp ne i32 %e, 0 ret i1 %c @@ -256,7 +256,7 @@ define i1 @sext3() { } define i1 @add(i32 %x, i32 %y) { -; CHECK: @add +; CHECK-LABEL: @add( %l = lshr i32 %x, 1 %q = lshr i32 %y, 1 %r = or i32 %q, 1 @@ -267,7 +267,7 @@ define i1 @add(i32 %x, i32 %y) { } define i1 @add2(i8 %x, i8 %y) { -; CHECK: @add2 +; CHECK-LABEL: @add2( %l = or i8 %x, 128 %r = or i8 %y, 129 %s = add i8 %l, %r @@ -277,7 +277,7 @@ define i1 @add2(i8 %x, i8 %y) { } define i1 @add3(i8 %x, i8 %y) { -; CHECK: @add3 +; CHECK-LABEL: @add3( %l = zext i8 %x to i32 %r = zext i8 %y to i32 %s = add i32 %l, %r @@ -287,7 +287,7 @@ define i1 @add3(i8 %x, i8 %y) { } define i1 @add4(i32 %x, i32 %y) { -; CHECK: @add4 +; CHECK-LABEL: @add4( %z = add nsw i32 %y, 1 %s1 = add nsw i32 %x, %y %s2 = add nsw i32 %x, %z @@ -297,7 +297,7 @@ define i1 @add4(i32 %x, i32 %y) { } define i1 @add5(i32 %x, i32 %y) { -; CHECK: @add5 +; CHECK-LABEL: @add5( %z = add nuw i32 %y, 1 %s1 = add nuw i32 %x, %z %s2 = add nuw i32 %x, %y @@ -307,7 +307,7 @@ define i1 @add5(i32 %x, i32 %y) { } define i1 @add6(i64 %A, i64 %B) { -; CHECK: @add6 +; CHECK-LABEL: @add6( %s1 = add i64 %A, %B %s2 = add i64 %B, %A %cmp = icmp eq i64 %s1, %s2 @@ -316,7 +316,7 @@ define i1 @add6(i64 %A, i64 %B) { } define i1 @addpowtwo(i32 %x, i32 %y) { -; CHECK: @addpowtwo +; CHECK-LABEL: @addpowtwo( %l = lshr i32 %x, 1 %r = shl i32 1, %y %s = add i32 %l, %r @@ -326,7 +326,7 @@ define i1 @addpowtwo(i32 %x, i32 %y) { } define i1 @or(i32 %x) { -; CHECK: @or +; CHECK-LABEL: @or( %o = or i32 %x, 1 %c = icmp eq i32 %o, 0 ret i1 %c @@ -334,7 +334,7 @@ define i1 @or(i32 %x) { } define i1 @shl(i32 %x) { -; CHECK: @shl +; CHECK-LABEL: @shl( %s = shl i32 1, %x %c = icmp eq i32 %s, 0 ret i1 %c @@ -342,7 +342,7 @@ define i1 @shl(i32 %x) { } define i1 @lshr1(i32 %x) { -; CHECK: @lshr1 +; CHECK-LABEL: @lshr1( %s = lshr i32 -1, %x %c = icmp eq i32 %s, 0 ret i1 %c @@ -350,15 +350,23 @@ define i1 @lshr1(i32 %x) { } define i1 @lshr2(i32 %x) { -; CHECK: @lshr2 +; CHECK-LABEL: @lshr2( %s = lshr i32 %x, 30 %c = icmp ugt i32 %s, 8 ret i1 %c ; CHECK: ret i1 false } +define i1 @lshr3(i32 %x) { +; CHECK-LABEL: @lshr3( + %s = lshr i32 %x, %x + %c = icmp eq i32 %s, 0 + ret i1 %c +; CHECK: ret i1 true +} + define i1 @ashr1(i32 %x) { -; CHECK: @ashr1 +; CHECK-LABEL: @ashr1( %s = ashr i32 -1, %x %c = icmp eq i32 %s, 0 ret i1 %c @@ -366,15 +374,23 @@ define i1 @ashr1(i32 %x) { } define i1 @ashr2(i32 %x) { -; CHECK: @ashr2 +; CHECK-LABEL: @ashr2( %s = ashr i32 %x, 30 %c = icmp slt i32 %s, -5 ret i1 %c ; CHECK: ret i1 false } +define i1 @ashr3(i32 %x) { +; CHECK-LABEL: @ashr3( + %s = ashr i32 %x, %x + %c = icmp eq i32 %s, 0 + ret i1 %c +; CHECK: ret i1 true +} + define i1 @select1(i1 %cond) { -; CHECK: @select1 +; CHECK-LABEL: @select1( %s = select i1 %cond, i32 1, i32 0 %c = icmp eq i32 %s, 1 ret i1 %c @@ -382,7 +398,7 @@ define i1 @select1(i1 %cond) { } define i1 @select2(i1 %cond) { -; CHECK: @select2 +; CHECK-LABEL: @select2( %x = zext i1 %cond to i32 %s = select i1 %cond, i32 %x, i32 0 %c = icmp ne i32 %s, 0 @@ -391,7 +407,7 @@ define i1 @select2(i1 %cond) { } define i1 @select3(i1 %cond) { -; CHECK: @select3 +; CHECK-LABEL: @select3( %x = zext i1 %cond to i32 %s = select i1 %cond, i32 1, i32 %x %c = icmp ne i32 %s, 0 @@ -400,7 +416,7 @@ define i1 @select3(i1 %cond) { } define i1 @select4(i1 %cond) { -; CHECK: @select4 +; CHECK-LABEL: @select4( %invert = xor i1 %cond, 1 %s = select i1 %invert, i32 0, i32 1 %c = icmp ne i32 %s, 0 @@ -409,7 +425,7 @@ define i1 @select4(i1 %cond) { } define i1 @select5(i32 %x) { -; CHECK: @select5 +; CHECK-LABEL: @select5( %c = icmp eq i32 %x, 0 %s = select i1 %c, i32 1, i32 %x %c2 = icmp eq i32 %s, 0 @@ -418,7 +434,7 @@ define i1 @select5(i32 %x) { } define i1 @select6(i32 %x) { -; CHECK: @select6 +; CHECK-LABEL: @select6( %c = icmp sgt i32 %x, 0 %s = select i1 %c, i32 %x, i32 4 %c2 = icmp eq i32 %s, 0 @@ -427,7 +443,7 @@ define i1 @select6(i32 %x) { } define i1 @urem1(i32 %X, i32 %Y) { -; CHECK: @urem1 +; CHECK-LABEL: @urem1( %A = urem i32 %X, %Y %B = icmp ult i32 %A, %Y ret i1 %B @@ -435,7 +451,7 @@ define i1 @urem1(i32 %X, i32 %Y) { } define i1 @urem2(i32 %X, i32 %Y) { -; CHECK: @urem2 +; CHECK-LABEL: @urem2( %A = urem i32 %X, %Y %B = icmp eq i32 %A, %Y ret i1 %B @@ -443,7 +459,7 @@ define i1 @urem2(i32 %X, i32 %Y) { } define i1 @urem3(i32 %X) { -; CHECK: @urem3 +; CHECK-LABEL: @urem3( %A = urem i32 %X, 10 %B = icmp ult i32 %A, 15 ret i1 %B @@ -451,7 +467,7 @@ define i1 @urem3(i32 %X) { } define i1 @urem4(i32 %X) { -; CHECK: @urem4 +; CHECK-LABEL: @urem4( %A = urem i32 %X, 15 %B = icmp ult i32 %A, 10 ret i1 %B @@ -459,24 +475,32 @@ define i1 @urem4(i32 %X) { } define i1 @urem5(i16 %X, i32 %Y) { -; CHECK: @urem5 +; CHECK-LABEL: @urem5( %A = zext i16 %X to i32 %B = urem i32 %A, %Y %C = icmp slt i32 %B, %Y ret i1 %C -; CHECK: ret i1 true +; CHECK-NOT: ret i1 true } define i1 @urem6(i32 %X, i32 %Y) { -; CHECK: @urem6 +; CHECK-LABEL: @urem6( %A = urem i32 %X, %Y %B = icmp ugt i32 %Y, %A ret i1 %B ; CHECK: ret i1 true } +define i1 @urem7(i32 %X) { +; CHECK-LABEL: @urem7( + %A = urem i32 1, %X + %B = icmp sgt i32 %A, %X + ret i1 %B +; CHECK-NOT: ret i1 false +} + define i1 @srem1(i32 %X) { -; CHECK: @srem1 +; CHECK-LABEL: @srem1( %A = srem i32 %X, -5 %B = icmp sgt i32 %A, 5 ret i1 %B @@ -484,7 +508,7 @@ define i1 @srem1(i32 %X) { } ; PR9343 #15 -; CHECK: @srem2 +; CHECK-LABEL: @srem2( ; CHECK: ret i1 false define i1 @srem2(i16 %X, i32 %Y) { %A = zext i16 %X to i32 @@ -494,7 +518,7 @@ define i1 @srem2(i16 %X, i32 %Y) { ret i1 %D } -; CHECK: @srem3 +; CHECK-LABEL: @srem3( ; CHECK-NEXT: ret i1 false define i1 @srem3(i16 %X, i32 %Y) { %A = zext i16 %X to i32 @@ -506,7 +530,7 @@ define i1 @srem3(i16 %X, i32 %Y) { } define i1 @udiv1(i32 %X) { -; CHECK: @udiv1 +; CHECK-LABEL: @udiv1( %A = udiv i32 %X, 1000000 %B = icmp ult i32 %A, 5000 ret i1 %B @@ -514,7 +538,7 @@ define i1 @udiv1(i32 %X) { } define i1 @udiv2(i32 %X, i32 %Y, i32 %Z) { -; CHECK: @udiv2 +; CHECK-LABEL: @udiv2( %A = udiv exact i32 10, %Z %B = udiv exact i32 20, %Z %C = icmp ult i32 %A, %B @@ -523,7 +547,7 @@ define i1 @udiv2(i32 %X, i32 %Y, i32 %Z) { } define i1 @udiv3(i32 %X, i32 %Y) { -; CHECK: @udiv3 +; CHECK-LABEL: @udiv3( %A = udiv i32 %X, %Y %C = icmp ugt i32 %A, %X ret i1 %C @@ -531,7 +555,7 @@ define i1 @udiv3(i32 %X, i32 %Y) { } define i1 @udiv4(i32 %X, i32 %Y) { -; CHECK: @udiv4 +; CHECK-LABEL: @udiv4( %A = udiv i32 %X, %Y %C = icmp ule i32 %A, %X ret i1 %C @@ -539,7 +563,7 @@ define i1 @udiv4(i32 %X, i32 %Y) { } define i1 @udiv5(i32 %X) { -; CHECK: @udiv5 +; CHECK-LABEL: @udiv5( %A = udiv i32 123, %X %C = icmp ugt i32 %A, 124 ret i1 %C @@ -548,7 +572,7 @@ define i1 @udiv5(i32 %X) { ; PR11340 define i1 @udiv6(i32 %X) nounwind { -; CHECK: @udiv6 +; CHECK-LABEL: @udiv6( %A = udiv i32 1, %X %C = icmp eq i32 %A, 0 ret i1 %C @@ -557,7 +581,7 @@ define i1 @udiv6(i32 %X) nounwind { define i1 @sdiv1(i32 %X) { -; CHECK: @sdiv1 +; CHECK-LABEL: @sdiv1( %A = sdiv i32 %X, 1000000 %B = icmp slt i32 %A, 3000 ret i1 %B @@ -565,7 +589,7 @@ define i1 @sdiv1(i32 %X) { } define i1 @or1(i32 %X) { -; CHECK: @or1 +; CHECK-LABEL: @or1( %A = or i32 %X, 62 %B = icmp ult i32 %A, 50 ret i1 %B @@ -573,7 +597,7 @@ define i1 @or1(i32 %X) { } define i1 @and1(i32 %X) { -; CHECK: @and1 +; CHECK-LABEL: @and1( %A = and i32 %X, 62 %B = icmp ugt i32 %A, 70 ret i1 %B @@ -581,7 +605,7 @@ define i1 @and1(i32 %X) { } define i1 @mul1(i32 %X) { -; CHECK: @mul1 +; CHECK-LABEL: @mul1( ; Square of a non-zero number is non-zero if there is no overflow. %Y = or i32 %X, 1 %M = mul nuw i32 %Y, %Y @@ -591,7 +615,7 @@ define i1 @mul1(i32 %X) { } define i1 @mul2(i32 %X) { -; CHECK: @mul2 +; CHECK-LABEL: @mul2( ; Square of a non-zero number is positive if there is no signed overflow. %Y = or i32 %X, 1 %M = mul nsw i32 %Y, %Y @@ -601,7 +625,7 @@ define i1 @mul2(i32 %X) { } define i1 @mul3(i32 %X, i32 %Y) { -; CHECK: @mul3 +; CHECK-LABEL: @mul3( ; Product of non-negative numbers is non-negative if there is no signed overflow. %XX = mul nsw i32 %X, %X %YY = mul nsw i32 %Y, %Y @@ -612,7 +636,7 @@ define i1 @mul3(i32 %X, i32 %Y) { } define <2 x i1> @vectorselect1(<2 x i1> %cond) { -; CHECK: @vectorselect1 +; CHECK-LABEL: @vectorselect1( %invert = xor <2 x i1> %cond, <i1 1, i1 1> %s = select <2 x i1> %invert, <2 x i32> <i32 0, i32 0>, <2 x i32> <i32 1, i32 1> %c = icmp ne <2 x i32> %s, <i32 0, i32 0> @@ -684,7 +708,7 @@ define zeroext i1 @external_compare(i32* noalias %x) { } define i1 @alloca_gep(i64 %a, i64 %b) { -; CHECK: @alloca_gep +; CHECK-LABEL: @alloca_gep( ; We can prove this GEP is non-null because it is inbounds and the pointer ; is non-null. %strs = alloca [1000 x [1001 x i8]], align 16 @@ -693,3 +717,25 @@ define i1 @alloca_gep(i64 %a, i64 %b) { ret i1 %cmp ; CHECK-NEXT: ret i1 false } + +define i1 @non_inbounds_gep_compare(i64* %a) { +; CHECK-LABEL: @non_inbounds_gep_compare( +; Equality compares with non-inbounds GEPs can be folded. + %x = getelementptr i64* %a, i64 42 + %y = getelementptr inbounds i64* %x, i64 -42 + %z = getelementptr i64* %a, i64 -42 + %w = getelementptr inbounds i64* %z, i64 42 + %cmp = icmp eq i64* %y, %w + ret i1 %cmp +; CHECK-NEXT: ret i1 true +} + +define i1 @non_inbounds_gep_compare2(i64* %a) { +; CHECK-LABEL: @non_inbounds_gep_compare2( +; Equality compares with non-inbounds GEPs can be folded. + %x = getelementptr i64* %a, i64 4294967297 + %y = getelementptr i64* %a, i64 1 + %cmp = icmp eq i64* %y, %y + ret i1 %cmp +; CHECK-NEXT: ret i1 true +} diff --git a/test/Transforms/InstSimplify/exact-nsw-nuw.ll b/test/Transforms/InstSimplify/exact-nsw-nuw.ll index f3a804eb5b5e0..a0e326b13c02d 100644 --- a/test/Transforms/InstSimplify/exact-nsw-nuw.ll +++ b/test/Transforms/InstSimplify/exact-nsw-nuw.ll @@ -2,7 +2,7 @@ ; PR8862 -; CHECK: @shift1 +; CHECK-LABEL: @shift1( ; CHECK: ret i32 %A define i32 @shift1(i32 %A, i32 %B) { %C = lshr exact i32 %A, %B @@ -10,7 +10,7 @@ define i32 @shift1(i32 %A, i32 %B) { ret i32 %D } -; CHECK: @shift2 +; CHECK-LABEL: @shift2( ; CHECK: lshr ; CHECK: ret i32 %D define i32 @shift2(i32 %A, i32 %B) { @@ -19,7 +19,7 @@ define i32 @shift2(i32 %A, i32 %B) { ret i32 %D } -; CHECK: @shift3 +; CHECK-LABEL: @shift3( ; CHECK: ret i32 %A define i32 @shift3(i32 %A, i32 %B) { %C = ashr exact i32 %A, %B @@ -27,7 +27,7 @@ define i32 @shift3(i32 %A, i32 %B) { ret i32 %D } -; CHECK: @shift4 +; CHECK-LABEL: @shift4( ; CHECK: ret i32 %A define i32 @shift4(i32 %A, i32 %B) { %C = shl nuw i32 %A, %B @@ -35,7 +35,7 @@ define i32 @shift4(i32 %A, i32 %B) { ret i32 %D } -; CHECK: @shift5 +; CHECK-LABEL: @shift5( ; CHECK: ret i32 %A define i32 @shift5(i32 %A, i32 %B) { %C = shl nsw i32 %A, %B diff --git a/test/Transforms/InstSimplify/fast-math.ll b/test/Transforms/InstSimplify/fast-math.ll index 154b96739791c..71d1ed838491f 100644 --- a/test/Transforms/InstSimplify/fast-math.ll +++ b/test/Transforms/InstSimplify/fast-math.ll @@ -71,7 +71,7 @@ define float @fadd_fsub_0(float %a) { } ; fsub nnan ninf x, x ==> 0.0 -; CHECK: @fsub_x_x +; CHECK-LABEL: @fsub_x_x( define float @fsub_x_x(float %a) { ; X - X ==> 0 %zero1 = fsub nnan ninf float %a, %a @@ -92,7 +92,7 @@ define float @fsub_x_x(float %a) { } ; fadd nsz X, 0 ==> X -; CHECK: @nofold_fadd_x_0 +; CHECK-LABEL: @nofold_fadd_x_0( define float @nofold_fadd_x_0(float %a) { ; Dont fold ; CHECK: %no_zero1 = fadd diff --git a/test/Transforms/InstSimplify/fdiv.ll b/test/Transforms/InstSimplify/fdiv.ll index 9d85154b240f1..53ad25d074767 100644 --- a/test/Transforms/InstSimplify/fdiv.ll +++ b/test/Transforms/InstSimplify/fdiv.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define double @fdiv_of_undef(double %X) { -; CHECK: @fdiv_of_undef +; CHECK-LABEL: @fdiv_of_undef( ; undef / X -> undef %r = fdiv double undef, %X ret double %r @@ -9,7 +9,7 @@ define double @fdiv_of_undef(double %X) { } define double @fdiv_by_undef(double %X) { -; CHECK: @fdiv_by_undef +; CHECK-LABEL: @fdiv_by_undef( ; X / undef -> undef %r = fdiv double %X, undef ret double %r diff --git a/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/test/Transforms/InstSimplify/floating-point-arithmetic.ll index 91ce26324b818..8177440472cb8 100644 --- a/test/Transforms/InstSimplify/floating-point-arithmetic.ll +++ b/test/Transforms/InstSimplify/floating-point-arithmetic.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s ; fsub 0, (fsub 0, X) ==> X -; CHECK: @fsub_0_0_x +; CHECK-LABEL: @fsub_0_0_x( define float @fsub_0_0_x(float %a) { %t1 = fsub float -0.0, %a %ret = fsub float -0.0, %t1 @@ -11,7 +11,7 @@ define float @fsub_0_0_x(float %a) { } ; fsub X, 0 ==> X -; CHECK: @fsub_x_0 +; CHECK-LABEL: @fsub_x_0( define float @fsub_x_0(float %a) { %ret = fsub float %a, 0.0 ; CHECK: ret float %a @@ -19,7 +19,7 @@ define float @fsub_x_0(float %a) { } ; fadd X, -0 ==> X -; CHECK: @fadd_x_n0 +; CHECK-LABEL: @fadd_x_n0( define float @fadd_x_n0(float %a) { %ret = fadd float %a, -0.0 ; CHECK: ret float %a @@ -27,7 +27,7 @@ define float @fadd_x_n0(float %a) { } ; fmul X, 1.0 ==> X -; CHECK: @fmul_X_1 +; CHECK-LABEL: @fmul_X_1( define double @fmul_X_1(double %a) { %b = fmul double 1.000000e+00, %a ; <double> [#uses=1] ; CHECK: ret double %a diff --git a/test/Transforms/InstSimplify/lit.local.cfg b/test/Transforms/InstSimplify/lit.local.cfg deleted file mode 100644 index 19eebc0ac7ac3..0000000000000 --- a/test/Transforms/InstSimplify/lit.local.cfg +++ /dev/null @@ -1 +0,0 @@ -config.suffixes = ['.ll', '.c', '.cpp'] diff --git a/test/Transforms/InstSimplify/maxmin.ll b/test/Transforms/InstSimplify/maxmin.ll index e921214e0f0d9..3c643ed3e03ea 100644 --- a/test/Transforms/InstSimplify/maxmin.ll +++ b/test/Transforms/InstSimplify/maxmin.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i1 @max1(i32 %x, i32 %y) { -; CHECK: @max1 +; CHECK-LABEL: @max1( %c = icmp sgt i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp slt i32 %m, %x @@ -10,7 +10,7 @@ define i1 @max1(i32 %x, i32 %y) { } define i1 @max2(i32 %x, i32 %y) { -; CHECK: @max2 +; CHECK-LABEL: @max2( %c = icmp sge i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp sge i32 %m, %x @@ -19,7 +19,7 @@ define i1 @max2(i32 %x, i32 %y) { } define i1 @max3(i32 %x, i32 %y) { -; CHECK: @max3 +; CHECK-LABEL: @max3( %c = icmp ugt i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp ult i32 %m, %x @@ -28,7 +28,7 @@ define i1 @max3(i32 %x, i32 %y) { } define i1 @max4(i32 %x, i32 %y) { -; CHECK: @max4 +; CHECK-LABEL: @max4( %c = icmp uge i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp uge i32 %m, %x @@ -37,7 +37,7 @@ define i1 @max4(i32 %x, i32 %y) { } define i1 @max5(i32 %x, i32 %y) { -; CHECK: @max5 +; CHECK-LABEL: @max5( %c = icmp sgt i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp sgt i32 %x, %m @@ -46,7 +46,7 @@ define i1 @max5(i32 %x, i32 %y) { } define i1 @max6(i32 %x, i32 %y) { -; CHECK: @max6 +; CHECK-LABEL: @max6( %c = icmp sge i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp sle i32 %x, %m @@ -55,7 +55,7 @@ define i1 @max6(i32 %x, i32 %y) { } define i1 @max7(i32 %x, i32 %y) { -; CHECK: @max7 +; CHECK-LABEL: @max7( %c = icmp ugt i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp ugt i32 %x, %m @@ -64,7 +64,7 @@ define i1 @max7(i32 %x, i32 %y) { } define i1 @max8(i32 %x, i32 %y) { -; CHECK: @max8 +; CHECK-LABEL: @max8( %c = icmp uge i32 %x, %y %m = select i1 %c, i32 %x, i32 %y %r = icmp ule i32 %x, %m @@ -73,7 +73,7 @@ define i1 @max8(i32 %x, i32 %y) { } define i1 @min1(i32 %x, i32 %y) { -; CHECK: @min1 +; CHECK-LABEL: @min1( %c = icmp sgt i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp sgt i32 %m, %x @@ -82,7 +82,7 @@ define i1 @min1(i32 %x, i32 %y) { } define i1 @min2(i32 %x, i32 %y) { -; CHECK: @min2 +; CHECK-LABEL: @min2( %c = icmp sge i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp sle i32 %m, %x @@ -91,7 +91,7 @@ define i1 @min2(i32 %x, i32 %y) { } define i1 @min3(i32 %x, i32 %y) { -; CHECK: @min3 +; CHECK-LABEL: @min3( %c = icmp ugt i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp ugt i32 %m, %x @@ -100,7 +100,7 @@ define i1 @min3(i32 %x, i32 %y) { } define i1 @min4(i32 %x, i32 %y) { -; CHECK: @min4 +; CHECK-LABEL: @min4( %c = icmp uge i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp ule i32 %m, %x @@ -109,7 +109,7 @@ define i1 @min4(i32 %x, i32 %y) { } define i1 @min5(i32 %x, i32 %y) { -; CHECK: @min5 +; CHECK-LABEL: @min5( %c = icmp sgt i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp slt i32 %x, %m @@ -118,7 +118,7 @@ define i1 @min5(i32 %x, i32 %y) { } define i1 @min6(i32 %x, i32 %y) { -; CHECK: @min6 +; CHECK-LABEL: @min6( %c = icmp sge i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp sge i32 %x, %m @@ -127,7 +127,7 @@ define i1 @min6(i32 %x, i32 %y) { } define i1 @min7(i32 %x, i32 %y) { -; CHECK: @min7 +; CHECK-LABEL: @min7( %c = icmp ugt i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp ult i32 %x, %m @@ -136,7 +136,7 @@ define i1 @min7(i32 %x, i32 %y) { } define i1 @min8(i32 %x, i32 %y) { -; CHECK: @min8 +; CHECK-LABEL: @min8( %c = icmp uge i32 %x, %y %m = select i1 %c, i32 %y, i32 %x %r = icmp uge i32 %x, %m @@ -145,7 +145,7 @@ define i1 @min8(i32 %x, i32 %y) { } define i1 @maxmin1(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin1 +; CHECK-LABEL: @maxmin1( %c1 = icmp sge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp sge i32 %x, %z @@ -156,7 +156,7 @@ define i1 @maxmin1(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin2(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin2 +; CHECK-LABEL: @maxmin2( %c1 = icmp sge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp sge i32 %x, %z @@ -167,7 +167,7 @@ define i1 @maxmin2(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin3(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin3 +; CHECK-LABEL: @maxmin3( %c1 = icmp sge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp sge i32 %x, %z @@ -178,7 +178,7 @@ define i1 @maxmin3(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin4(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin4 +; CHECK-LABEL: @maxmin4( %c1 = icmp sge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp sge i32 %x, %z @@ -189,7 +189,7 @@ define i1 @maxmin4(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin5(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin5 +; CHECK-LABEL: @maxmin5( %c1 = icmp uge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp uge i32 %x, %z @@ -200,7 +200,7 @@ define i1 @maxmin5(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin6(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin6 +; CHECK-LABEL: @maxmin6( %c1 = icmp uge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp uge i32 %x, %z @@ -211,7 +211,7 @@ define i1 @maxmin6(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin7(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin7 +; CHECK-LABEL: @maxmin7( %c1 = icmp uge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp uge i32 %x, %z @@ -222,7 +222,7 @@ define i1 @maxmin7(i32 %x, i32 %y, i32 %z) { } define i1 @maxmin8(i32 %x, i32 %y, i32 %z) { -; CHECK: @maxmin8 +; CHECK-LABEL: @maxmin8( %c1 = icmp uge i32 %x, %y %max = select i1 %c1, i32 %x, i32 %y %c2 = icmp uge i32 %x, %z @@ -233,7 +233,7 @@ define i1 @maxmin8(i32 %x, i32 %y, i32 %z) { } define i1 @eqcmp1(i32 %x, i32 %y) { -; CHECK: @eqcmp1 +; CHECK-LABEL: @eqcmp1( %c = icmp sge i32 %x, %y %max = select i1 %c, i32 %x, i32 %y %r = icmp eq i32 %max, %x @@ -242,7 +242,7 @@ define i1 @eqcmp1(i32 %x, i32 %y) { } define i1 @eqcmp2(i32 %x, i32 %y) { -; CHECK: @eqcmp2 +; CHECK-LABEL: @eqcmp2( %c = icmp sge i32 %x, %y %max = select i1 %c, i32 %x, i32 %y %r = icmp eq i32 %x, %max @@ -251,7 +251,7 @@ define i1 @eqcmp2(i32 %x, i32 %y) { } define i1 @eqcmp3(i32 %x, i32 %y) { -; CHECK: @eqcmp3 +; CHECK-LABEL: @eqcmp3( %c = icmp uge i32 %x, %y %max = select i1 %c, i32 %x, i32 %y %r = icmp eq i32 %max, %x @@ -260,7 +260,7 @@ define i1 @eqcmp3(i32 %x, i32 %y) { } define i1 @eqcmp4(i32 %x, i32 %y) { -; CHECK: @eqcmp4 +; CHECK-LABEL: @eqcmp4( %c = icmp uge i32 %x, %y %max = select i1 %c, i32 %x, i32 %y %r = icmp eq i32 %x, %max diff --git a/test/Transforms/InstSimplify/phi.ll b/test/Transforms/InstSimplify/phi.ll index 05cd40d902106..5b7aaa93caf1e 100644 --- a/test/Transforms/InstSimplify/phi.ll +++ b/test/Transforms/InstSimplify/phi.ll @@ -2,7 +2,7 @@ ; PR12189 define i1 @test1(i32 %x) { -; CHECK: @test1 +; CHECK-LABEL: @test1( br i1 true, label %a, label %b a: diff --git a/test/Transforms/InstSimplify/ptr_diff.ll b/test/Transforms/InstSimplify/ptr_diff.ll index 8b4aa796013bc..6a3f65237c5ee 100644 --- a/test/Transforms/InstSimplify/ptr_diff.ll +++ b/test/Transforms/InstSimplify/ptr_diff.ll @@ -3,7 +3,7 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 target triple = "x86_64-unknown-linux-gnu" define i64 @ptrdiff1(i8* %ptr) { -; CHECK: @ptrdiff1 +; CHECK-LABEL: @ptrdiff1( ; CHECK-NEXT: ret i64 42 %first = getelementptr inbounds i8* %ptr, i32 0 @@ -15,7 +15,7 @@ define i64 @ptrdiff1(i8* %ptr) { } define i64 @ptrdiff2(i8* %ptr) { -; CHECK: @ptrdiff2 +; CHECK-LABEL: @ptrdiff2( ; CHECK-NEXT: ret i64 42 %first1 = getelementptr inbounds i8* %ptr, i32 0 @@ -34,7 +34,7 @@ define i64 @ptrdiff2(i8* %ptr) { define i64 @ptrdiff3(i8* %ptr) { ; Don't bother with non-inbounds GEPs. -; CHECK: @ptrdiff3 +; CHECK-LABEL: @ptrdiff3( ; CHECK: getelementptr ; CHECK: sub ; CHECK: ret @@ -49,7 +49,7 @@ define i64 @ptrdiff3(i8* %ptr) { define <4 x i32> @ptrdiff4(<4 x i8*> %arg) nounwind { ; Handle simple cases of vectors of pointers. -; CHECK: @ptrdiff4 +; CHECK-LABEL: @ptrdiff4( ; CHECK: ret <4 x i32> zeroinitializer %p1 = ptrtoint <4 x i8*> %arg to <4 x i32> %bc = bitcast <4 x i8*> %arg to <4 x i32*> @@ -73,6 +73,6 @@ bb: %tmp6 = ptrtoint [2 x i32]* %tmp5 to i32 %tmp7 = sub i32 %tmp3, %tmp6 ret i32 %tmp7 -; CHECK: @ptrdiff5 +; CHECK-LABEL: @ptrdiff5( ; CHECK: ret i32 0 } diff --git a/test/Transforms/InstSimplify/reassociate.ll b/test/Transforms/InstSimplify/reassociate.ll index e659e6f42c8dd..d44f7155ffda3 100644 --- a/test/Transforms/InstSimplify/reassociate.ll +++ b/test/Transforms/InstSimplify/reassociate.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i32 @add1(i32 %x) { -; CHECK: @add1 +; CHECK-LABEL: @add1( ; (X + -1) + 1 -> X %l = add i32 %x, -1 %r = add i32 %l, 1 @@ -10,7 +10,7 @@ define i32 @add1(i32 %x) { } define i32 @and1(i32 %x, i32 %y) { -; CHECK: @and1 +; CHECK-LABEL: @and1( ; (X & Y) & X -> X & Y %l = and i32 %x, %y %r = and i32 %l, %x @@ -19,7 +19,7 @@ define i32 @and1(i32 %x, i32 %y) { } define i32 @and2(i32 %x, i32 %y) { -; CHECK: @and2 +; CHECK-LABEL: @and2( ; X & (X & Y) -> X & Y %r = and i32 %x, %y %l = and i32 %x, %r @@ -28,7 +28,7 @@ define i32 @and2(i32 %x, i32 %y) { } define i32 @or1(i32 %x, i32 %y) { -; CHECK: @or1 +; CHECK-LABEL: @or1( ; (X | Y) | X -> X | Y %l = or i32 %x, %y %r = or i32 %l, %x @@ -37,7 +37,7 @@ define i32 @or1(i32 %x, i32 %y) { } define i32 @or2(i32 %x, i32 %y) { -; CHECK: @or2 +; CHECK-LABEL: @or2( ; X | (X | Y) -> X | Y %r = or i32 %x, %y %l = or i32 %x, %r @@ -46,7 +46,7 @@ define i32 @or2(i32 %x, i32 %y) { } define i32 @xor1(i32 %x, i32 %y) { -; CHECK: @xor1 +; CHECK-LABEL: @xor1( ; (X ^ Y) ^ X = Y %l = xor i32 %x, %y %r = xor i32 %l, %x @@ -55,7 +55,7 @@ define i32 @xor1(i32 %x, i32 %y) { } define i32 @xor2(i32 %x, i32 %y) { -; CHECK: @xor2 +; CHECK-LABEL: @xor2( ; X ^ (X ^ Y) = Y %r = xor i32 %x, %y %l = xor i32 %x, %r @@ -64,7 +64,7 @@ define i32 @xor2(i32 %x, i32 %y) { } define i32 @sub1(i32 %x, i32 %y) { -; CHECK: @sub1 +; CHECK-LABEL: @sub1( %d = sub i32 %x, %y %r = sub i32 %x, %d ret i32 %r @@ -72,7 +72,7 @@ define i32 @sub1(i32 %x, i32 %y) { } define i32 @sub2(i32 %x) { -; CHECK: @sub2 +; CHECK-LABEL: @sub2( ; X - (X + 1) -> -1 %xp1 = add i32 %x, 1 %r = sub i32 %x, %xp1 @@ -81,7 +81,7 @@ define i32 @sub2(i32 %x) { } define i32 @sub3(i32 %x, i32 %y) { -; CHECK: @sub3 +; CHECK-LABEL: @sub3( ; ((X + 1) + Y) - (Y + 1) -> X %xp1 = add i32 %x, 1 %lhs = add i32 %xp1, %y @@ -92,7 +92,7 @@ define i32 @sub3(i32 %x, i32 %y) { } define i32 @sdiv1(i32 %x, i32 %y) { -; CHECK: @sdiv1 +; CHECK-LABEL: @sdiv1( ; (no overflow X * Y) / Y -> X %mul = mul nsw i32 %x, %y %r = sdiv i32 %mul, %y @@ -101,7 +101,7 @@ define i32 @sdiv1(i32 %x, i32 %y) { } define i32 @sdiv2(i32 %x, i32 %y) { -; CHECK: @sdiv2 +; CHECK-LABEL: @sdiv2( ; (((X / Y) * Y) / Y) -> X / Y %div = sdiv i32 %x, %y %mul = mul i32 %div, %y @@ -111,7 +111,7 @@ define i32 @sdiv2(i32 %x, i32 %y) { } define i32 @sdiv3(i32 %x, i32 %y) { -; CHECK: @sdiv3 +; CHECK-LABEL: @sdiv3( ; (X rem Y) / Y -> 0 %rem = srem i32 %x, %y %div = sdiv i32 %rem, %y @@ -120,7 +120,7 @@ define i32 @sdiv3(i32 %x, i32 %y) { } define i32 @sdiv4(i32 %x, i32 %y) { -; CHECK: @sdiv4 +; CHECK-LABEL: @sdiv4( ; (X / Y) * Y -> X if the division is exact %div = sdiv exact i32 %x, %y %mul = mul i32 %div, %y @@ -129,7 +129,7 @@ define i32 @sdiv4(i32 %x, i32 %y) { } define i32 @sdiv5(i32 %x, i32 %y) { -; CHECK: @sdiv5 +; CHECK-LABEL: @sdiv5( ; Y * (X / Y) -> X if the division is exact %div = sdiv exact i32 %x, %y %mul = mul i32 %y, %div @@ -139,7 +139,7 @@ define i32 @sdiv5(i32 %x, i32 %y) { define i32 @udiv1(i32 %x, i32 %y) { -; CHECK: @udiv1 +; CHECK-LABEL: @udiv1( ; (no overflow X * Y) / Y -> X %mul = mul nuw i32 %x, %y %r = udiv i32 %mul, %y @@ -148,7 +148,7 @@ define i32 @udiv1(i32 %x, i32 %y) { } define i32 @udiv2(i32 %x, i32 %y) { -; CHECK: @udiv2 +; CHECK-LABEL: @udiv2( ; (((X / Y) * Y) / Y) -> X / Y %div = udiv i32 %x, %y %mul = mul i32 %div, %y @@ -158,7 +158,7 @@ define i32 @udiv2(i32 %x, i32 %y) { } define i32 @udiv3(i32 %x, i32 %y) { -; CHECK: @udiv3 +; CHECK-LABEL: @udiv3( ; (X rem Y) / Y -> 0 %rem = urem i32 %x, %y %div = udiv i32 %rem, %y @@ -167,7 +167,7 @@ define i32 @udiv3(i32 %x, i32 %y) { } define i32 @udiv4(i32 %x, i32 %y) { -; CHECK: @udiv4 +; CHECK-LABEL: @udiv4( ; (X / Y) * Y -> X if the division is exact %div = udiv exact i32 %x, %y %mul = mul i32 %div, %y @@ -176,7 +176,7 @@ define i32 @udiv4(i32 %x, i32 %y) { } define i32 @udiv5(i32 %x, i32 %y) { -; CHECK: @udiv5 +; CHECK-LABEL: @udiv5( ; Y * (X / Y) -> X if the division is exact %div = udiv exact i32 %x, %y %mul = mul i32 %y, %div @@ -185,7 +185,7 @@ define i32 @udiv5(i32 %x, i32 %y) { } define i16 @trunc1(i32 %x) { -; CHECK: @trunc1 +; CHECK-LABEL: @trunc1( %y = add i32 %x, 1 %tx = trunc i32 %x to i16 %ty = trunc i32 %y to i16 diff --git a/test/Transforms/InstSimplify/rem.ll b/test/Transforms/InstSimplify/rem.ll index 4c8f87cf5e920..80fa8e7b48315 100644 --- a/test/Transforms/InstSimplify/rem.ll +++ b/test/Transforms/InstSimplify/rem.ll @@ -1,7 +1,7 @@ ; RUN: opt < %s -instsimplify -S | FileCheck %s define i32 @select1(i32 %x, i1 %b) { -; CHECK: @select1 +; CHECK-LABEL: @select1( %rhs = select i1 %b, i32 %x, i32 1 %rem = srem i32 %x, %rhs ret i32 %rem @@ -9,7 +9,7 @@ define i32 @select1(i32 %x, i1 %b) { } define i32 @select2(i32 %x, i1 %b) { -; CHECK: @select2 +; CHECK-LABEL: @select2( %rhs = select i1 %b, i32 %x, i32 1 %rem = urem i32 %x, %rhs ret i32 %rem |
