diff options
author | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-07-17 15:36:56 +0000 |
commit | 1176aa52646fe641a4243a246aa7f960c708a274 (patch) | |
tree | c8086addb211fa670a9d2b1038d8c2e453229755 /test/Transforms | |
parent | ece02cd5829cea836e9365b0845a8ef042d17b0a (diff) | |
download | FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.zip FreeBSD-src-1176aa52646fe641a4243a246aa7f960c708a274.tar.gz |
Vendor import of llvm trunk r135360:
http://llvm.org/svn/llvm-project/llvm/trunk@135360
Diffstat (limited to 'test/Transforms')
144 files changed, 5533 insertions, 3014 deletions
diff --git a/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll b/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll index 43462fa..8910bda 100644 --- a/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll +++ b/test/Transforms/ADCE/2002-01-31-UseStuckAround.ll @@ -1,7 +1,6 @@ ; RUN: opt < %s -adce -define i32 @"main"(i32 %argc) -begin +define i32 @"main"(i32 %argc) { br label %2 %retval = phi i32 [ %argc, %2 ] ; <i32> [#uses=2] @@ -9,5 +8,4 @@ begin ret i32 %two br label %1 -end - +} diff --git a/test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll b/test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll deleted file mode 100644 index 0fbd330..0000000 --- a/test/Transforms/CodeExtractor/2004-03-17-OutputMismatch.ll +++ /dev/null @@ -1,20 +0,0 @@ -; RUN: opt < %s -loop-extract -disable-output - -%struct.node_t = type { double*, %struct.node_t*, %struct.node_t**, double**, double*, i32, i32 } -%struct.table_t = type { [1 x %struct.node_t**], [1 x %struct.node_t**] } - -define void @make_tables() { -entry: - %tmp.0.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=1] - br i1 false, label %no_exit.i, label %loopexit.i - -no_exit.i: ; preds = %no_exit.i, %entry - %prev_node.0.i.1 = phi %struct.node_t* [ %tmp.16.i, %no_exit.i ], [ %tmp.0.i, %entry ] ; <%struct.node_t*> [#uses=0] - %tmp.16.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=2] - br i1 false, label %no_exit.i, label %loopexit.i - -loopexit.i: ; preds = %no_exit.i, %entry - %cur_node.0.i.0 = phi %struct.node_t* [ null, %entry ], [ %tmp.16.i, %no_exit.i ] ; <%struct.node_t*> [#uses=0] - ret void -} - diff --git a/test/Transforms/ConstProp/extractvalue.ll b/test/Transforms/ConstProp/extractvalue.ll index 32d5291..f947b22 100644 --- a/test/Transforms/ConstProp/extractvalue.ll +++ b/test/Transforms/ConstProp/extractvalue.ll @@ -1,7 +1,6 @@ ; RUN: opt < %s -constprop -S | FileCheck %s %struct = type { i32, [4 x i8] } -%array = type [3 x %struct] define i32 @test1() { %A = extractvalue %struct { i32 2, [4 x i8] c"foo\00" }, 0 @@ -18,7 +17,7 @@ define i8 @test2() { } define i32 @test3() { - %A = extractvalue %array [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], 1, 0 + %A = extractvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], 1, 0 ret i32 %A ; CHECK: @test3 ; CHECK: ret i32 1 @@ -39,7 +38,7 @@ define i8 @zeroinitializer-test2() { } define i32 @zeroinitializer-test3() { - %A = extractvalue %array zeroinitializer, 1, 0 + %A = extractvalue [3 x %struct] zeroinitializer, 1, 0 ret i32 %A ; CHECK: @zeroinitializer-test3 ; CHECK: ret i32 0 @@ -60,7 +59,7 @@ define i8 @undef-test2() { } define i32 @undef-test3() { - %A = extractvalue %array undef, 1, 0 + %A = extractvalue [3 x %struct] undef, 1, 0 ret i32 %A ; CHECK: @undef-test3 ; CHECK: ret i32 undef diff --git a/test/Transforms/ConstProp/insertvalue.ll b/test/Transforms/ConstProp/insertvalue.ll index f0eb553..a4b7bb1 100644 --- a/test/Transforms/ConstProp/insertvalue.ll +++ b/test/Transforms/ConstProp/insertvalue.ll @@ -1,7 +1,6 @@ ; RUN: opt < %s -constprop -S | FileCheck %s %struct = type { i32, [4 x i8] } -%array = type [3 x %struct] define %struct @test1() { %A = insertvalue %struct { i32 2, [4 x i8] c"foo\00" }, i32 1, 0 @@ -17,11 +16,11 @@ define %struct @test2() { ; CHECK: ret %struct { i32 2, [4 x i8] c"fo\01\00" } } -define %array @test3() { - %A = insertvalue %array [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], i32 -1, 1, 0 - ret %array %A +define [3 x %struct] @test3() { + %A = insertvalue [3 x %struct] [ %struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" } ], i32 -1, 1, 0 + ret [3 x %struct] %A ; CHECK: @test3 -; CHECK:ret %array [%struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 -1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" }] +; CHECK:ret [3 x %struct] [%struct { i32 0, [4 x i8] c"aaaa" }, %struct { i32 -1, [4 x i8] c"bbbb" }, %struct { i32 2, [4 x i8] c"cccc" }] } define %struct @zeroinitializer-test1() { @@ -38,11 +37,11 @@ define %struct @zeroinitializer-test2() { ; CHECK: ret %struct { i32 0, [4 x i8] c"\00\00\01\00" } } -define %array @zeroinitializer-test3() { - %A = insertvalue %array zeroinitializer, i32 1, 1, 0 - ret %array %A +define [3 x %struct] @zeroinitializer-test3() { + %A = insertvalue [3 x %struct] zeroinitializer, i32 1, 1, 0 + ret [3 x %struct] %A ; CHECK: @zeroinitializer-test3 -; CHECK: ret %array [%struct zeroinitializer, %struct { i32 1, [4 x i8] zeroinitializer }, %struct zeroinitializer] +; CHECK: ret [3 x %struct] [%struct zeroinitializer, %struct { i32 1, [4 x i8] zeroinitializer }, %struct zeroinitializer] } define %struct @undef-test1() { @@ -59,10 +58,10 @@ define %struct @undef-test2() { ; CHECK: ret %struct { i32 undef, [4 x i8] [i8 undef, i8 undef, i8 0, i8 undef] } } -define %array @undef-test3() { - %A = insertvalue %array undef, i32 0, 1, 0 - ret %array %A +define [3 x %struct] @undef-test3() { + %A = insertvalue [3 x %struct] undef, i32 0, 1, 0 + ret [3 x %struct] %A ; CHECK: @undef-test3 -; CHECK: ret %array [%struct undef, %struct { i32 0, [4 x i8] undef }, %struct undef] +; CHECK: ret [3 x %struct] [%struct undef, %struct { i32 0, [4 x i8] undef }, %struct undef] } diff --git a/test/Transforms/ConstProp/overflow-ops.ll b/test/Transforms/ConstProp/overflow-ops.ll index d1cc2eb..849bf9e 100644 --- a/test/Transforms/ConstProp/overflow-ops.ll +++ b/test/Transforms/ConstProp/overflow-ops.ll @@ -1,6 +1,5 @@ ; RUN: opt < %s -constprop -S | FileCheck %s -%i8i1 = type {i8, i1} declare {i8, i1} @llvm.uadd.with.overflow.i8(i8, i8) declare {i8, i1} @llvm.usub.with.overflow.i8(i8, i8) @@ -20,7 +19,7 @@ entry: ret {i8, i1} %t ; CHECK: @uadd_1 -; CHECK: ret %i8i1 { i8 -114, i1 false } +; CHECK: ret { i8, i1 } { i8 -114, i1 false } } define {i8, i1} @uadd_2() nounwind { @@ -29,7 +28,7 @@ entry: ret {i8, i1} %t ; CHECK: @uadd_2 -; CHECK: ret %i8i1 { i8 6, i1 true } +; CHECK: ret { i8, i1 } { i8 6, i1 true } } ;;----------------------------- @@ -42,7 +41,7 @@ entry: ret {i8, i1} %t ; CHECK: @usub_1 -; CHECK: ret %i8i1 { i8 2, i1 false } +; CHECK: ret { i8, i1 } { i8 2, i1 false } } define {i8, i1} @usub_2() nounwind { @@ -51,7 +50,7 @@ entry: ret {i8, i1} %t ; CHECK: @usub_2 -; CHECK: ret %i8i1 { i8 -2, i1 true } +; CHECK: ret { i8, i1 } { i8 -2, i1 true } } ;;----------------------------- @@ -64,7 +63,7 @@ entry: ret {i8, i1} %t ; CHECK: @umul_1 -; CHECK: ret %i8i1 { i8 44, i1 true } +; CHECK: ret { i8, i1 } { i8 44, i1 true } } define {i8, i1} @umul_2() nounwind { @@ -73,7 +72,7 @@ entry: ret {i8, i1} %t ; CHECK: @umul_2 -; CHECK: ret %i8i1 { i8 -56, i1 false } +; CHECK: ret { i8, i1 } { i8 -56, i1 false } } ;;----------------------------- @@ -86,7 +85,7 @@ entry: ret {i8, i1} %t ; CHECK: @sadd_1 -; CHECK: ret %i8i1 { i8 44, i1 false } +; CHECK: ret { i8, i1 } { i8 44, i1 false } } define {i8, i1} @sadd_2() nounwind { @@ -95,7 +94,7 @@ entry: ret {i8, i1} %t ; CHECK: @sadd_2 -; CHECK: ret %i8i1 { i8 -126, i1 true } +; CHECK: ret { i8, i1 } { i8 -126, i1 true } } define {i8, i1} @sadd_3() nounwind { @@ -104,7 +103,7 @@ entry: ret {i8, i1} %t ; CHECK: @sadd_3 -; CHECK: ret %i8i1 { i8 -110, i1 false } +; CHECK: ret { i8, i1 } { i8 -110, i1 false } } define {i8, i1} @sadd_4() nounwind { @@ -113,7 +112,7 @@ entry: ret {i8, i1} %t ; CHECK: @sadd_4 -; CHECK: ret %i8i1 { i8 126, i1 true } +; CHECK: ret { i8, i1 } { i8 126, i1 true } } define {i8, i1} @sadd_5() nounwind { @@ -122,7 +121,7 @@ entry: ret {i8, i1} %t ; CHECK: @sadd_5 -; CHECK: ret %i8i1 { i8 -8, i1 false } +; CHECK: ret { i8, i1 } { i8 -8, i1 false } } @@ -136,7 +135,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_1 -; CHECK: ret %i8i1 { i8 2, i1 false } +; CHECK: ret { i8, i1 } { i8 2, i1 false } } define {i8, i1} @ssub_2() nounwind { @@ -145,7 +144,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_2 -; CHECK: ret %i8i1 { i8 -2, i1 false } +; CHECK: ret { i8, i1 } { i8 -2, i1 false } } define {i8, i1} @ssub_3() nounwind { @@ -154,7 +153,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_3 -; CHECK: ret %i8i1 { i8 126, i1 true } +; CHECK: ret { i8, i1 } { i8 126, i1 true } } define {i8, i1} @ssub_3b() nounwind { @@ -163,7 +162,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_3b -; CHECK: ret %i8i1 { i8 -20, i1 false } +; CHECK: ret { i8, i1 } { i8 -20, i1 false } } define {i8, i1} @ssub_4() nounwind { @@ -172,7 +171,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_4 -; CHECK: ret %i8i1 { i8 -126, i1 true } +; CHECK: ret { i8, i1 } { i8 -126, i1 true } } define {i8, i1} @ssub_4b() nounwind { @@ -181,7 +180,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_4b -; CHECK: ret %i8i1 { i8 30, i1 false } +; CHECK: ret { i8, i1 } { i8 30, i1 false } } define {i8, i1} @ssub_5() nounwind { @@ -190,7 +189,7 @@ entry: ret {i8, i1} %t ; CHECK: @ssub_5 -; CHECK: ret %i8i1 { i8 -10, i1 false } +; CHECK: ret { i8, i1 } { i8 -10, i1 false } } ;;----------------------------- @@ -204,5 +203,5 @@ entry: ret {i8, i1} %t ; CHECK: @smul_1 -; CHECK: ret %i8i1 { i8 -56, i1 true } +; CHECK: ret { i8, i1 } { i8 -56, i1 true } } diff --git a/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll b/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll index 0e9c4f7..7c6c575 100644 --- a/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll +++ b/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll @@ -9,12 +9,12 @@ @g = global i8 0 -define internal i8 @foo(i8* inreg %p, i8 signext %y, ... ) zeroext nounwind { +define internal zeroext i8 @foo(i8* inreg %p, i8 signext %y, ... ) nounwind { store i8 %y, i8* @g ret i8 0 } define i32 @bar() { - %A = call i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) zeroext nounwind + %A = call zeroext i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) nounwind ret i32 0 } diff --git a/test/Transforms/DeadArgElim/keepalive.ll b/test/Transforms/DeadArgElim/keepalive.ll index b0b9bf3..4d6aae3 100644 --- a/test/Transforms/DeadArgElim/keepalive.ll +++ b/test/Transforms/DeadArgElim/keepalive.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -deadargelim -S > %t ; RUN: grep {define internal zeroext i32 @test1() nounwind} %t -; RUN: grep {define internal %Ty @test2} %t +; RUN: grep {define internal <{ i32, i32 }> @test2} %t %Ty = type <{ i32, i32 }> diff --git a/test/Transforms/DeadStoreElimination/crash.ll b/test/Transforms/DeadStoreElimination/crash.ll index bb279cd..148695f 100644 --- a/test/Transforms/DeadStoreElimination/crash.ll +++ b/test/Transforms/DeadStoreElimination/crash.ll @@ -36,11 +36,11 @@ bb14: ; preds = %bb4 %6 = getelementptr inbounds i16* %2, i64 undef ; <i16*> [#uses=1] store i16 undef, i16* %6, align 2 %7 = getelementptr inbounds i8* %5, i64 undef ; <i8*> [#uses=1] - call void @llvm.memcpy.i64(i8* %7, i8* undef, i64 undef, i32 1) nounwind + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %7, i8* undef, i64 undef, i32 1, i1 false) unreachable } -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind ; rdar://7635088 diff --git a/test/Transforms/DeadStoreElimination/free.ll b/test/Transforms/DeadStoreElimination/free.ll index 3c980cc..aa3f0ab 100644 --- a/test/Transforms/DeadStoreElimination/free.ll +++ b/test/Transforms/DeadStoreElimination/free.ll @@ -9,7 +9,8 @@ target datalayout = "e-p:64:64:64" define void @test(i32* %Q, i32* %P) { %DEAD = load i32* %Q ; <i32> [#uses=1] store i32 %DEAD, i32* %P - free i32* %P + %1 = bitcast i32* %P to i8* + tail call void @free(i8* %1) ret void } @@ -20,7 +21,8 @@ define void @test(i32* %Q, i32* %P) { define void @test2({i32, i32}* %P) { %Q = getelementptr {i32, i32} *%P, i32 0, i32 1 store i32 4, i32* %Q - free {i32,i32}* %P + %1 = bitcast {i32, i32}* %P to i8* + tail call void @free(i8* %1) ret void } diff --git a/test/Transforms/DeadStoreElimination/lifetime.ll b/test/Transforms/DeadStoreElimination/lifetime.ll index 2b5cc5a..6785653 100644 --- a/test/Transforms/DeadStoreElimination/lifetime.ll +++ b/test/Transforms/DeadStoreElimination/lifetime.ll @@ -4,7 +4,7 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind -declare void @llvm.memset.i8(i8*, i8, i8, i32) +declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i32, i1) nounwind define void @test1() { ; CHECK: @test1 @@ -14,7 +14,7 @@ define void @test1() { call void @llvm.lifetime.end(i64 1, i8* %A) ; CHECK: lifetime.end - call void @llvm.memset.i8(i8* %A, i8 0, i8 -1, i32 0) + call void @llvm.memset.p0i8.i8(i8* %A, i8 0, i8 -1, i32 0, i1 false) ; CHECK-NOT: memset ret void diff --git a/test/Transforms/DeadStoreElimination/memintrinsics.ll b/test/Transforms/DeadStoreElimination/memintrinsics.ll index e31e9fa..d5c5365 100644 --- a/test/Transforms/DeadStoreElimination/memintrinsics.ll +++ b/test/Transforms/DeadStoreElimination/memintrinsics.ll @@ -1,8 +1,8 @@ ; RUN: opt -S -dse < %s | FileCheck %s -declare void @llvm.memcpy.i8(i8*, i8*, i8, i32) -declare void @llvm.memmove.i8(i8*, i8*, i8, i32) -declare void @llvm.memset.i8(i8*, i8, i8, i32) +declare void @llvm.memcpy.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i32, i1) nounwind +declare void @llvm.memmove.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i32, i1) nounwind +declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i32, i1) nounwind define void @test1() { ; CHECK: @test1 @@ -12,7 +12,7 @@ define void @test1() { store i8 0, i8* %A ;; Written to by memcpy ; CHECK-NOT: store - call void @llvm.memcpy.i8(i8* %A, i8* %B, i8 -1, i32 0) + call void @llvm.memcpy.p0i8.p0i8.i8(i8* %A, i8* %B, i8 -1, i32 0, i1 false) ret void ; CHECK: ret void @@ -26,7 +26,7 @@ define void @test2() { store i8 0, i8* %A ;; Written to by memmove ; CHECK-NOT: store - call void @llvm.memmove.i8(i8* %A, i8* %B, i8 -1, i32 0) + call void @llvm.memmove.p0i8.p0i8.i8(i8* %A, i8* %B, i8 -1, i32 0, i1 false) ret void ; CHECK: ret void @@ -40,7 +40,7 @@ define void @test3() { store i8 0, i8* %A ;; Written to by memset ; CHECK-NOT: store - call void @llvm.memset.i8(i8* %A, i8 0, i8 -1, i32 0) + call void @llvm.memset.p0i8.i8(i8* %A, i8 0, i8 -1, i32 0, i1 false) ret void ; CHECK: ret void diff --git a/test/Transforms/DeadStoreElimination/simple.ll b/test/Transforms/DeadStoreElimination/simple.ll index 23576dad..5f143fc 100644 --- a/test/Transforms/DeadStoreElimination/simple.ll +++ b/test/Transforms/DeadStoreElimination/simple.ll @@ -3,8 +3,6 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind -declare void @llvm.memset.i64(i8*, i8, i64, i32) -declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) declare i8* @llvm.init.trampoline(i8*, i8*, i8*) define void @test1(i32* %Q, i32* %P) { @@ -65,7 +63,7 @@ define void @test5(i32* %Q) { ; alias). define void @test6(i32 *%p, i8 *%q) { store i32 10, i32* %p, align 4 ;; dead. - call void @llvm.memset.i64(i8* %q, i8 42, i64 900, i32 1) + call void @llvm.memset.p0i8.i64(i8* %q, i8 42, i64 900, i32 1, i1 false) store i32 30, i32* %p, align 4 ret void ; CHECK: @test6 @@ -76,7 +74,7 @@ define void @test6(i32 *%p, i8 *%q) { ; alias). define void @test7(i32 *%p, i8 *%q, i8* noalias %r) { store i32 10, i32* %p, align 4 ;; dead. - call void @llvm.memcpy.i64(i8* %q, i8* %r, i64 900, i32 1) + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %q, i8* %r, i64 900, i32 1, i1 false) store i32 30, i32* %p, align 4 ret void ; CHECK: @test7 @@ -184,8 +182,8 @@ define void @test14(i32* %Q) { ;; Fully dead overwrite of memcpy. define void @test15(i8* %P, i8* %Q) nounwind ssp { - tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1) - tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false) ret void ; CHECK: @test15 ; CHECK-NEXT: call void @llvm.memcpy @@ -194,8 +192,8 @@ define void @test15(i8* %P, i8* %Q) nounwind ssp { ;; Full overwrite of smaller memcpy. define void @test16(i8* %P, i8* %Q) nounwind ssp { - tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 8, i32 1) - tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 8, i32 1, i1 false) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false) ret void ; CHECK: @test16 ; CHECK-NEXT: call void @llvm.memcpy @@ -204,8 +202,8 @@ define void @test16(i8* %P, i8* %Q) nounwind ssp { ;; Overwrite of memset by memcpy. define void @test17(i8* %P, i8* noalias %Q) nounwind ssp { - tail call void @llvm.memset.i64(i8* %P, i8 42, i64 8, i32 1) - tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1) + tail call void @llvm.memset.p0i8.i64(i8* %P, i8 42, i64 8, i32 1, i1 false) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false) ret void ; CHECK: @test17 ; CHECK-NEXT: call void @llvm.memcpy @@ -228,8 +226,8 @@ define void @test17v(i8* %P, i8* %Q) nounwind ssp { ; A = B ; A = A define void @test18(i8* %P, i8* %Q, i8* %R) nounwind ssp { - tail call void @llvm.memcpy.i64(i8* %P, i8* %Q, i64 12, i32 1) - tail call void @llvm.memcpy.i64(i8* %P, i8* %R, i64 12, i32 1) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %Q, i64 12, i32 1, i1 false) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %P, i8* %R, i64 12, i32 1, i1 false) ret void ; CHECK: @test18 ; CHECK-NEXT: call void @llvm.memcpy diff --git a/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll b/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll deleted file mode 100644 index faac118..0000000 --- a/test/Transforms/FunctionAttrs/2008-10-04-LocalMemory.ll +++ /dev/null @@ -1,64 +0,0 @@ -; RUN: opt < %s -basicaa -functionattrs -S | FileCheck %s - -%struct.X = type { i32*, i32* } - -declare i32 @g(i32*) readnone - -define i32 @f() { -; CHECK: @f() readnone - %x = alloca i32 ; <i32*> [#uses=2] - store i32 0, i32* %x - %y = call i32 @g(i32* %x) ; <i32> [#uses=1] - ret i32 %y -} - -define i32 @foo() nounwind { -; CHECK: @foo() nounwind readonly -entry: - %y = alloca %struct.X ; <%struct.X*> [#uses=2] - %x = alloca %struct.X ; <%struct.X*> [#uses=2] - %j = alloca i32 ; <i32*> [#uses=2] - %i = alloca i32 ; <i32*> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i32 0, i32* %i, align 4 - store i32 1, i32* %j, align 4 - %0 = getelementptr inbounds %struct.X* %y, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %i, i32** %0, align 8 - %1 = getelementptr inbounds %struct.X* %x, i32 0, i32 1 ; <i32**> [#uses=1] - store i32* %j, i32** %1, align 8 - %x1 = bitcast %struct.X* %x to i8* ; <i8*> [#uses=2] - %y2 = bitcast %struct.X* %y to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i64(i8* %x1, i8* %y2, i64 8, i32 1) - %2 = bitcast i8* %x1 to i32** ; <i32**> [#uses=1] - %3 = load i32** %2, align 8 ; <i32*> [#uses=1] - %4 = load i32* %3, align 4 ; <i32> [#uses=1] - br label %return - -return: ; preds = %entry - ret i32 %4 -} - -define i32 @t(i32 %a, i32 %b, i32 %c) nounwind { -; CHECK: @t(i32 %a, i32 %b, i32 %c) nounwind readnone -entry: - %a.addr = alloca i32 ; <i32*> [#uses=3] - %c.addr = alloca i32 ; <i32*> [#uses=2] - store i32 %a, i32* %a.addr - store i32 %c, i32* %c.addr - %tmp = load i32* %a.addr ; <i32> [#uses=1] - %tobool = icmp ne i32 %tmp, 0 ; <i1> [#uses=1] - br i1 %tobool, label %if.then, label %if.else - -if.then: ; preds = %entry - br label %if.end - -if.else: ; preds = %entry - br label %if.end - -if.end: ; preds = %if.else, %if.then - %p.0 = phi i32* [ %a.addr, %if.then ], [ %c.addr, %if.else ] ; <i32*> [#uses=1] - %tmp2 = load i32* %p.0 ; <i32> [#uses=1] - ret i32 %tmp2 -} - -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind diff --git a/test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll b/test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll deleted file mode 100644 index 488e6a9..0000000 --- a/test/Transforms/FunctionAttrs/2009-05-06-Malloc.ll +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: opt < %s -functionattrs -S | not grep read -; PR3754 - -define i8* @m(i32 %size) { - %tmp = malloc i8, i32 %size ; <i8*> [#uses=1] - ret i8* %tmp -} diff --git a/test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll b/test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll deleted file mode 100644 index 9a75e1a..0000000 --- a/test/Transforms/GVN/2008-02-24-NonDominatedMemcpy.ll +++ /dev/null @@ -1,25 +0,0 @@ -; RUN: opt < %s -gvn -dse -S | grep {call.*memcpy} | count 1 - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-apple-darwin8" - %struct.ggFrame3 = type { %struct.ggPoint3, %struct.ggONB3 } - %struct.ggHMatrix3 = type { [4 x [4 x double]] } - %struct.ggONB3 = type { %struct.ggPoint3, %struct.ggPoint3, %struct.ggPoint3 } - %struct.ggPoint3 = type { [3 x double] } - %struct.ggQuaternion = type { [4 x double], i32, %struct.ggHMatrix3 } - -declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind - -define void @_Z10ggCRSplineRK8ggFrame3S1_S1_S1_d(%struct.ggFrame3* noalias sret %agg.result, %struct.ggFrame3* %f0, %struct.ggFrame3* %f1, %struct.ggFrame3* %f2, %struct.ggFrame3* %f3, double %t) nounwind { -entry: - %qresult = alloca %struct.ggQuaternion ; <%struct.ggQuaternion*> [#uses=1] - %tmp = alloca %struct.ggONB3 ; <%struct.ggONB3*> [#uses=2] - call void @_ZN12ggQuaternion7getONB3Ev( %struct.ggONB3* noalias sret %tmp, %struct.ggQuaternion* %qresult ) nounwind - %tmp1.i = getelementptr %struct.ggFrame3* %agg.result, i32 0, i32 1 ; <%struct.ggONB3*> [#uses=1] - %tmp13.i = bitcast %struct.ggONB3* %tmp1.i to i8* ; <i8*> [#uses=1] - %tmp24.i = bitcast %struct.ggONB3* %tmp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i64( i8* %tmp13.i, i8* %tmp24.i, i64 72, i32 8 ) nounwind - ret void -} - -declare void @_ZN12ggQuaternion7getONB3Ev(%struct.ggONB3* noalias sret , %struct.ggQuaternion*) nounwind diff --git a/test/Transforms/GVN/2008-02-26-MemCpySize.ll b/test/Transforms/GVN/2008-02-26-MemCpySize.ll deleted file mode 100644 index 6ed8a76..0000000 --- a/test/Transforms/GVN/2008-02-26-MemCpySize.ll +++ /dev/null @@ -1,46 +0,0 @@ -; RUN: opt < %s -gvn -dse -S | grep {call.*memcpy.*cell} | count 2 -; PR2099 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin9" - %struct.s = type { [11 x i8], i32 } -@.str = internal constant [11 x i8] c"0123456789\00" ; <[11 x i8]*> [#uses=1] -@cell = weak global %struct.s zeroinitializer ; <%struct.s*> [#uses=2] - -declare i32 @check(%struct.s* byval %p) nounwind - -declare i32 @strcmp(i8*, i8*) nounwind readonly - -define i32 @main() noreturn nounwind { -entry: - %p = alloca %struct.s, align 8 ; <%struct.s*> [#uses=2] - store i32 99, i32* getelementptr (%struct.s* @cell, i32 0, i32 1), align 4 - call void @llvm.memcpy.i32( i8* getelementptr (%struct.s* @cell, i32 0, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str, i32 0, i32 0), i32 11, i32 1 ) - %tmp = getelementptr %struct.s* %p, i32 0, i32 0, i32 0 ; <i8*> [#uses=2] - call void @llvm.memcpy.i64( i8* %tmp, i8* getelementptr (%struct.s* @cell, i32 0, i32 0, i32 0), i64 16, i32 8 ) - %tmp1.i = getelementptr %struct.s* %p, i32 0, i32 1 ; <i32*> [#uses=1] - %tmp2.i = load i32* %tmp1.i, align 4 ; <i32> [#uses=1] - %tmp3.i = icmp eq i32 %tmp2.i, 99 ; <i1> [#uses=1] - br i1 %tmp3.i, label %bb5.i, label %bb - -bb5.i: ; preds = %entry - %tmp91.i = call i32 @strcmp( i8* %tmp, i8* getelementptr ([11 x i8]* @.str, i32 0, i32 0) ) nounwind readonly ; <i32> [#uses=1] - %tmp53 = icmp eq i32 %tmp91.i, 0 ; <i1> [#uses=1] - br i1 %tmp53, label %bb7, label %bb - -bb: ; preds = %bb5.i, %entry - call void @abort( ) noreturn nounwind - unreachable - -bb7: ; preds = %bb5.i - call void @exit( i32 0 ) noreturn nounwind - unreachable -} - -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind - -declare void @abort() noreturn nounwind - -declare void @exit(i32) noreturn nounwind - -declare void @llvm.memcpy.i64(i8*, i8*, i64, i32) nounwind diff --git a/test/Transforms/GVN/2011-04-27-phioperands.ll b/test/Transforms/GVN/2011-04-27-phioperands.ll new file mode 100644 index 0000000..6e5075d --- /dev/null +++ b/test/Transforms/GVN/2011-04-27-phioperands.ll @@ -0,0 +1,106 @@ +; RUN: opt %s -gvn -disable-output + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64" + +@nuls = external global [10 x i8] + +define fastcc void @p_ere() nounwind { +entry: + br label %"<bb 5>" + +"<L18>.i": + br i1 undef, label %"<bb 3>.i30.i", label %doemit.exit51.i + +"<bb 3>.i30.i": + unreachable + +doemit.exit51.i: + br label %"<bb 53>.i" + +"<L19>.i": + br i1 undef, label %"<bb 3>.i55.i", label %doemit.exit76.i + +"<bb 3>.i55.i": + unreachable + +doemit.exit76.i: + br label %"<bb 53>.i" + +"<L98>.i": + store i8* getelementptr inbounds ([10 x i8]* @nuls, i64 0, i64 0), i8** undef, align 8 + br label %"<bb 53>.i" + +"<L99>.i": + br label %"<bb 53>.i" + +"<L24>.i": + br i1 undef, label %"<bb 53>.i", label %"<bb 35>.i" + +"<bb 35>.i": + br label %"<bb 53>.i" + +"<L28>.i": + br label %"<bb 53>.i" + +"<L29>.i": + br label %"<bb 53>.i" + +"<L39>.i": + br label %"<bb 53>.i" + +"<bb 53>.i": + %wascaret_2.i = phi i32 [ 0, %"<L39>.i" ], [ 0, %"<L29>.i" ], [ 0, %"<L28>.i" ], [ 0, %"<bb 35>.i" ], [ 0, %"<L99>.i" ], [ 0, %"<L98>.i" ], [ 0, %doemit.exit76.i ], [ 1, %doemit.exit51.i ], [ 0, %"<L24>.i" ] + %D.5496_84.i = load i8** undef, align 8 + br i1 undef, label %"<bb 54>.i", label %"<bb 5>" + +"<bb 54>.i": + br i1 undef, label %"<bb 5>", label %"<bb 58>.i" + +"<bb 58>.i": + br i1 undef, label %"<bb 64>.i", label %"<bb 59>.i" + +"<bb 59>.i": + br label %"<bb 64>.i" + +"<bb 64>.i": + switch i32 undef, label %"<bb 5>" [ + i32 42, label %"<L54>.i" + i32 43, label %"<L55>.i" + i32 63, label %"<L56>.i" + i32 123, label %"<bb 5>.i258.i" + ] + +"<L54>.i": + br i1 undef, label %"<bb 3>.i105.i", label %doemit.exit127.i + +"<bb 3>.i105.i": + unreachable + +doemit.exit127.i: + unreachable + +"<L55>.i": + br i1 undef, label %"<bb 3>.i157.i", label %"<bb 5>" + +"<bb 3>.i157.i": + unreachable + +"<L56>.i": + br label %"<bb 5>" + +"<bb 5>.i258.i": + unreachable + +"<bb 5>": + switch i32 undef, label %"<L39>.i" [ + i32 36, label %"<L19>.i" + i32 94, label %"<L18>.i" + i32 124, label %"<L98>.i" + i32 42, label %"<L99>.i" + i32 43, label %"<L99>.i" + i32 46, label %"<L24>.i" + i32 63, label %"<L99>.i" + i32 91, label %"<L28>.i" + i32 92, label %"<L29>.i" + ] +} diff --git a/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll b/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll new file mode 100644 index 0000000..18178e4 --- /dev/null +++ b/test/Transforms/GVN/2011-07-07-MatchIntrinsicExtract.ll @@ -0,0 +1,85 @@ +; RUN: opt < %s -gvn -S | FileCheck %s +; + +%0 = type { i64, i1 } + +define i64 @test1(i64 %a, i64 %b) nounwind ssp { +entry: + %uadd = tail call %0 @llvm.uadd.with.overflow.i64(i64 %a, i64 %b) + %uadd.0 = extractvalue %0 %uadd, 0 + %add1 = add i64 %a, %b + ret i64 %add1 +} + +; CHECK: @test1 +; CHECK-NOT: add1 +; CHECK: ret + +define i64 @test2(i64 %a, i64 %b) nounwind ssp { +entry: + %usub = tail call %0 @llvm.usub.with.overflow.i64(i64 %a, i64 %b) + %usub.0 = extractvalue %0 %usub, 0 + %sub1 = sub i64 %a, %b + ret i64 %sub1 +} + +; CHECK: @test2 +; CHECK-NOT: sub1 +; CHECK: ret + +define i64 @test3(i64 %a, i64 %b) nounwind ssp { +entry: + %umul = tail call %0 @llvm.umul.with.overflow.i64(i64 %a, i64 %b) + %umul.0 = extractvalue %0 %umul, 0 + %mul1 = mul i64 %a, %b + ret i64 %mul1 +} + +; CHECK: @test3 +; CHECK-NOT: mul1 +; CHECK: ret + +define i64 @test4(i64 %a, i64 %b) nounwind ssp { +entry: + %sadd = tail call %0 @llvm.sadd.with.overflow.i64(i64 %a, i64 %b) + %sadd.0 = extractvalue %0 %sadd, 0 + %add1 = add i64 %a, %b + ret i64 %add1 +} + +; CHECK: @test4 +; CHECK-NOT: add1 +; CHECK: ret + +define i64 @test5(i64 %a, i64 %b) nounwind ssp { +entry: + %ssub = tail call %0 @llvm.ssub.with.overflow.i64(i64 %a, i64 %b) + %ssub.0 = extractvalue %0 %ssub, 0 + %sub1 = sub i64 %a, %b + ret i64 %sub1 +} + +; CHECK: @test5 +; CHECK-NOT: sub1 +; CHECK: ret + +define i64 @test6(i64 %a, i64 %b) nounwind ssp { +entry: + %smul = tail call %0 @llvm.smul.with.overflow.i64(i64 %a, i64 %b) + %smul.0 = extractvalue %0 %smul, 0 + %mul1 = mul i64 %a, %b + ret i64 %mul1 +} + +; CHECK: @test6 +; CHECK-NOT: mul1 +; CHECK: ret + +declare void @exit(i32) noreturn +declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone +declare %0 @llvm.usub.with.overflow.i64(i64, i64) nounwind readnone +declare %0 @llvm.umul.with.overflow.i64(i64, i64) nounwind readnone +declare %0 @llvm.sadd.with.overflow.i64(i64, i64) nounwind readnone +declare %0 @llvm.ssub.with.overflow.i64(i64, i64) nounwind readnone +declare %0 @llvm.smul.with.overflow.i64(i64, i64) nounwind readnone + diff --git a/test/Transforms/GVN/nonescaping-malloc.ll b/test/Transforms/GVN/nonescaping-malloc.ll index 1d50205..dba9d81 100644 --- a/test/Transforms/GVN/nonescaping-malloc.ll +++ b/test/Transforms/GVN/nonescaping-malloc.ll @@ -20,13 +20,13 @@ target triple = "x86_64-apple-darwin10.0" define %"struct.llvm::StringMapEntry<void*>"* @_Z3fooRN4llvm9StringMapIPvNS_15MallocAllocatorEEEPKc(%"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %X, i8* %P) ssp { entry: - %tmp = alloca %"struct.llvm::StringRef", align 8 ; <%"struct.llvm::StringRef"*> [#uses=3] - %tmp.i = getelementptr inbounds %"struct.llvm::StringRef"* %tmp, i64 0, i32 0 ; <i8**> [#uses=1] + %tmp = alloca %"struct.llvm::StringRef", align 8 + %tmp.i = getelementptr inbounds %"struct.llvm::StringRef"* %tmp, i64 0, i32 0 store i8* %P, i8** %tmp.i, align 8 - %tmp1.i = call i64 @strlen(i8* %P) nounwind readonly ; <i64> [#uses=1] - %tmp2.i = getelementptr inbounds %"struct.llvm::StringRef"* %tmp, i64 0, i32 1 ; <i64*> [#uses=1] + %tmp1.i = call i64 @strlen(i8* %P) nounwind readonly + %tmp2.i = getelementptr inbounds %"struct.llvm::StringRef"* %tmp, i64 0, i32 1 store i64 %tmp1.i, i64* %tmp2.i, align 8 - %tmp1 = call %"struct.llvm::StringMapEntry<void*>"* @_ZN4llvm9StringMapIPvNS_15MallocAllocatorEE16GetOrCreateValueERKNS_9StringRefE(%"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %X, %"struct.llvm::StringRef"* %tmp) ssp ; <%"struct.llvm::StringMapEntry<void*>"*> [#uses=1] + %tmp1 = call %"struct.llvm::StringMapEntry<void*>"* @_ZN4llvm9StringMapIPvNS_15MallocAllocatorEE16GetOrCreateValueERKNS_9StringRefE(%"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %X, %"struct.llvm::StringRef"* %tmp) ssp ret %"struct.llvm::StringMapEntry<void*>"* %tmp1 } @@ -34,75 +34,75 @@ declare i64 @strlen(i8* nocapture) nounwind readonly declare noalias i8* @malloc(i64) nounwind -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind - declare i32 @_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefE(%"struct.llvm::StringMapImpl"*, i64, i64) define linkonce_odr %"struct.llvm::StringMapEntry<void*>"* @_ZN4llvm9StringMapIPvNS_15MallocAllocatorEE16GetOrCreateValueERKNS_9StringRefE(%"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, %"struct.llvm::StringRef"* nocapture %Key) ssp align 2 { entry: - %elt = bitcast %"struct.llvm::StringRef"* %Key to i64* ; <i64*> [#uses=1] - %val = load i64* %elt ; <i64> [#uses=3] - %tmp = getelementptr inbounds %"struct.llvm::StringRef"* %Key, i64 0, i32 1 ; <i64*> [#uses=1] - %val2 = load i64* %tmp ; <i64> [#uses=2] - %tmp2.i = getelementptr inbounds %"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, i64 0, i32 0 ; <%"struct.llvm::StringMapImpl"*> [#uses=1] - %tmp3.i = tail call i32 @_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefE(%"struct.llvm::StringMapImpl"* %tmp2.i, i64 %val, i64 %val2) ; <i32> [#uses=1] - %tmp4.i = getelementptr inbounds %"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, i64 0, i32 0, i32 0 ; <%"struct.llvm::StringMapImpl::ItemBucket"**> [#uses=1] - %tmp5.i = load %"struct.llvm::StringMapImpl::ItemBucket"** %tmp4.i, align 8 ; <%"struct.llvm::StringMapImpl::ItemBucket"*> [#uses=1] - %tmp6.i = zext i32 %tmp3.i to i64 ; <i64> [#uses=1] - %tmp7.i = getelementptr inbounds %"struct.llvm::StringMapImpl::ItemBucket"* %tmp5.i, i64 %tmp6.i, i32 1 ; <%"struct.llvm::StringMapEntryBase"**> [#uses=2] - %tmp8.i = load %"struct.llvm::StringMapEntryBase"** %tmp7.i, align 8 ; <%"struct.llvm::StringMapEntryBase"*> [#uses=3] - %tmp9.i = icmp eq %"struct.llvm::StringMapEntryBase"* %tmp8.i, null ; <i1> [#uses=1] - %tmp13.i = icmp eq %"struct.llvm::StringMapEntryBase"* %tmp8.i, inttoptr (i64 -1 to %"struct.llvm::StringMapEntryBase"*) ; <i1> [#uses=1] - %or.cond.i = or i1 %tmp9.i, %tmp13.i ; <i1> [#uses=1] + %elt = bitcast %"struct.llvm::StringRef"* %Key to i64* + %val = load i64* %elt + %tmp = getelementptr inbounds %"struct.llvm::StringRef"* %Key, i64 0, i32 1 + %val2 = load i64* %tmp + %tmp2.i = getelementptr inbounds %"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, i64 0, i32 0 + %tmp3.i = tail call i32 @_ZN4llvm13StringMapImpl15LookupBucketForENS_9StringRefE(%"struct.llvm::StringMapImpl"* %tmp2.i, i64 %val, i64 %val2) + %tmp4.i = getelementptr inbounds %"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, i64 0, i32 0, i32 0 + %tmp5.i = load %"struct.llvm::StringMapImpl::ItemBucket"** %tmp4.i, align 8 + %tmp6.i = zext i32 %tmp3.i to i64 + %tmp7.i = getelementptr inbounds %"struct.llvm::StringMapImpl::ItemBucket"* %tmp5.i, i64 %tmp6.i, i32 1 + %tmp8.i = load %"struct.llvm::StringMapEntryBase"** %tmp7.i, align 8 + %tmp9.i = icmp eq %"struct.llvm::StringMapEntryBase"* %tmp8.i, null + %tmp13.i = icmp eq %"struct.llvm::StringMapEntryBase"* %tmp8.i, inttoptr (i64 -1 to %"struct.llvm::StringMapEntryBase"*) + %or.cond.i = or i1 %tmp9.i, %tmp13.i br i1 %or.cond.i, label %bb4.i, label %bb6.i bb4.i: ; preds = %entry - %tmp41.i = inttoptr i64 %val to i8* ; <i8*> [#uses=2] - %tmp4.i35.i = getelementptr inbounds i8* %tmp41.i, i64 %val2 ; <i8*> [#uses=1] - %tmp.i.i = ptrtoint i8* %tmp4.i35.i to i64 ; <i64> [#uses=1] - %tmp1.i.i = trunc i64 %tmp.i.i to i32 ; <i32> [#uses=1] - %tmp3.i.i = trunc i64 %val to i32 ; <i32> [#uses=1] - %tmp4.i.i = sub i32 %tmp1.i.i, %tmp3.i.i ; <i32> [#uses=3] - %tmp5.i.i = add i32 %tmp4.i.i, 17 ; <i32> [#uses=1] - %tmp8.i.i = zext i32 %tmp5.i.i to i64 ; <i64> [#uses=1] - %tmp.i20.i.i = tail call noalias i8* @malloc(i64 %tmp8.i.i) nounwind ; <i8*> [#uses=7] - %tmp10.i.i = bitcast i8* %tmp.i20.i.i to %"struct.llvm::StringMapEntry<void*>"* ; <%"struct.llvm::StringMapEntry<void*>"*> [#uses=2] - %tmp12.i.i = icmp eq i8* %tmp.i20.i.i, null ; <i1> [#uses=1] + %tmp41.i = inttoptr i64 %val to i8* + %tmp4.i35.i = getelementptr inbounds i8* %tmp41.i, i64 %val2 + %tmp.i.i = ptrtoint i8* %tmp4.i35.i to i64 + %tmp1.i.i = trunc i64 %tmp.i.i to i32 + %tmp3.i.i = trunc i64 %val to i32 + %tmp4.i.i = sub i32 %tmp1.i.i, %tmp3.i.i + %tmp5.i.i = add i32 %tmp4.i.i, 17 + %tmp8.i.i = zext i32 %tmp5.i.i to i64 + %tmp.i20.i.i = tail call noalias i8* @malloc(i64 %tmp8.i.i) nounwind + %tmp10.i.i = bitcast i8* %tmp.i20.i.i to %"struct.llvm::StringMapEntry<void*>"* + %tmp12.i.i = icmp eq i8* %tmp.i20.i.i, null br i1 %tmp12.i.i, label %_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i, label %bb.i.i bb.i.i: ; preds = %bb4.i - %tmp.i.i.i.i = bitcast i8* %tmp.i20.i.i to i32* ; <i32*> [#uses=1] + %tmp.i.i.i.i = bitcast i8* %tmp.i20.i.i to i32* store i32 %tmp4.i.i, i32* %tmp.i.i.i.i, align 4 - %tmp1.i19.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 8 ; <i8*> [#uses=1] - %0 = bitcast i8* %tmp1.i19.i.i to i8** ; <i8**> [#uses=1] + %tmp1.i19.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 8 + %0 = bitcast i8* %tmp1.i19.i.i to i8** store i8* null, i8** %0, align 8 br label %_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i -_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i: ; preds = %bb4.i, %bb.i.i - %tmp.i18.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 16 ; <i8*> [#uses=1] - %tmp15.i.i = zext i32 %tmp4.i.i to i64 ; <i64> [#uses=2] - tail call void @llvm.memcpy.i64(i8* %tmp.i18.i.i, i8* %tmp41.i, i64 %tmp15.i.i, i32 1) nounwind - %tmp.i18.sum.i.i = add i64 %tmp15.i.i, 16 ; <i64> [#uses=1] - %tmp17.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 %tmp.i18.sum.i.i ; <i8*> [#uses=1] +_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i: ; preds = %bb.i.i, %bb4.i + %tmp.i18.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 16 + %tmp15.i.i = zext i32 %tmp4.i.i to i64 + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp.i18.i.i, i8* %tmp41.i, i64 %tmp15.i.i, i32 1, i1 false) + %tmp.i18.sum.i.i = add i64 %tmp15.i.i, 16 + %tmp17.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 %tmp.i18.sum.i.i store i8 0, i8* %tmp17.i.i, align 1 - %tmp.i.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 8 ; <i8*> [#uses=1] - %1 = bitcast i8* %tmp.i.i.i to i8** ; <i8**> [#uses=1] + %tmp.i.i.i = getelementptr inbounds i8* %tmp.i20.i.i, i64 8 + %1 = bitcast i8* %tmp.i.i.i to i8** store i8* null, i8** %1, align 8 - %tmp22.i = load %"struct.llvm::StringMapEntryBase"** %tmp7.i, align 8 ; <%"struct.llvm::StringMapEntryBase"*> [#uses=1] - %tmp24.i = icmp eq %"struct.llvm::StringMapEntryBase"* %tmp22.i, inttoptr (i64 -1 to %"struct.llvm::StringMapEntryBase"*) ; <i1> [#uses=1] + %tmp22.i = load %"struct.llvm::StringMapEntryBase"** %tmp7.i, align 8 + %tmp24.i = icmp eq %"struct.llvm::StringMapEntryBase"* %tmp22.i, inttoptr (i64 -1 to %"struct.llvm::StringMapEntryBase"*) br i1 %tmp24.i, label %bb9.i, label %_ZN4llvm9StringMapIPvNS_15MallocAllocatorEE16GetOrCreateValueIS1_EERNS_14StringMapEntryIS1_EENS_9StringRefET_.exit bb6.i: ; preds = %entry - %tmp16.i = bitcast %"struct.llvm::StringMapEntryBase"* %tmp8.i to %"struct.llvm::StringMapEntry<void*>"* ; <%"struct.llvm::StringMapEntry<void*>"*> [#uses=1] + %tmp16.i = bitcast %"struct.llvm::StringMapEntryBase"* %tmp8.i to %"struct.llvm::StringMapEntry<void*>"* ret %"struct.llvm::StringMapEntry<void*>"* %tmp16.i bb9.i: ; preds = %_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i - %tmp25.i = getelementptr inbounds %"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, i64 0, i32 0, i32 3 ; <i32*> [#uses=2] - %tmp26.i = load i32* %tmp25.i, align 8 ; <i32> [#uses=1] - %tmp27.i = add i32 %tmp26.i, -1 ; <i32> [#uses=1] + %tmp25.i = getelementptr inbounds %"struct.llvm::StringMap<void*,llvm::MallocAllocator>"* %this, i64 0, i32 0, i32 3 + %tmp26.i = load i32* %tmp25.i, align 8 + %tmp27.i = add i32 %tmp26.i, -1 store i32 %tmp27.i, i32* %tmp25.i, align 8 ret %"struct.llvm::StringMapEntry<void*>"* %tmp10.i.i _ZN4llvm9StringMapIPvNS_15MallocAllocatorEE16GetOrCreateValueIS1_EERNS_14StringMapEntryIS1_EENS_9StringRefET_.exit: ; preds = %_ZN4llvm14StringMapEntryIPvE6CreateINS_15MallocAllocatorES1_EEPS2_PKcS7_RT_T0_.exit.i ret %"struct.llvm::StringMapEntry<void*>"* %tmp10.i.i } + +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll index 28b1fc7..2f0d2eb 100644 --- a/test/Transforms/GVN/rle.ll +++ b/test/Transforms/GVN/rle.ll @@ -135,7 +135,7 @@ define i8* @coerce_mustalias7(i64 %V, i64* %P) { define signext i16 @memset_to_i16_local(i16* %A) nounwind ssp { entry: %conv = bitcast i16* %A to i8* - tail call void @llvm.memset.i64(i8* %conv, i8 1, i64 200, i32 1) + tail call void @llvm.memset.p0i8.i64(i8* %conv, i8 1, i64 200, i32 1, i1 false) %arrayidx = getelementptr inbounds i16* %A, i64 42 %tmp2 = load i16* %arrayidx ret i16 %tmp2 @@ -148,7 +148,7 @@ entry: define float @memset_to_float_local(float* %A, i8 %Val) nounwind ssp { entry: %conv = bitcast float* %A to i8* ; <i8*> [#uses=1] - tail call void @llvm.memset.i64(i8* %conv, i8 %Val, i64 400, i32 1) + tail call void @llvm.memset.p0i8.i64(i8* %conv, i8 %Val, i64 400, i32 1, i1 false) %arrayidx = getelementptr inbounds float* %A, i64 42 ; <float*> [#uses=1] %tmp2 = load float* %arrayidx ; <float> [#uses=1] ret float %tmp2 @@ -168,11 +168,11 @@ define i16 @memset_to_i16_nonlocal0(i16* %P, i1 %cond) { %P3 = bitcast i16* %P to i8* br i1 %cond, label %T, label %F T: - tail call void @llvm.memset.i64(i8* %P3, i8 1, i64 400, i32 1) + tail call void @llvm.memset.p0i8.i64(i8* %P3, i8 1, i64 400, i32 1, i1 false) br label %Cont F: - tail call void @llvm.memset.i64(i8* %P3, i8 2, i64 400, i32 1) + tail call void @llvm.memset.p0i8.i64(i8* %P3, i8 2, i64 400, i32 1, i1 false) br label %Cont Cont: @@ -193,7 +193,7 @@ Cont: define float @memcpy_to_float_local(float* %A) nounwind ssp { entry: %conv = bitcast float* %A to i8* ; <i8*> [#uses=1] - tail call void @llvm.memcpy.i64(i8* %conv, i8* bitcast ({i32, float, i32 }* @GCst to i8*), i64 12, i32 1) + tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %conv, i8* bitcast ({i32, float, i32 }* @GCst to i8*), i64 12, i32 1, i1 false) %arrayidx = getelementptr inbounds float* %A, i64 1 ; <float*> [#uses=1] %tmp2 = load float* %arrayidx ; <float> [#uses=1] ret float %tmp2 @@ -203,11 +203,6 @@ entry: } -declare void @llvm.memset.i64(i8* nocapture, i8, i64, i32) nounwind -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind - - - ;; non-local i32/float -> i8 load forwarding. define i8 @coerce_mustalias_nonlocal0(i32* %P, i1 %cond) { @@ -539,7 +534,7 @@ define i32 @memset_to_load() nounwind readnone { entry: %x = alloca [256 x i32], align 4 ; <[256 x i32]*> [#uses=2] %tmp = bitcast [256 x i32]* %x to i8* ; <i8*> [#uses=1] - call void @llvm.memset.i64(i8* %tmp, i8 0, i64 1024, i32 4) + call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 1024, i32 4, i1 false) %arraydecay = getelementptr inbounds [256 x i32]* %x, i32 0, i32 0 ; <i32*> %tmp1 = load i32* %arraydecay ; <i32> [#uses=1] ret i32 %tmp1 @@ -643,3 +638,7 @@ entry: ; CHECK-ret i32 } +declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind + +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind + diff --git a/test/Transforms/GlobalOpt/2005-09-27-Crash.ll b/test/Transforms/GlobalOpt/2005-09-27-Crash.ll index ab2077a..43597bf 100644 --- a/test/Transforms/GlobalOpt/2005-09-27-Crash.ll +++ b/test/Transforms/GlobalOpt/2005-09-27-Crash.ll @@ -2,7 +2,7 @@ %RPyString = type { i32, %arraytype.Char } %arraytype.Char = type { i32, [0 x i8] } %arraytype.Signed = type { i32, [0 x i32] } - %functiontype.1 = type %RPyString* (i32) + %functiontype.1 = type { %RPyString* (i32) *} %structtype.test = type { i32, %arraytype.Signed } @structinstance.test = internal global { i32, { i32, [2 x i32] } } { i32 41, { i32, [2 x i32] } { i32 2, [2 x i32] [ i32 100, i32 101 ] } } ; <{ i32, { i32, [2 x i32] } }*> [#uses=1] diff --git a/test/Transforms/GlobalOpt/2007-04-05-Crash.ll b/test/Transforms/GlobalOpt/2007-04-05-Crash.ll index d306d14..c7aca62 100644 --- a/test/Transforms/GlobalOpt/2007-04-05-Crash.ll +++ b/test/Transforms/GlobalOpt/2007-04-05-Crash.ll @@ -6,7 +6,7 @@ target triple = "thumb-apple-darwin8" @"L_OBJC_IMAGE_INFO" = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=1] @llvm.used = appending global [1 x i8*] [ i8* bitcast ([2 x i32]* @"L_OBJC_IMAGE_INFO" to i8*) ] ; <[1 x i8*]*> [#uses=0] -define i16 @__NSCharToUnicharCFWrapper(i8 zeroext %ch) zeroext { +define zeroext i16 @__NSCharToUnicharCFWrapper(i8 zeroext %ch) { entry: %iftmp.0.0.in.in = select i1 false, i16* @replacementUnichar, i16* null ; <i16*> [#uses=1] %iftmp.0.0.in = load i16* %iftmp.0.0.in.in ; <i16> [#uses=1] diff --git a/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll index 3242e1e..b74e4fc 100644 --- a/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll +++ b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash-2.ll @@ -6,12 +6,16 @@ target triple = "i386-apple-darwin7" define void @bar(i32 %Size) nounwind noinline { entry: - %tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1] + %malloccall = tail call i8* @malloc(i32 trunc (i64 mul (i64 ptrtoint (i32* getelementptr (i32* null, i32 1) to i64), i64 2000000) to i32)) + %tmp = bitcast i8* %malloccall to [1000000 x %struct.foo]* %.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1] store %struct.foo* %.sub, %struct.foo** @X, align 4 ret void } +declare noalias i8* @malloc(i32) + + define i32 @baz() nounwind readonly noinline { bb1.thread: %tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=2] diff --git a/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll index 51dcac1..613cb7b 100644 --- a/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll +++ b/test/Transforms/GlobalOpt/2008-12-16-HeapSRACrash.ll @@ -6,12 +6,15 @@ target triple = "i386-apple-darwin7" define void @bar(i32 %Size) nounwind noinline { entry: - %tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1] + %malloccall = tail call i8* @malloc(i32 trunc (i64 mul (i64 ptrtoint (i32* getelementptr (i32* null, i32 1) to i64), i64 2000000) to i32)) + %tmp = bitcast i8* %malloccall to [1000000 x %struct.foo]* %.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1] store %struct.foo* %.sub, %struct.foo** @X, align 4 ret void } +declare noalias i8* @malloc(i32) + define i32 @baz() nounwind readonly noinline { bb1.thread: %tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=3] diff --git a/test/Transforms/GlobalOpt/memcpy.ll b/test/Transforms/GlobalOpt/memcpy.ll index 8f063a2..94e07a0 100644 --- a/test/Transforms/GlobalOpt/memcpy.ll +++ b/test/Transforms/GlobalOpt/memcpy.ll @@ -3,13 +3,11 @@ @G1 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1] -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - define void @foo() { - %Blah = alloca [58 x i8] ; <[58 x i8]*> [#uses=1] - %tmp.0 = getelementptr [58 x i8]* %Blah, i32 0, i32 0 ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp.0, i8* getelementptr ([58 x i8]* @G1, i32 0, i32 0), i32 58, i32 1 ) - ret void + %Blah = alloca [58 x i8] + %tmp.0 = getelementptr [58 x i8]* %Blah, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp.0, i8* getelementptr inbounds ([58 x i8]* @G1, i32 0, i32 0), i32 58, i32 1, i1 false) + ret void } - +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/GlobalOpt/memset.ll b/test/Transforms/GlobalOpt/memset.ll index a9b9d5e..3bb5ce9 100644 --- a/test/Transforms/GlobalOpt/memset.ll +++ b/test/Transforms/GlobalOpt/memset.ll @@ -1,21 +1,18 @@ ; both globals are write only, delete them. -; RUN: opt < %s -globalopt -S | \ -; RUN: not grep internal +; RUN: opt < %s -globalopt -S | not grep internal @G0 = internal global [58 x i8] c"asdlfkajsdlfkajsd;lfkajds;lfkjasd;flkajsd;lkfja;sdlkfjasd\00" ; <[58 x i8]*> [#uses=1] @G1 = internal global [4 x i32] [ i32 1, i32 2, i32 3, i32 4 ] ; <[4 x i32]*> [#uses=1] -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - -declare void @llvm.memset.i32(i8*, i8, i32, i32) - define void @foo() { - %Blah = alloca [58 x i8] ; <[58 x i8]*> [#uses=1] - %tmp3 = bitcast [58 x i8]* %Blah to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* bitcast ([4 x i32]* @G1 to i8*), i8* %tmp3, i32 16, i32 1 ) - call void @llvm.memset.i32( i8* getelementptr ([58 x i8]* @G0, i32 0, i32 0), i8 17, i32 58, i32 1 ) - ret void + %Blah = alloca [58 x i8] + %tmp3 = bitcast [58 x i8]* %Blah to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast ([4 x i32]* @G1 to i8*), i8* %tmp3, i32 16, i32 1, i1 false) + call void @llvm.memset.p0i8.i32(i8* getelementptr inbounds ([58 x i8]* @G0, i32 0, i32 0), i8 17, i32 58, i32 1, i1 false) + ret void } +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind diff --git a/test/Transforms/IPConstantProp/return-constants.ll b/test/Transforms/IPConstantProp/return-constants.ll index 79220dd..2cd99fe 100644 --- a/test/Transforms/IPConstantProp/return-constants.ll +++ b/test/Transforms/IPConstantProp/return-constants.ll @@ -4,38 +4,43 @@ ;; Check that the second return values didn't get propagated ; RUN: cat %t | grep {%N = add i32 %B, %D} -define internal {i32, i32} @foo(i1 %Q) { - br i1 %Q, label %T, label %F +%0 = type { i32, i32 } -T: ; preds = %0 - ret i32 21, i32 22 +define internal %0 @foo(i1 %Q) { + br i1 %Q, label %T, label %F -F: ; preds = %0 - ret i32 21, i32 23 +T: ; preds = %0 + %mrv = insertvalue %0 undef, i32 21, 0 + %mrv1 = insertvalue %0 %mrv, i32 22, 1 + ret %0 %mrv1 + +F: ; preds = %0 + %mrv2 = insertvalue %0 undef, i32 21, 0 + %mrv3 = insertvalue %0 %mrv2, i32 23, 1 + ret %0 %mrv3 } -define internal {i32, i32} @bar(i1 %Q) { - %A = insertvalue { i32, i32 } undef, i32 21, 0 - br i1 %Q, label %T, label %F +define internal %0 @bar(i1 %Q) { + %A = insertvalue %0 undef, i32 21, 0 + br i1 %Q, label %T, label %F -T: ; preds = %0 - %B = insertvalue { i32, i32 } %A, i32 22, 1 - ret { i32, i32 } %B +T: ; preds = %0 + %B = insertvalue %0 %A, i32 22, 1 + ret %0 %B -F: ; preds = %0 - %C = insertvalue { i32, i32 } %A, i32 23, 1 - ret { i32, i32 } %C +F: ; preds = %0 + %C = insertvalue %0 %A, i32 23, 1 + ret %0 %C } -define { i32, i32 } @caller(i1 %Q) { - %X = call {i32, i32} @foo( i1 %Q ) - %A = getresult {i32, i32} %X, 0 - %B = getresult {i32, i32} %X, 1 - %Y = call {i32, i32} @bar( i1 %Q ) - %C = extractvalue {i32, i32} %Y, 0 - %D = extractvalue {i32, i32} %Y, 1 - %M = add i32 %A, %C - %N = add i32 %B, %D - ret { i32, i32 } %X +define %0 @caller(i1 %Q) { + %X = call %0 @foo(i1 %Q) + %A = extractvalue %0 %X, 0 + %B = extractvalue %0 %X, 1 + %Y = call %0 @bar(i1 %Q) + %C = extractvalue %0 %Y, 0 + %D = extractvalue %0 %Y, 1 + %M = add i32 %A, %C + %N = add i32 %B, %D + ret %0 %X } - diff --git a/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll b/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll index 288431a..a004831 100644 --- a/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll +++ b/test/Transforms/IndVarSimplify/2008-09-02-IVType.ll @@ -16,7 +16,7 @@ %struct.YUVGeneralParams = type { i16*, i8*, i8*, i8*, i8*, i8*, void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, i16, i16, i16, [6 x i8], void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, i16, i16 } @llvm.used = appending global [1 x i8*] [ i8* bitcast (i16 (%struct.JPEGGlobals*)* @ExtractBufferedBlocksIgnored to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] -define i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) signext nounwind { +define signext i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) nounwind { entry: %tmp4311 = getelementptr %struct.JPEGGlobals* %globp, i32 0, i32 70 ; <i32*> [#uses=1] %tmp4412 = load i32* %tmp4311, align 16 ; <i32> [#uses=2] diff --git a/test/Transforms/IndVarSimplify/ada-loops.ll b/test/Transforms/IndVarSimplify/ada-loops.ll index 4a07d99..9e635fd 100644 --- a/test/Transforms/IndVarSimplify/ada-loops.ll +++ b/test/Transforms/IndVarSimplify/ada-loops.ll @@ -1,14 +1,18 @@ -; RUN: opt < %s -indvars -S > %t -; RUN: grep phi %t | count 4 -; RUN: grep {= phi i32} %t | count 4 -; RUN: not grep {sext i} %t -; RUN: not grep {zext i} %t -; RUN: not grep {trunc i} %t -; RUN: not grep {add i8} %t +; RUN: opt < %s -indvars -S | FileCheck %s +; RUN: opt < %s -indvars -disable-iv-rewrite -S | FileCheck %s +; ; PR1301 ; Do a bunch of analysis and prove that the loops can use an i32 trip ; count without casting. +; +; Note that all four functions should actually be converted to +; memset. However, this test case validates indvars behavior. We +; don't check that phis are "folded together" because that is a job +; for loop strength reduction. But indvars must remove sext, zext, +; trunc, and add i8. +; +; CHECK-NOT: {{sext|zext|trunc|add i8}} ; ModuleID = 'ada.bc' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-n:8:16:32" diff --git a/test/Transforms/IndVarSimplify/iv-zext.ll b/test/Transforms/IndVarSimplify/iv-zext.ll index 00018ec..3a05c89 100644 --- a/test/Transforms/IndVarSimplify/iv-zext.ll +++ b/test/Transforms/IndVarSimplify/iv-zext.ll @@ -1,4 +1,5 @@ ; RUN: opt < %s -indvars -S | FileCheck %s +; RUN: opt < %s -indvars -disable-iv-rewrite -S | FileCheck %s ; CHECK-NOT: and ; CHECK-NOT: zext diff --git a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll index c35feef..9605670 100644 --- a/test/Transforms/IndVarSimplify/no-iv-rewrite.ll +++ b/test/Transforms/IndVarSimplify/no-iv-rewrite.ll @@ -23,6 +23,7 @@ ph: ; sext should be eliminated while preserving gep inboundsness. ; CHECK-NOT: sext ; CHECK: getelementptr inbounds +; CHECK: exit: loop: %i.02 = phi i32 [ 0, %ph ], [ %iinc, %loop ] %s.01 = phi i32 [ 0, %ph ], [ %sinc, %loop ] @@ -63,6 +64,7 @@ ph: ; CHECK: getelementptr inbounds ; %vall sext should obviously not be eliminated ; CHECK: sext +; CHECK: exit: loop: %i.02 = phi i32 [ 0, %ph ], [ %iinc, %loop ] %s.01 = phi i64 [ 0, %ph ], [ %sinc, %loop ] @@ -106,6 +108,7 @@ ph: ; Preserve gep inboundsness, and don't factor it. ; CHECK: getelementptr inbounds i32* %ptriv, i32 1 ; CHECK-NOT: add +; CHECK: exit: loop: %ptriv = phi i32* [ %first, %ph ], [ %ptrpost, %loop ] %ofs = sext i32 %idx to i64 @@ -121,3 +124,199 @@ exit: return: ret void } + +%struct = type { i32 } + +define void @bitcastiv(i32 %start, i32 %limit, i32 %step, %struct* %base) +nounwind +{ +entry: + br label %loop + +; CHECK: loop: +; +; Preserve casts +; CHECK: phi i32 +; CHECK: bitcast +; CHECK: getelementptr +; CHECK: exit: +loop: + %iv = phi i32 [%start, %entry], [%next, %loop] + %p = phi %struct* [%base, %entry], [%pinc, %loop] + %adr = getelementptr %struct* %p, i32 0, i32 0 + store i32 3, i32* %adr + %pp = bitcast %struct* %p to i32* + store i32 4, i32* %pp + %pinc = getelementptr %struct* %p, i32 1 + %next = add i32 %iv, 1 + %cond = icmp ne i32 %next, %limit + br i1 %cond, label %loop, label %exit + +exit: + ret void +} + +define void @maxvisitor(i32 %limit, i32* %base) nounwind { +entry: + br label %loop + +; Test inserting a truncate at a phi use. +; +; CHECK: loop: +; CHECK: phi i64 +; CHECK: trunc +; CHECK: exit: +loop: + %idx = phi i32 [ 0, %entry ], [ %idx.next, %loop.inc ] + %max = phi i32 [ 0, %entry ], [ %max.next, %loop.inc ] + %idxprom = sext i32 %idx to i64 + %adr = getelementptr inbounds i32* %base, i64 %idxprom + %val = load i32* %adr + %cmp19 = icmp sgt i32 %val, %max + br i1 %cmp19, label %if.then, label %if.else + +if.then: + br label %loop.inc + +if.else: + br label %loop.inc + +loop.inc: + %max.next = phi i32 [ %idx, %if.then ], [ %max, %if.else ] + %idx.next = add nsw i32 %idx, 1 + %cmp = icmp slt i32 %idx.next, %limit + br i1 %cmp, label %loop, label %exit + +exit: + ret void +} + +define void @identityphi(i32 %limit) nounwind { +entry: + br label %loop + +; Test an edge case of removing an identity phi that directly feeds +; back to the loop iv. +; +; CHECK: loop: +; CHECK: phi i32 +; CHECK-NOT: phi +; CHECK: exit: +loop: + %iv = phi i32 [ 0, %entry], [ %iv.next, %control ] + br i1 undef, label %if.then, label %control + +if.then: + br label %control + +control: + %iv.next = phi i32 [ %iv, %loop ], [ undef, %if.then ] + %cmp = icmp slt i32 %iv.next, %limit + br i1 %cmp, label %loop, label %exit + +exit: + ret void +} + +define i64 @cloneOr(i32 %limit, i64* %base) nounwind { +entry: + ; ensure that the loop can't overflow + %halfLim = ashr i32 %limit, 2 + br label %loop + +; Test cloning an or, which is not an OverflowBinaryOperator. +; +; CHECK: loop: +; CHECK: phi i64 +; CHECK-NOT: sext +; CHECK: or i64 +; CHECK: exit: +loop: + %iv = phi i32 [ 0, %entry], [ %iv.next, %loop ] + %t1 = sext i32 %iv to i64 + %adr = getelementptr i64* %base, i64 %t1 + %val = load i64* %adr + %t2 = or i32 %iv, 1 + %t3 = sext i32 %t2 to i64 + %iv.next = add i32 %iv, 2 + %cmp = icmp slt i32 %iv.next, %halfLim + br i1 %cmp, label %loop, label %exit + +exit: + %result = and i64 %val, %t3 + ret i64 %result +} + +; The i induction variable looks like a wrap-around, but it really is just +; a simple affine IV. Make sure that indvars simplifies through. +define i32 @indirectRecurrence() nounwind { +entry: + br label %loop + +; ReplaceLoopExitValue should fold the return value to constant 9. +; CHECK: loop: +; CHECK: phi i32 +; CHECK: ret i32 9 +loop: + %j.0 = phi i32 [ 1, %entry ], [ %j.next, %cond_true ] + %i.0 = phi i32 [ 0, %entry ], [ %j.0, %cond_true ] + %tmp = icmp ne i32 %j.0, 10 + br i1 %tmp, label %cond_true, label %return + +cond_true: + %j.next = add i32 %j.0, 1 + br label %loop + +return: + ret i32 %i.0 +} + +; Eliminate the congruent phis j, k, and l. +; Eliminate the redundant IV increments k.next and l.next. +; Two phis should remain, one starting at %init, and one at %init1. +; Two increments should remain, one by %step and one by %step1. +; CHECK: loop: +; CHECK: phi i32 +; CHECK: phi i32 +; CHECK-NOT: phi +; CHECK: add i32 +; CHECK: add i32 +; CHECK-NOT: add +; CHECK: return: +; +; Five live-outs should remain. +; CHECK: lcssa = phi +; CHECK: lcssa = phi +; CHECK: lcssa = phi +; CHECK: lcssa = phi +; CHECK: lcssa = phi +; CHECK-NOT: phi +; CHECK: ret +define i32 @isomorphic(i32 %init, i32 %step, i32 %lim) nounwind { +entry: + %step1 = add i32 %step, 1 + %init1 = add i32 %init, %step1 + %l.0 = sub i32 %init1, %step1 + br label %loop + +loop: + %ii = phi i32 [ %init1, %entry ], [ %ii.next, %loop ] + %i = phi i32 [ %init, %entry ], [ %ii, %loop ] + %j = phi i32 [ %init, %entry ], [ %j.next, %loop ] + %k = phi i32 [ %init1, %entry ], [ %k.next, %loop ] + %l = phi i32 [ %l.0, %entry ], [ %l.next, %loop ] + %ii.next = add i32 %ii, %step1 + %j.next = add i32 %j, %step1 + %k.next = add i32 %k, %step1 + %l.step = add i32 %l, %step + %l.next = add i32 %l.step, 1 + %cmp = icmp ne i32 %ii.next, %lim + br i1 %cmp, label %loop, label %return + +return: + %sum1 = add i32 %i, %j.next + %sum2 = add i32 %sum1, %k.next + %sum3 = add i32 %sum1, %l.step + %sum4 = add i32 %sum1, %l.next + ret i32 %sum4 +} diff --git a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll index 9e46a78..5063b17 100644 --- a/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll +++ b/test/Transforms/IndVarSimplify/preserve-signed-wrap.ll @@ -1,7 +1,5 @@ -; RUN: opt < %s -indvars -S > %t -; RUN: grep sext %t | count 1 -; RUN: grep phi %t | count 1 -; RUN: grep {phi i64} %t +; RUN: opt < %s -indvars -S | FileCheck %s +; RUN: opt < %s -indvars -disable-iv-rewrite -S | FileCheck %s ; Indvars should insert a 64-bit induction variable to eliminate the ; sext for the addressing, however it shouldn't eliminate the sext @@ -15,6 +13,10 @@ entry: bb.nph: ; preds = %entry br label %bb +; CHECK: bb: +; CHECK: phi i64 +; CHECK: sext i8 +; CHECK-NOT: sext bb: ; preds = %bb1, %bb.nph %i.02 = phi i32 [ %5, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=2] %p.01 = phi i8 [ %4, %bb1 ], [ -1, %bb.nph ] ; <i8> [#uses=2] diff --git a/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll b/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll index 0c8857f..ace74ff 100644 --- a/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll +++ b/test/Transforms/IndVarSimplify/variable-stride-ivs-0.ll @@ -1,9 +1,9 @@ -; RUN: opt < %s -indvars -instcombine -S | \ -; RUN: grep {store i32 0} +; RUN: opt < %s -indvars -instcombine -S | FileCheck %s +; RUN: opt < %s -indvars -disable-iv-rewrite -instcombine -S | FileCheck %s +; ; Test that -indvars can reduce variable stride IVs. If it can reduce variable -; stride iv's, it will make %iv. and %m.0.0 isomorphic to each other without +; stride iv's, it will make %iv. and %m.0.0 isomorphic to each other without ; cycles, allowing the tmp.21 subtraction to be eliminated. -; END. define void @vnum_test8(i32* %data) { entry: @@ -20,6 +20,7 @@ no_exit.preheader: ; preds = %entry %tmp.16 = getelementptr i32* %data, i32 %tmp.9 ; <i32*> [#uses=1] br label %no_exit +; CHECK: store i32 0 no_exit: ; preds = %no_exit, %no_exit.preheader %iv.ui = phi i32 [ 0, %no_exit.preheader ], [ %iv..inc.ui, %no_exit ] ; <i32> [#uses=1] %iv. = phi i32 [ %tmp.5, %no_exit.preheader ], [ %iv..inc, %no_exit ] ; <i32> [#uses=2] diff --git a/test/Transforms/Inline/2008-03-04-StructRet.ll b/test/Transforms/Inline/2008-03-04-StructRet.ll deleted file mode 100644 index 3311d56..0000000 --- a/test/Transforms/Inline/2008-03-04-StructRet.ll +++ /dev/null @@ -1,28 +0,0 @@ -; RUN: opt < %s -inline -disable-output - %struct.Benchmark = type { i32 (...)** } - %struct.Complex = type { double, double } - %struct.ComplexBenchmark = type { %struct.Benchmark } - -define %struct.Complex @_Zml7ComplexS_1(double %a.0, double %a.1, double %b.0, double %b.1) nounwind { -entry: - %mrv = alloca %struct.Complex ; <%struct.Complex*> [#uses=2] - %mrv.gep = getelementptr %struct.Complex* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld = load double* %mrv.gep ; <double> [#uses=1] - %mrv.gep1 = getelementptr %struct.Complex* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1] - ret double %mrv.ld, double %mrv.ld2 -} - -define void @_ZNK16ComplexBenchmark9oop_styleEv(%struct.ComplexBenchmark* %this) nounwind { -entry: - %tmp = alloca %struct.Complex ; <%struct.Complex*> [#uses=0] - br label %bb31 -bb: ; preds = %bb31 - call %struct.Complex @_Zml7ComplexS_1( double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Complex>:0 [#uses=1] - %gr = getresult %struct.Complex %0, 1 ; <double> [#uses=0] - br label %bb31 -bb31: ; preds = %bb, %entry - br i1 false, label %bb, label %return -return: ; preds = %bb31 - ret void -} diff --git a/test/Transforms/Inline/2008-03-07-Inline-2.ll b/test/Transforms/Inline/2008-03-07-Inline-2.ll deleted file mode 100644 index 0c968e6..0000000 --- a/test/Transforms/Inline/2008-03-07-Inline-2.ll +++ /dev/null @@ -1,53 +0,0 @@ -; RUN: opt < %s -inline -disable-output - %struct.Demand = type { double, double } - %struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] } - %struct.leaf = type { %struct.Demand, double, double } -@P = external global double ; <double*> [#uses=1] - -define %struct.leaf* @build_leaf() nounwind { -entry: - unreachable -} - -define %struct.Demand @Compute_Branch2(%struct.branch* %br, double %theta_R, double %theta_I, double %pi_R, double %pi_I) nounwind { -entry: - %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4] - %a2 = alloca %struct.Demand ; <%struct.Demand*> [#uses=0] - br i1 false, label %bb46, label %bb -bb: ; preds = %entry - %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld = load double* %mrv.gep ; <double> [#uses=1] - %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1] - ret double %mrv.ld, double %mrv.ld2 -bb46: ; preds = %entry - br label %bb72 -bb49: ; preds = %bb72 - call %struct.Demand @Compute_Leaf1( %struct.leaf* null, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Demand>:0 [#uses=1] - %gr = getresult %struct.Demand %0, 1 ; <double> [#uses=0] - br label %bb72 -bb72: ; preds = %bb49, %bb46 - br i1 false, label %bb49, label %bb77 -bb77: ; preds = %bb72 - %mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1] - %mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1] - ret double %mrv.ld4, double %mrv.ld6 -} - -define %struct.Demand @Compute_Leaf1(%struct.leaf* %l, double %pi_R, double %pi_I) nounwind { -entry: - %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=2] - %tmp10 = load double* @P, align 8 ; <double> [#uses=1] - %tmp11 = fcmp olt double %tmp10, 0.000000e+00 ; <i1> [#uses=1] - br i1 %tmp11, label %bb, label %bb13 -bb: ; preds = %entry - br label %bb13 -bb13: ; preds = %bb, %entry - %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld = load double* %mrv.gep ; <double> [#uses=1] - %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1] - ret double %mrv.ld, double %mrv.ld2 -} diff --git a/test/Transforms/Inline/2008-03-07-Inline.ll b/test/Transforms/Inline/2008-03-07-Inline.ll deleted file mode 100644 index 86afb2d..0000000 --- a/test/Transforms/Inline/2008-03-07-Inline.ll +++ /dev/null @@ -1,57 +0,0 @@ -; RUN: opt < %s -inline -disable-output - %struct.Demand = type { double, double } - %struct.branch = type { %struct.Demand, double, double, double, double, %struct.branch*, [12 x %struct.leaf*] } - %struct.leaf = type { %struct.Demand, double, double } -@P = external global double ; <double*> [#uses=1] - -define %struct.leaf* @build_leaf() nounwind { -entry: - unreachable -} - -define %struct.Demand @Compute_Branch2(%struct.branch* %br, double %theta_R, double %theta_I, double %pi_R, double %pi_I) nounwind { -entry: - %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4] - %a2 = alloca %struct.Demand ; <%struct.Demand*> [#uses=0] - br i1 false, label %bb46, label %bb -bb: ; preds = %entry - %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld = load double* %mrv.gep ; <double> [#uses=1] - %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1] - ret double %mrv.ld, double %mrv.ld2 -bb46: ; preds = %entry - br label %bb72 -bb49: ; preds = %bb72 - call %struct.Demand @Compute_Leaf1( %struct.leaf* null, double 0.000000e+00, double 0.000000e+00 ) nounwind ; <%struct.Demand>:0 [#uses=1] - %gr = getresult %struct.Demand %0, 1 ; <double> [#uses=0] - br label %bb72 -bb72: ; preds = %bb49, %bb46 - br i1 false, label %bb49, label %bb77 -bb77: ; preds = %bb72 - %mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1] - %mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1] - ret double %mrv.ld4, double %mrv.ld6 -} - -define %struct.Demand @Compute_Leaf1(%struct.leaf* %l, double %pi_R, double %pi_I) nounwind { -entry: - %mrv = alloca %struct.Demand ; <%struct.Demand*> [#uses=4] - %tmp10 = load double* @P, align 8 ; <double> [#uses=1] - %tmp11 = fcmp olt double %tmp10, 0.000000e+00 ; <i1> [#uses=1] - br i1 %tmp11, label %bb, label %bb13 -bb: ; preds = %entry - %mrv.gep = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld = load double* %mrv.gep ; <double> [#uses=1] - %mrv.gep1 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld2 = load double* %mrv.gep1 ; <double> [#uses=1] - ret double %mrv.ld, double %mrv.ld2 -bb13: ; preds = %entry - %mrv.gep3 = getelementptr %struct.Demand* %mrv, i32 0, i32 0 ; <double*> [#uses=1] - %mrv.ld4 = load double* %mrv.gep3 ; <double> [#uses=1] - %mrv.gep5 = getelementptr %struct.Demand* %mrv, i32 0, i32 1 ; <double*> [#uses=1] - %mrv.ld6 = load double* %mrv.gep5 ; <double> [#uses=1] - ret double %mrv.ld4, double %mrv.ld6 -} diff --git a/test/Transforms/Inline/inline-invoke-tail.ll b/test/Transforms/Inline/inline-invoke-tail.ll index 961f678..462c29a 100644 --- a/test/Transforms/Inline/inline-invoke-tail.ll +++ b/test/Transforms/Inline/inline-invoke-tail.ll @@ -4,7 +4,7 @@ define internal void @foo(i32* %p, i32* %q) { %pp = bitcast i32* %p to i8* %qq = bitcast i32* %q to i8* - tail call void @llvm.memcpy.i32(i8* %pp, i8* %qq, i32 4, i32 1) + tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %pp, i8* %qq, i32 4, i32 1, i1 false) ret void } @@ -24,12 +24,14 @@ invcont: lpad: %eh_ptr = call i8* @llvm.eh.exception() - %eh_select = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) + %eh_select = call i32 (i8*, i8*, ...)* @llvm.eh.selector(i8* %eh_ptr, i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*), i8* null) unreachable } -declare i8* @llvm.eh.exception() nounwind +declare i8* @llvm.eh.exception() nounwind readonly -declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind +declare i32 @llvm.eh.selector(i8*, i8*, ...) nounwind declare i32 @__gxx_personality_v0(...) + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll b/test/Transforms/InstCombine/2006-11-03-Memmove64.ll deleted file mode 100644 index 35bb45e..0000000 --- a/test/Transforms/InstCombine/2006-11-03-Memmove64.ll +++ /dev/null @@ -1,16 +0,0 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: not grep memmove.i32 -; Instcombine was trying to turn this into a memmove.i32 - -target datalayout = "e-p:64:64" -target triple = "alphaev67-unknown-linux-gnu" -@str10 = internal constant [1 x i8] zeroinitializer ; <[1 x i8]*> [#uses=1] - -define void @do_join(i8* %b) { -entry: - call void @llvm.memmove.i64( i8* %b, i8* getelementptr ([1 x i8]* @str10, i32 0, i64 0), i64 1, i32 1 ) - ret void -} - -declare void @llvm.memmove.i64(i8*, i8*, i64, i32) - diff --git a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll b/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll deleted file mode 100644 index b59d3c8..0000000 --- a/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll +++ /dev/null @@ -1,19 +0,0 @@ -; In the presence of a negative offset (the -8 below), a fold of a bitcast into -; a malloc messes up the element count, causing an extra 4GB to be allocated on -; 64-bit targets. -; -; RUN: opt < %s -instcombine -S | not grep {= add } - -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "x86_64-unknown-freebsd6.2" - -define i1 @test(i32 %tmp141, double** %tmp145) -{ - %tmp133 = add i32 %tmp141, 1 - %tmp134 = shl i32 %tmp133, 3 - %tmp135 = add i32 %tmp134, -8 - %tmp136 = malloc i8, i32 %tmp135 - %tmp137 = bitcast i8* %tmp136 to double* - store double* %tmp137, double** %tmp145 - ret i1 false -} diff --git a/test/Transforms/InstCombine/2007-05-04-Crash.ll b/test/Transforms/InstCombine/2007-05-04-Crash.ll deleted file mode 100644 index 9f50d8a..0000000 --- a/test/Transforms/InstCombine/2007-05-04-Crash.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: opt < %s -instcombine -disable-output -; PR1384 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "i686-apple-darwin8" - %struct.CFRuntimeBase = type { i32, [4 x i8] } - %struct.CGColor = type opaque - %struct.CGColorSpace = type { %struct.CFRuntimeBase, i8, i8, i8, i32, i32, i32, %struct.CGColor*, float*, %struct.CGMD5Signature, %struct.CGMD5Signature*, [0 x %struct.CGColorSpaceDescriptor] } - %struct.CGColorSpaceCalibratedRGBData = type { [3 x float], [3 x float], [3 x float], [9 x float] } - %struct.CGColorSpaceDescriptor = type { %struct.CGColorSpaceCalibratedRGBData } - %struct.CGColorSpaceLabData = type { [3 x float], [3 x float], [4 x float] } - %struct.CGMD5Signature = type { [16 x i8], i8 } - -declare fastcc %struct.CGColorSpace* @CGColorSpaceCreate(i32, i32) - -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - -define %struct.CGColorSpace* @CGColorSpaceCreateLab(float* %whitePoint, float* %blackPoint, float* %range) { -entry: - %tmp17 = call fastcc %struct.CGColorSpace* @CGColorSpaceCreate( i32 5, i32 3 ) ; <%struct.CGColorSpace*> [#uses=2] - %tmp28 = getelementptr %struct.CGColorSpace* %tmp17, i32 0, i32 11 ; <[0 x %struct.CGColorSpaceDescriptor]*> [#uses=1] - %tmp29 = getelementptr [0 x %struct.CGColorSpaceDescriptor]* %tmp28, i32 0, i32 0 ; <%struct.CGColorSpaceDescriptor*> [#uses=1] - %tmp30 = getelementptr %struct.CGColorSpaceDescriptor* %tmp29, i32 0, i32 0 ; <%struct.CGColorSpaceCalibratedRGBData*> [#uses=1] - %tmp3031 = bitcast %struct.CGColorSpaceCalibratedRGBData* %tmp30 to %struct.CGColorSpaceLabData* ; <%struct.CGColorSpaceLabData*> [#uses=1] - %tmp45 = getelementptr %struct.CGColorSpaceLabData* %tmp3031, i32 0, i32 2 ; <[4 x float]*> [#uses=1] - %tmp46 = getelementptr [4 x float]* %tmp45, i32 0, i32 0 ; <float*> [#uses=1] - %tmp4648 = bitcast float* %tmp46 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp4648, i8* null, i32 16, i32 4 ) - ret %struct.CGColorSpace* %tmp17 -} diff --git a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll index 40818d4..15988b6 100644 --- a/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll +++ b/test/Transforms/InstCombine/2007-05-18-CastFoldBug.ll @@ -3,7 +3,7 @@ define void @blah(i16* %tmp10) { entry: - call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* %tmp10 sret ) + call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16*)*)( i16* sret %tmp10 ) ret void } diff --git a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll index d8f3d97..6190aa9 100644 --- a/test/Transforms/InstCombine/2007-09-11-Trampoline.ll +++ b/test/Transforms/InstCombine/2007-09-11-Trampoline.ll @@ -15,7 +15,7 @@ entry: %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1] store i32 %n, i32* %tmp3, align 8 %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1] - %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* nest , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1] + %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1] %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1] %tmp89 = bitcast i8* %tramp to i32 (i32)* ; <i32 (i32)*> [#uses=2] store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8 diff --git a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll index 710aff2..fe935f9 100644 --- a/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll +++ b/test/Transforms/InstCombine/2007-10-10-EliminateMemCpy.ll @@ -6,16 +6,15 @@ target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:1 define void @foo(i8* %P) { entry: - %P_addr = alloca i8* ; <i8**> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i8* %P, i8** %P_addr - %tmp = load i8** %P_addr, align 4 ; <i8*> [#uses=1] - %tmp1 = getelementptr [4 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp, i8* %tmp1, i32 4, i32 1 ) - br label %return + %P_addr = alloca i8* + store i8* %P, i8** %P_addr + %tmp = load i8** %P_addr, align 4 + %tmp1 = getelementptr [4 x i8]* @.str, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp, i8* %tmp1, i32 4, i32 1, i1 false) + br label %return -return: ; preds = %entry - ret void +return: ; preds = %entry + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll index e1549a0..e6c9bcd 100644 --- a/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll +++ b/test/Transforms/InstCombine/2007-11-07-OpaqueAlignCrash.ll @@ -5,8 +5,8 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3 target triple = "i686-pc-linux-gnu" %opaque_t = type opaque - -%op_ts = type {opaque, i32} +%opaque2 = type opaque +%op_ts = type {%opaque2, i32} @g = external global %opaque_t @h = external global %op_ts diff --git a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll index 24394c6..e3192a9 100644 --- a/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll +++ b/test/Transforms/InstCombine/2007-11-25-CompatibleAttributes.ll @@ -5,7 +5,7 @@ define i32 @main(i32 %argc, i8** %argv) { entry: - %tmp32 = tail call i32 (i8* noalias , ...) nounwind * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) noalias , i32 0 ) nounwind ; <i32> [#uses=0] + %tmp32 = tail call i32 (i8* , ...) * bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0] ret i32 undef } diff --git a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll index 5f4fa47..23b6067 100644 --- a/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll +++ b/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll @@ -5,7 +5,7 @@ define void @a() { ret void } -define i32 @b(i32* inreg %x) signext { +define signext i32 @b(i32* inreg %x) { ret i32 0 } diff --git a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll index 7b3281f..510a68c 100644 --- a/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll +++ b/test/Transforms/InstCombine/2008-01-13-NoBitCastAttributes.ll @@ -1,6 +1,6 @@ ; RUN: opt < %s -instcombine -S | grep bitcast | count 2 -define i32 @b(i32* inreg %x) signext { +define signext i32 @b(i32* inreg %x) { ret i32 0 } diff --git a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll index b29d8d2..a51c47d 100644 --- a/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll +++ b/test/Transforms/InstCombine/2009-02-20-InstCombine-SROA.ll @@ -4,275 +4,276 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" - %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" = type { i32* } - %"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" } - %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* } - %"struct.std::bidirectional_iterator_tag" = type <{ i8 }> - %"struct.std::forward_iterator_tag" = type <{ i8 }> - %"struct.std::input_iterator_tag" = type <{ i8 }> - %"struct.std::random_access_iterator_tag" = type <{ i8 }> - %"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" } + +%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" = type { i32* } +%"struct.std::_Vector_base<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" } +%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl" = type { i32*, i32*, i32* } +%"struct.std::bidirectional_iterator_tag" = type <{ i8 }> +%"struct.std::forward_iterator_tag" = type <{ i8 }> +%"struct.std::input_iterator_tag" = type <{ i8 }> +%"struct.std::random_access_iterator_tag" = type <{ i8 }> +%"struct.std::vector<int,std::allocator<int> >" = type { %"struct.std::_Vector_base<int,std::allocator<int> >" } define i32* @_Z3fooRSt6vectorIiSaIiEE(%"struct.std::vector<int,std::allocator<int> >"* %X) { entry: - %0 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2] - %__first_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=31] - %__last_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=4] - %unnamed_arg.i = alloca %"struct.std::bidirectional_iterator_tag", align 8 ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=1] - %1 = alloca %"struct.std::bidirectional_iterator_tag" ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=1] - %__first_addr.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2] - %2 = alloca %"struct.std::bidirectional_iterator_tag" ; <%"struct.std::bidirectional_iterator_tag"*> [#uses=2] - %3 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" ; <%"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"*> [#uses=2] - %4 = alloca i32 ; <i32*> [#uses=8] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - store i32 42, i32* %4, align 4 - %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >"*> [#uses=1] - %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"*> [#uses=1] - %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1 ; <i32**> [#uses=1] - %8 = load i32** %7, align 4 ; <i32*> [#uses=1] - %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %8, i32** %9, align 4 - %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 ; <i32**> [#uses=1] - %11 = load i32** %10, align 4 ; <i32*> [#uses=1] - %tmp2.i = ptrtoint i32* %11 to i32 ; <i32> [#uses=1] - %tmp1.i = inttoptr i32 %tmp2.i to i32* ; <i32*> [#uses=1] - %tmp3 = ptrtoint i32* %tmp1.i to i32 ; <i32> [#uses=1] - %tmp2 = inttoptr i32 %tmp3 to i32* ; <i32*> [#uses=1] - %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >"*> [#uses=1] - %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0 ; <%"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"*> [#uses=1] - %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0 ; <i32**> [#uses=1] - %15 = load i32** %14, align 4 ; <i32*> [#uses=1] - %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %15, i32** %16, align 4 - %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 ; <i32**> [#uses=1] - %18 = load i32** %17, align 4 ; <i32*> [#uses=1] - %tmp2.i17 = ptrtoint i32* %18 to i32 ; <i32> [#uses=1] - %tmp1.i18 = inttoptr i32 %tmp2.i17 to i32* ; <i32*> [#uses=1] - %tmp8 = ptrtoint i32* %tmp1.i18 to i32 ; <i32> [#uses=1] - %tmp6 = inttoptr i32 %tmp8 to i32* ; <i32*> [#uses=1] - %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %tmp6, i32** %19 - %20 = getelementptr %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0 ; <i8*> [#uses=1] - %21 = load i8* %20, align 1 ; <i8> [#uses=1] - %22 = or i8 %21, 0 ; <i8> [#uses=1] - %23 = or i8 %22, 0 ; <i8> [#uses=1] - %24 = or i8 %23, 0 ; <i8> [#uses=0] - %25 = getelementptr %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0 ; <i8*> [#uses=1] - store i8 0, i8* %25, align 1 - %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 ; <i32**> [#uses=1] - %val.i = load i32** %elt.i ; <i32*> [#uses=1] - %tmp.i = bitcast %"struct.std::bidirectional_iterator_tag"* %unnamed_arg.i to i8* ; <i8*> [#uses=1] - %tmp9.i = bitcast %"struct.std::bidirectional_iterator_tag"* %2 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i64(i8* %tmp.i, i8* %tmp9.i, i64 1, i32 1) - %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %val.i, i32** %26 - %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %tmp2, i32** %27 - %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %29 = load i32** %28, align 4 ; <i32*> [#uses=1] - %30 = ptrtoint i32* %29 to i32 ; <i32> [#uses=1] - %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %32 = load i32** %31, align 4 ; <i32*> [#uses=1] - %33 = ptrtoint i32* %32 to i32 ; <i32> [#uses=1] - %34 = sub i32 %30, %33 ; <i32> [#uses=1] - %35 = ashr i32 %34, 2 ; <i32> [#uses=1] - %36 = ashr i32 %35, 2 ; <i32> [#uses=1] - br label %bb12.i.i + %0 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %__first_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %__last_addr.i.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %unnamed_arg.i = alloca %"struct.std::bidirectional_iterator_tag", align 8 + %1 = alloca %"struct.std::bidirectional_iterator_tag" + %__first_addr.i = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %2 = alloca %"struct.std::bidirectional_iterator_tag" + %3 = alloca %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >" + %4 = alloca i32 + %"alloca point" = bitcast i32 0 to i32 + store i32 42, i32* %4, align 4 + %5 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 + %6 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %5, i32 0, i32 0 + %7 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %6, i32 0, i32 1 + %8 = load i32** %7, align 4 + %9 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 + store i32* %8, i32** %9, align 4 + %10 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %3, i32 0, i32 0 + %11 = load i32** %10, align 4 + %tmp2.i = ptrtoint i32* %11 to i32 + %tmp1.i = inttoptr i32 %tmp2.i to i32* + %tmp3 = ptrtoint i32* %tmp1.i to i32 + %tmp2 = inttoptr i32 %tmp3 to i32* + %12 = getelementptr %"struct.std::vector<int,std::allocator<int> >"* %X, i32 0, i32 0 + %13 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >"* %12, i32 0, i32 0 + %14 = getelementptr %"struct.std::_Vector_base<int,std::allocator<int> >::_Vector_impl"* %13, i32 0, i32 0 + %15 = load i32** %14, align 4 + %16 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 + store i32* %15, i32** %16, align 4 + %17 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %0, i32 0, i32 0 + %18 = load i32** %17, align 4 + %tmp2.i17 = ptrtoint i32* %18 to i32 + %tmp1.i18 = inttoptr i32 %tmp2.i17 to i32* + %tmp8 = ptrtoint i32* %tmp1.i18 to i32 + %tmp6 = inttoptr i32 %tmp8 to i32* + %19 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 + store i32* %tmp6, i32** %19 + %20 = getelementptr %"struct.std::bidirectional_iterator_tag"* %1, i32 0, i32 0 + %21 = load i8* %20, align 1 + %22 = or i8 %21, 0 + %23 = or i8 %22, 0 + %24 = or i8 %23, 0 + %25 = getelementptr %"struct.std::bidirectional_iterator_tag"* %2, i32 0, i32 0 + store i8 0, i8* %25, align 1 + %elt.i = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i, i32 0, i32 0 + %val.i = load i32** %elt.i + %tmp.i = bitcast %"struct.std::bidirectional_iterator_tag"* %unnamed_arg.i to i8* + %tmp9.i = bitcast %"struct.std::bidirectional_iterator_tag"* %2 to i8* + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp.i, i8* %tmp9.i, i64 1, i32 1, i1 false) + %26 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %val.i, i32** %26 + %27 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + store i32* %tmp2, i32** %27 + %28 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + %29 = load i32** %28, align 4 + %30 = ptrtoint i32* %29 to i32 + %31 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %32 = load i32** %31, align 4 + %33 = ptrtoint i32* %32 to i32 + %34 = sub i32 %30, %33 + %35 = ashr i32 %34, 2 + %36 = ashr i32 %35, 2 + br label %bb12.i.i -bb.i.i: ; preds = %bb12.i.i - %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %38 = load i32** %37, align 4 ; <i32*> [#uses=1] - %39 = load i32* %38, align 4 ; <i32> [#uses=1] - %40 = load i32* %4, align 4 ; <i32> [#uses=1] - %41 = icmp eq i32 %39, %40 ; <i1> [#uses=1] - %42 = zext i1 %41 to i8 ; <i8> [#uses=1] - %toBool.i.i = icmp ne i8 %42, 0 ; <i1> [#uses=1] - br i1 %toBool.i.i, label %bb1.i.i, label %bb2.i.i +bb.i.i: ; preds = %bb12.i.i + %37 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %38 = load i32** %37, align 4 + %39 = load i32* %38, align 4 + %40 = load i32* %4, align 4 + %41 = icmp eq i32 %39, %40 + %42 = zext i1 %41 to i8 + %toBool.i.i = icmp ne i8 %42, 0 + br i1 %toBool.i.i, label %bb1.i.i, label %bb2.i.i -bb1.i.i: ; preds = %bb.i.i - %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %44 = load i32** %43, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb1.i.i: ; preds = %bb.i.i + %43 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %44 = load i32** %43, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb2.i.i: ; preds = %bb.i.i - %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %46 = load i32** %45, align 4 ; <i32*> [#uses=1] - %47 = getelementptr i32* %46, i64 1 ; <i32*> [#uses=1] - %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %47, i32** %48, align 4 - %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %50 = load i32** %49, align 4 ; <i32*> [#uses=1] - %51 = load i32* %50, align 4 ; <i32> [#uses=1] - %52 = load i32* %4, align 4 ; <i32> [#uses=1] - %53 = icmp eq i32 %51, %52 ; <i1> [#uses=1] - %54 = zext i1 %53 to i8 ; <i8> [#uses=1] - %toBool3.i.i = icmp ne i8 %54, 0 ; <i1> [#uses=1] - br i1 %toBool3.i.i, label %bb4.i.i, label %bb5.i.i +bb2.i.i: ; preds = %bb.i.i + %45 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %46 = load i32** %45, align 4 + %47 = getelementptr i32* %46, i64 1 + %48 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %47, i32** %48, align 4 + %49 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %50 = load i32** %49, align 4 + %51 = load i32* %50, align 4 + %52 = load i32* %4, align 4 + %53 = icmp eq i32 %51, %52 + %54 = zext i1 %53 to i8 + %toBool3.i.i = icmp ne i8 %54, 0 + br i1 %toBool3.i.i, label %bb4.i.i, label %bb5.i.i -bb4.i.i: ; preds = %bb2.i.i - %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %56 = load i32** %55, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb4.i.i: ; preds = %bb2.i.i + %55 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %56 = load i32** %55, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb5.i.i: ; preds = %bb2.i.i - %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %58 = load i32** %57, align 4 ; <i32*> [#uses=1] - %59 = getelementptr i32* %58, i64 1 ; <i32*> [#uses=1] - %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %59, i32** %60, align 4 - %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %62 = load i32** %61, align 4 ; <i32*> [#uses=1] - %63 = load i32* %62, align 4 ; <i32> [#uses=1] - %64 = load i32* %4, align 4 ; <i32> [#uses=1] - %65 = icmp eq i32 %63, %64 ; <i1> [#uses=1] - %66 = zext i1 %65 to i8 ; <i8> [#uses=1] - %toBool6.i.i = icmp ne i8 %66, 0 ; <i1> [#uses=1] - br i1 %toBool6.i.i, label %bb7.i.i, label %bb8.i.i +bb5.i.i: ; preds = %bb2.i.i + %57 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %58 = load i32** %57, align 4 + %59 = getelementptr i32* %58, i64 1 + %60 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %59, i32** %60, align 4 + %61 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %62 = load i32** %61, align 4 + %63 = load i32* %62, align 4 + %64 = load i32* %4, align 4 + %65 = icmp eq i32 %63, %64 + %66 = zext i1 %65 to i8 + %toBool6.i.i = icmp ne i8 %66, 0 + br i1 %toBool6.i.i, label %bb7.i.i, label %bb8.i.i -bb7.i.i: ; preds = %bb5.i.i - %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %68 = load i32** %67, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb7.i.i: ; preds = %bb5.i.i + %67 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %68 = load i32** %67, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb8.i.i: ; preds = %bb5.i.i - %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %70 = load i32** %69, align 4 ; <i32*> [#uses=1] - %71 = getelementptr i32* %70, i64 1 ; <i32*> [#uses=1] - %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %71, i32** %72, align 4 - %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %74 = load i32** %73, align 4 ; <i32*> [#uses=1] - %75 = load i32* %74, align 4 ; <i32> [#uses=1] - %76 = load i32* %4, align 4 ; <i32> [#uses=1] - %77 = icmp eq i32 %75, %76 ; <i1> [#uses=1] - %78 = zext i1 %77 to i8 ; <i8> [#uses=1] - %toBool9.i.i = icmp ne i8 %78, 0 ; <i1> [#uses=1] - br i1 %toBool9.i.i, label %bb10.i.i, label %bb11.i.i +bb8.i.i: ; preds = %bb5.i.i + %69 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %70 = load i32** %69, align 4 + %71 = getelementptr i32* %70, i64 1 + %72 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %71, i32** %72, align 4 + %73 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %74 = load i32** %73, align 4 + %75 = load i32* %74, align 4 + %76 = load i32* %4, align 4 + %77 = icmp eq i32 %75, %76 + %78 = zext i1 %77 to i8 + %toBool9.i.i = icmp ne i8 %78, 0 + br i1 %toBool9.i.i, label %bb10.i.i, label %bb11.i.i -bb10.i.i: ; preds = %bb8.i.i - %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %80 = load i32** %79, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb10.i.i: ; preds = %bb8.i.i + %79 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %80 = load i32** %79, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb11.i.i: ; preds = %bb8.i.i - %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %82 = load i32** %81, align 4 ; <i32*> [#uses=1] - %83 = getelementptr i32* %82, i64 1 ; <i32*> [#uses=1] - %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %83, i32** %84, align 4 - %85 = sub i32 %__trip_count.0.i.i, 1 ; <i32> [#uses=1] - br label %bb12.i.i +bb11.i.i: ; preds = %bb8.i.i + %81 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %82 = load i32** %81, align 4 + %83 = getelementptr i32* %82, i64 1 + %84 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %83, i32** %84, align 4 + %85 = sub i32 %__trip_count.0.i.i, 1 + br label %bb12.i.i -bb12.i.i: ; preds = %bb11.i.i, %entry - %__trip_count.0.i.i = phi i32 [ %36, %entry ], [ %85, %bb11.i.i ] ; <i32> [#uses=2] - %86 = icmp sgt i32 %__trip_count.0.i.i, 0 ; <i1> [#uses=1] - br i1 %86, label %bb.i.i, label %bb13.i.i +bb12.i.i: ; preds = %bb11.i.i, %entry + %__trip_count.0.i.i = phi i32 [ %36, %entry ], [ %85, %bb11.i.i ] + %86 = icmp sgt i32 %__trip_count.0.i.i, 0 + br i1 %86, label %bb.i.i, label %bb13.i.i -bb13.i.i: ; preds = %bb12.i.i - %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %88 = load i32** %87, align 4 ; <i32*> [#uses=1] - %89 = ptrtoint i32* %88 to i32 ; <i32> [#uses=1] - %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %91 = load i32** %90, align 4 ; <i32*> [#uses=1] - %92 = ptrtoint i32* %91 to i32 ; <i32> [#uses=1] - %93 = sub i32 %89, %92 ; <i32> [#uses=1] - %94 = ashr i32 %93, 2 ; <i32> [#uses=1] - switch i32 %94, label %bb26.i.i [ - i32 1, label %bb22.i.i - i32 2, label %bb18.i.i - i32 3, label %bb14.i.i - ] +bb13.i.i: ; preds = %bb12.i.i + %87 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + %88 = load i32** %87, align 4 + %89 = ptrtoint i32* %88 to i32 + %90 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %91 = load i32** %90, align 4 + %92 = ptrtoint i32* %91 to i32 + %93 = sub i32 %89, %92 + %94 = ashr i32 %93, 2 + switch i32 %94, label %bb26.i.i [ + i32 1, label %bb22.i.i + i32 2, label %bb18.i.i + i32 3, label %bb14.i.i + ] -bb14.i.i: ; preds = %bb13.i.i - %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %96 = load i32** %95, align 4 ; <i32*> [#uses=1] - %97 = load i32* %96, align 4 ; <i32> [#uses=1] - %98 = load i32* %4, align 4 ; <i32> [#uses=1] - %99 = icmp eq i32 %97, %98 ; <i1> [#uses=1] - %100 = zext i1 %99 to i8 ; <i8> [#uses=1] - %toBool15.i.i = icmp ne i8 %100, 0 ; <i1> [#uses=1] - br i1 %toBool15.i.i, label %bb16.i.i, label %bb17.i.i +bb14.i.i: ; preds = %bb13.i.i + %95 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %96 = load i32** %95, align 4 + %97 = load i32* %96, align 4 + %98 = load i32* %4, align 4 + %99 = icmp eq i32 %97, %98 + %100 = zext i1 %99 to i8 + %toBool15.i.i = icmp ne i8 %100, 0 + br i1 %toBool15.i.i, label %bb16.i.i, label %bb17.i.i -bb16.i.i: ; preds = %bb14.i.i - %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %102 = load i32** %101, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb16.i.i: ; preds = %bb14.i.i + %101 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %102 = load i32** %101, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb17.i.i: ; preds = %bb14.i.i - %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %104 = load i32** %103, align 4 ; <i32*> [#uses=1] - %105 = getelementptr i32* %104, i64 1 ; <i32*> [#uses=1] - %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %105, i32** %106, align 4 - br label %bb18.i.i +bb17.i.i: ; preds = %bb14.i.i + %103 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %104 = load i32** %103, align 4 + %105 = getelementptr i32* %104, i64 1 + %106 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %105, i32** %106, align 4 + br label %bb18.i.i -bb18.i.i: ; preds = %bb17.i.i, %bb13.i.i - %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %108 = load i32** %107, align 4 ; <i32*> [#uses=1] - %109 = load i32* %108, align 4 ; <i32> [#uses=1] - %110 = load i32* %4, align 4 ; <i32> [#uses=1] - %111 = icmp eq i32 %109, %110 ; <i1> [#uses=1] - %112 = zext i1 %111 to i8 ; <i8> [#uses=1] - %toBool19.i.i = icmp ne i8 %112, 0 ; <i1> [#uses=1] - br i1 %toBool19.i.i, label %bb20.i.i, label %bb21.i.i +bb18.i.i: ; preds = %bb17.i.i, %bb13.i.i + %107 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %108 = load i32** %107, align 4 + %109 = load i32* %108, align 4 + %110 = load i32* %4, align 4 + %111 = icmp eq i32 %109, %110 + %112 = zext i1 %111 to i8 + %toBool19.i.i = icmp ne i8 %112, 0 + br i1 %toBool19.i.i, label %bb20.i.i, label %bb21.i.i -bb20.i.i: ; preds = %bb18.i.i - %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %114 = load i32** %113, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb20.i.i: ; preds = %bb18.i.i + %113 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %114 = load i32** %113, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb21.i.i: ; preds = %bb18.i.i - %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %116 = load i32** %115, align 4 ; <i32*> [#uses=1] - %117 = getelementptr i32* %116, i64 1 ; <i32*> [#uses=1] - %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %117, i32** %118, align 4 - br label %bb22.i.i +bb21.i.i: ; preds = %bb18.i.i + %115 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %116 = load i32** %115, align 4 + %117 = getelementptr i32* %116, i64 1 + %118 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %117, i32** %118, align 4 + br label %bb22.i.i -bb22.i.i: ; preds = %bb21.i.i, %bb13.i.i - %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %120 = load i32** %119, align 4 ; <i32*> [#uses=1] - %121 = load i32* %120, align 4 ; <i32> [#uses=1] - %122 = load i32* %4, align 4 ; <i32> [#uses=1] - %123 = icmp eq i32 %121, %122 ; <i1> [#uses=1] - %124 = zext i1 %123 to i8 ; <i8> [#uses=1] - %toBool23.i.i = icmp ne i8 %124, 0 ; <i1> [#uses=1] - br i1 %toBool23.i.i, label %bb24.i.i, label %bb25.i.i +bb22.i.i: ; preds = %bb21.i.i, %bb13.i.i + %119 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %120 = load i32** %119, align 4 + %121 = load i32* %120, align 4 + %122 = load i32* %4, align 4 + %123 = icmp eq i32 %121, %122 + %124 = zext i1 %123 to i8 + %toBool23.i.i = icmp ne i8 %124, 0 + br i1 %toBool23.i.i, label %bb24.i.i, label %bb25.i.i -bb24.i.i: ; preds = %bb22.i.i - %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %126 = load i32** %125, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb24.i.i: ; preds = %bb22.i.i + %125 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %126 = load i32** %125, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -bb25.i.i: ; preds = %bb22.i.i - %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %128 = load i32** %127, align 4 ; <i32*> [#uses=1] - %129 = getelementptr i32* %128, i64 1 ; <i32*> [#uses=1] - %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - store i32* %129, i32** %130, align 4 - br label %bb26.i.i +bb25.i.i: ; preds = %bb22.i.i + %127 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + %128 = load i32** %127, align 4 + %129 = getelementptr i32* %128, i64 1 + %130 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__first_addr.i.i, i32 0, i32 0 + store i32* %129, i32** %130, align 4 + br label %bb26.i.i -bb26.i.i: ; preds = %bb25.i.i, %bb13.i.i - %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 ; <i32**> [#uses=1] - %132 = load i32** %131, align 4 ; <i32*> [#uses=1] - br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit +bb26.i.i: ; preds = %bb25.i.i, %bb13.i.i + %131 = getelementptr %"struct.__gnu_cxx::__normal_iterator<int*,std::vector<int, std::allocator<int> > >"* %__last_addr.i.i, i32 0, i32 0 + %132 = load i32** %131, align 4 + br label %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit -_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit: ; preds = %bb26.i.i, %bb24.i.i, %bb20.i.i, %bb16.i.i, %bb10.i.i, %bb7.i.i, %bb4.i.i, %bb1.i.i - %.0.0.i.i = phi i32* [ %132, %bb26.i.i ], [ %126, %bb24.i.i ], [ %114, %bb20.i.i ], [ %102, %bb16.i.i ], [ %80, %bb10.i.i ], [ %68, %bb7.i.i ], [ %56, %bb4.i.i ], [ %44, %bb1.i.i ] ; <i32*> [#uses=1] - %tmp2.i.i = ptrtoint i32* %.0.0.i.i to i32 ; <i32> [#uses=1] - %tmp1.i.i = inttoptr i32 %tmp2.i.i to i32* ; <i32*> [#uses=1] - %tmp4.i = ptrtoint i32* %tmp1.i.i to i32 ; <i32> [#uses=1] - %tmp3.i = inttoptr i32 %tmp4.i to i32* ; <i32*> [#uses=1] - %tmp8.i = ptrtoint i32* %tmp3.i to i32 ; <i32> [#uses=1] - %tmp6.i = inttoptr i32 %tmp8.i to i32* ; <i32*> [#uses=1] - %tmp12 = ptrtoint i32* %tmp6.i to i32 ; <i32> [#uses=1] - %tmp10 = inttoptr i32 %tmp12 to i32* ; <i32*> [#uses=1] - %tmp16 = ptrtoint i32* %tmp10 to i32 ; <i32> [#uses=1] - br label %return +_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit: ; preds = %bb26.i.i, %bb24.i.i, %bb20.i.i, %bb16.i.i, %bb10.i.i, %bb7.i.i, %bb4.i.i, %bb1.i.i + %.0.0.i.i = phi i32* [ %132, %bb26.i.i ], [ %126, %bb24.i.i ], [ %114, %bb20.i.i ], [ %102, %bb16.i.i ], [ %80, %bb10.i.i ], [ %68, %bb7.i.i ], [ %56, %bb4.i.i ], [ %44, %bb1.i.i ] + %tmp2.i.i = ptrtoint i32* %.0.0.i.i to i32 + %tmp1.i.i = inttoptr i32 %tmp2.i.i to i32* + %tmp4.i = ptrtoint i32* %tmp1.i.i to i32 + %tmp3.i = inttoptr i32 %tmp4.i to i32* + %tmp8.i = ptrtoint i32* %tmp3.i to i32 + %tmp6.i = inttoptr i32 %tmp8.i to i32* + %tmp12 = ptrtoint i32* %tmp6.i to i32 + %tmp10 = inttoptr i32 %tmp12 to i32* + %tmp16 = ptrtoint i32* %tmp10 to i32 + br label %return -return: ; preds = %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit - %tmp14 = inttoptr i32 %tmp16 to i32* ; <i32*> [#uses=1] - ret i32* %tmp14 +return: ; preds = %_ZSt4findIN9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEEiET_S7_S7_RKT0_.exit + %tmp14 = inttoptr i32 %tmp16 to i32* + ret i32* %tmp14 } -declare void @llvm.memcpy.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll b/test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll deleted file mode 100644 index 2f6034e..0000000 --- a/test/Transforms/InstCombine/2011-02-16-InsertelementHang.ll +++ /dev/null @@ -1,11 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s -; PR9218 - -%vec2x2 = type { <2 x double>, <2 x double> } - -define %vec2x2 @split(double) nounwind alwaysinline { -; CHECK: @split -; CHECK: ret %vec2x2 undef - %vba = insertelement <2 x double> undef, double %0, i32 2 - ret <2 x double> %vba, <2 x double> %vba -} diff --git a/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll new file mode 100644 index 0000000..2f72b73 --- /dev/null +++ b/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll @@ -0,0 +1,60 @@ +; RUN: opt -S -instcombine < %s | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" +target triple = "i386-apple-darwin10.0.0" + +define void @fu1(i32 %parm) nounwind ssp { + %1 = alloca i32, align 4 + %ptr = alloca double*, align 4 + store i32 %parm, i32* %1, align 4 + store double* null, double** %ptr, align 4 + %2 = load i32* %1, align 4 + %3 = icmp ne i32 %2, 0 + br i1 %3, label %4, label %10 + +; <label>:4 ; preds = %0 + %5 = load i32* %1, align 4 + %6 = mul nsw i32 %5, 8 +; With "nsw", the alloca and its bitcast can be fused: + %7 = add nsw i32 %6, 2048 +; CHECK: alloca double* + %8 = alloca i8, i32 %7 + %9 = bitcast i8* %8 to double* + store double* %9, double** %ptr, align 4 + br label %10 + +; <label>:10 ; preds = %4, %0 + %11 = load double** %ptr, align 4 + call void @bar(double* %11) +; CHECK: ret + ret void +} + +declare void @bar(double*) + +define void @fu2(i32 %parm) nounwind ssp { + %1 = alloca i32, align 4 + %ptr = alloca double*, align 4 + store i32 %parm, i32* %1, align 4 + store double* null, double** %ptr, align 4 + %2 = load i32* %1, align 4 + %3 = icmp ne i32 %2, 0 + br i1 %3, label %4, label %10 + +; <label>:4 ; preds = %0 + %5 = load i32* %1, align 4 + %6 = mul nsw i32 %5, 8 +; Without "nsw", the alloca and its bitcast cannot be fused: + %7 = add i32 %6, 2048 +; CHECK: alloca i8 + %8 = alloca i8, i32 %7 +; CHECK-NEXT: bitcast i8* + %9 = bitcast i8* %8 to double* + store double* %9, double** %ptr, align 4 + br label %10 + +; <label>:10 ; preds = %4, %0 + %11 = load double** %ptr, align 4 + call void @bar(double* %11) + ret void +} + diff --git a/test/Transforms/InstCombine/bswap-fold.ll b/test/Transforms/InstCombine/bswap-fold.ll index a6b30c0..442ce58 100644 --- a/test/Transforms/InstCombine/bswap-fold.ll +++ b/test/Transforms/InstCombine/bswap-fold.ll @@ -50,10 +50,6 @@ entry: } ; PR5284 -declare i64 @llvm.bswap.i64(i64) -declare i32 @llvm.bswap.i32(i32) -declare i16 @llvm.bswap.i16(i16) - define i16 @test7(i32 %A) { %B = tail call i32 @llvm.bswap.i32(i32 %A) nounwind %C = trunc i32 %B to i16 diff --git a/test/Transforms/InstCombine/call2.ll b/test/Transforms/InstCombine/call2.ll index 3a6bd67..1f45c7a 100644 --- a/test/Transforms/InstCombine/call2.ll +++ b/test/Transforms/InstCombine/call2.ll @@ -4,7 +4,6 @@ define i32 @bar() { entry: %retval = alloca i32, align 4 ; <i32*> [#uses=1] - "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] %tmp = call i32 (...)* bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; <i32> [#uses=0] br label %return @@ -17,7 +16,6 @@ define i32 @f(i8* %p) { entry: %p_addr = alloca i8* ; <i8**> [#uses=1] %retval = alloca i32, align 4 ; <i32*> [#uses=1] - "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] store i8* %p, i8** %p_addr br label %return diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index bc5e365..f85636f 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -99,14 +99,6 @@ define void @test11(i32* %P) { ; CHECK: ret void } -define i32* @test12() { - %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1] - %c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1] - ret i32* %c -; CHECK: %malloccall = tail call i8* @malloc(i32 4) -; CHECK: ret i32* %c -} - define i8* @test13(i64 %A) { %c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1] ret i8* %c @@ -265,22 +257,11 @@ define i1 @test31(i64 %A) { %C = and i32 %B, 42 ; <i32> [#uses=1] %D = icmp eq i32 %C, 10 ; <i1> [#uses=1] ret i1 %D -; CHECK: %C1 = and i64 %A, 42 -; CHECK: %D = icmp eq i64 %C1, 10 +; CHECK: %C = and i64 %A, 42 +; CHECK: %D = icmp eq i64 %C, 10 ; CHECK: ret i1 %D } -define void @test32(double** %tmp) { - %tmp8 = malloc [16 x i8] ; <[16 x i8]*> [#uses=1] - %tmp8.upgrd.1 = bitcast [16 x i8]* %tmp8 to double* ; <double*> [#uses=1] - store double* %tmp8.upgrd.1, double** %tmp - ret void -; CHECK: %malloccall = tail call i8* @malloc(i32 16) -; CHECK: %tmp8.upgrd.1 = bitcast i8* %malloccall to double* -; CHECK: store double* %tmp8.upgrd.1, double** %tmp -; CHECK: ret void -} - define i32 @test33(i32 %c1) { %x = bitcast i32 %c1 to float ; <float> [#uses=1] %y = bitcast float %x to i32 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/getelementptr.ll b/test/Transforms/InstCombine/getelementptr.ll index 9e8547b..26c0e47 100644 --- a/test/Transforms/InstCombine/getelementptr.ll +++ b/test/Transforms/InstCombine/getelementptr.ll @@ -40,7 +40,7 @@ define i32* @test4({ i32 }* %I) { %B = getelementptr { i32 }* %A, i64 0, i32 0 ret i32* %B ; CHECK: @test4 -; CHECK: getelementptr %intstruct* %I, i64 1, i32 0 +; CHECK: getelementptr { i32 }* %I, i64 1, i32 0 } define void @test5(i8 %B) { @@ -52,14 +52,6 @@ define void @test5(i8 %B) { ; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4) } -define i32* @test6() { - %M = malloc [4 x i32] - %A = getelementptr [4 x i32]* %M, i64 0, i64 0 - %B = getelementptr i32* %A, i64 2 - ret i32* %B -; CHECK: @test6 -; CHECK: getelementptr i8* %malloccall, i64 8 -} define i32* @test7(i32* %I, i64 %C, i64 %D) { %A = getelementptr i32* %I, i64 %C @@ -94,7 +86,7 @@ define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) { %tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ret i1 %tmp.4 ; CHECK: @test10 -; CHECK: icmp eq %pair* %x, %y +; CHECK: icmp eq { i32, i32 }* %x, %y } define i1 @test11({ i32, i32 }* %X) { @@ -102,7 +94,7 @@ define i1 @test11({ i32, i32 }* %X) { %Q = icmp eq i32* %P, null ret i1 %Q ; CHECK: @test11 -; CHECK: icmp eq %pair* %X, null +; CHECK: icmp eq { i32, i32 }* %X, null } @@ -236,19 +228,6 @@ define i1 @test23() { ; CHECK: ret i1 false } -%"java/lang/Object" = type { %struct.llvm_java_object_base } -%"java/lang/StringBuffer" = type { %"java/lang/Object", i32, { %"java/lang/Object", i32, [0 x i16] }*, i1 } -%struct.llvm_java_object_base = type opaque - -define void @test24() { -bc0: - %tmp53 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 0, i32* %tmp53 - ret void -; CHECK: @test24 -; CHECK: store i32 0, i32* getelementptr (%"java/lang/StringBuffer"* null, i64 0, i32 1) -} - define void @test25() { entry: %tmp = getelementptr { i64, i64, i64, i64 }* null, i32 0, i32 3 ; <i64*> [#uses=1] @@ -477,3 +456,19 @@ define i32* @test38(i32* %I, i32 %n) { ; CHECK: = sext i32 %n to i64 ; CHECK: %A = getelementptr i32* %I, i64 % } + +; Test that we don't duplicate work when the second gep is a "bitcast". +%pr10322_t = type { i8* } +declare void @pr10322_f2(%pr10322_t*) +declare void @pr10322_f3(i8**) +define void @pr10322_f1(%pr10322_t* %foo) { +entry: + %arrayidx8 = getelementptr inbounds %pr10322_t* %foo, i64 2 + call void @pr10322_f2(%pr10322_t* %arrayidx8) nounwind + %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0 + call void @pr10322_f3(i8** %tmp2) nounwind + ret void + +; CHECK: @pr10322_f1 +; CHECK: %tmp2 = getelementptr inbounds %pr10322_t* %arrayidx8, i64 0, i32 0 +} diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll index 1237ade..77ca62c 100644 --- a/test/Transforms/InstCombine/icmp.ll +++ b/test/Transforms/InstCombine/icmp.ll @@ -521,3 +521,41 @@ define i1 @test53(i32 %a, i32 %b) nounwind { %z = icmp eq i32 %x, %y ret i1 %z } + +; CHECK: @test54 +; CHECK-NEXT: %and = and i8 %a, -64 +; CHECK-NEXT icmp eq i8 %and, -128 +define i1 @test54(i8 %a) nounwind { + %ext = zext i8 %a to i32 + %and = and i32 %ext, 192 + %ret = icmp eq i32 %and, 128 + ret i1 %ret +} + +; CHECK: @test55 +; CHECK-NEXT: icmp eq i32 %a, -123 +define i1 @test55(i32 %a) { + %sub = sub i32 0, %a + %cmp = icmp eq i32 %sub, 123 + ret i1 %cmp +} + +; CHECK: @test56 +; CHECK-NEXT: icmp eq i32 %a, -113 +define i1 @test56(i32 %a) { + %sub = sub i32 10, %a + %cmp = icmp eq i32 %sub, 123 + ret i1 %cmp +} + +; PR10267 Don't make icmps more expensive when no other inst is subsumed. +declare void @foo(i32) +; CHECK: @test57 +; CHECK: %and = and i32 %a, -2 +; CHECK: %cmp = icmp ne i32 %and, 0 +define i1 @test57(i32 %a) { + %and = and i32 %a, -2 + %cmp = icmp ne i32 %and, 0 + call void @foo(i32 %and) + ret i1 %cmp +} diff --git a/test/Transforms/InstCombine/intrinsics.ll b/test/Transforms/InstCombine/intrinsics.ll index 107f313..0d84ae4 100644 --- a/test/Transforms/InstCombine/intrinsics.ll +++ b/test/Transforms/InstCombine/intrinsics.ll @@ -213,5 +213,4 @@ define i32 @cttz_simplify1(i32 %x) nounwind readnone ssp { ; CHECK-NEXT: ret i32 } -declare i32 @llvm.ctlz.i32(i32) nounwind readnone diff --git a/test/Transforms/InstCombine/malloc-free-delete.ll b/test/Transforms/InstCombine/malloc-free-delete.ll index 317786f..8455300 100644 --- a/test/Transforms/InstCombine/malloc-free-delete.ll +++ b/test/Transforms/InstCombine/malloc-free-delete.ll @@ -1,14 +1,14 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s ; PR1201 define i32 @main(i32 %argc, i8** %argv) { - %c_19 = alloca i8* - %malloc_206 = malloc i8, i32 10 + %c_19 = alloca i8* + %malloc_206 = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8* null, i32 1) to i32), i32 10)) + store i8* %malloc_206, i8** %c_19 + %tmp_207 = load i8** %c_19 + tail call void @free(i8* %tmp_207) + ret i32 0 ; CHECK-NOT: malloc - store i8* %malloc_206, i8** %c_19 - %tmp_207 = load i8** %c_19 - free i8* %tmp_207 ; CHECK-NOT: free - ret i32 0 ; CHECK: ret i32 0 } diff --git a/test/Transforms/InstCombine/malloc.ll b/test/Transforms/InstCombine/malloc.ll deleted file mode 100644 index b6ebbea..0000000 --- a/test/Transforms/InstCombine/malloc.ll +++ /dev/null @@ -1,7 +0,0 @@ -; test that malloc's with a constant argument are promoted to array allocations -; RUN: opt < %s -instcombine -S | grep getelementptr - -define i32* @test() { - %X = malloc i32, i32 4 - ret i32* %X -} diff --git a/test/Transforms/InstCombine/malloc2.ll b/test/Transforms/InstCombine/malloc2.ll deleted file mode 100644 index 8462dac..0000000 --- a/test/Transforms/InstCombine/malloc2.ll +++ /dev/null @@ -1,22 +0,0 @@ -; RUN: opt < %s -instcombine -S | FileCheck %s -; PR1313 - -define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { - %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1] -; CHECK-NOT: call i8* @malloc - %c = icmp eq [2564 x i32]* %tmp15.i.i.i23, null ; <i1>:0 [#uses=1] - %retval = zext i1 %c to i32 ; <i32> [#uses=1] - ret i32 %retval -; CHECK: ret i32 0 -} - -define i32 @test2(i32 %argc, i8* %argv, i8* %envp) { - %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1] -; CHECK-NOT: call i8* @malloc - %X = bitcast [2564 x i32]* %tmp15.i.i.i23 to i32* - %c = icmp ne i32* %X, null - %retval = zext i1 %c to i32 ; <i32> [#uses=1] - ret i32 %retval -; CHECK: ret i32 1 -} - diff --git a/test/Transforms/InstCombine/malloc3.ll b/test/Transforms/InstCombine/malloc3.ll deleted file mode 100644 index f1c0cae..0000000 --- a/test/Transforms/InstCombine/malloc3.ll +++ /dev/null @@ -1,26 +0,0 @@ -; RUN: opt < %s -instcombine -S | not grep load -; PR1728 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin8" - %struct.foo = type { %struct.foo*, [10 x i32] } -@.str = internal constant [21 x i8] c"tmp = %p, next = %p\0A\00" ; <[21 x i8]*> [#uses=1] - -define i32 @main() { -entry: - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - %tmp1 = malloc i8, i32 44 ; <i8*> [#uses=1] - %tmp12 = bitcast i8* %tmp1 to %struct.foo* ; <%struct.foo*> [#uses=3] - %tmp3 = malloc i8, i32 44 ; <i8*> [#uses=1] - %tmp34 = bitcast i8* %tmp3 to %struct.foo* ; <%struct.foo*> [#uses=1] - %tmp6 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1] - store %struct.foo* %tmp34, %struct.foo** %tmp6, align 4 - %tmp8 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1] - %tmp9 = load %struct.foo** %tmp8, align 4 ; <%struct.foo*> [#uses=1] - %tmp10 = getelementptr [21 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp13 = call i32 (i8*, ...)* @printf( i8* %tmp10, %struct.foo* %tmp12, %struct.foo* %tmp9 ) ; <i32> [#uses=0] - ret i32 undef -} - -declare i32 @printf(i8*, ...) - diff --git a/test/Transforms/InstCombine/memcpy-to-load.ll b/test/Transforms/InstCombine/memcpy-to-load.ll index ebb8711..04aac98 100644 --- a/test/Transforms/InstCombine/memcpy-to-load.ll +++ b/test/Transforms/InstCombine/memcpy-to-load.ll @@ -4,11 +4,10 @@ target triple = "i686-apple-darwin8" define void @foo(double* %X, double* %Y) { entry: - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - %tmp2 = bitcast double* %X to i8* ; <i8*> [#uses=1] - %tmp13 = bitcast double* %Y to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 8, i32 1 ) - ret void + %tmp2 = bitcast double* %X to i8* + %tmp13 = bitcast double* %Y to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp13, i32 8, i32 1, i1 false) + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/memmove.ll b/test/Transforms/InstCombine/memmove.ll index 1806cfc..4602c12 100644 --- a/test/Transforms/InstCombine/memmove.ll +++ b/test/Transforms/InstCombine/memmove.ll @@ -1,24 +1,20 @@ ; This test makes sure that memmove instructions are properly eliminated. ; -; RUN: opt < %s -instcombine -S | \ -; RUN: not grep {call void @llvm.memmove} +; RUN: opt < %s -instcombine -S | not grep {call void @llvm.memmove} @S = internal constant [33 x i8] c"panic: restorelist inconsistency\00" ; <[33 x i8]*> [#uses=1] @h = constant [2 x i8] c"h\00" ; <[2 x i8]*> [#uses=1] @hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1] @hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1] - -declare void @llvm.memmove.i32(i8*, i8*, i32, i32) - define void @test1(i8* %A, i8* %B, i32 %N) { - call void @llvm.memmove.i32( i8* %A, i8* %B, i32 0, i32 1 ) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* %B, i32 0, i32 1, i1 false) ret void } define void @test2(i8* %A, i32 %N) { ;; dest can't alias source since we can't write to source! - call void @llvm.memmove.i32( i8* %A, i8* getelementptr ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1 ) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %A, i8* getelementptr inbounds ([33 x i8]* @S, i32 0, i32 0), i32 %N, i32 1, i1 false) ret void } @@ -28,15 +24,16 @@ define i32 @test3() { %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1] %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1] %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3] - call void @llvm.memmove.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 ) - call void @llvm.memmove.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 ) - call void @llvm.memmove.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 ) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false) ret i32 0 } ; PR2370 define void @test4(i8* %a) { - tail call void @llvm.memmove.i32( i8* %a, i8* %a, i32 100, i32 1 ) - ret void + tail call void @llvm.memmove.p0i8.p0i8.i32(i8* %a, i8* %a, i32 100, i32 1, i1 false) + ret void } +declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/memset.ll b/test/Transforms/InstCombine/memset.ll index 8e85694..7f7bc9f 100644 --- a/test/Transforms/InstCombine/memset.ll +++ b/test/Transforms/InstCombine/memset.ll @@ -1,15 +1,14 @@ ; RUN: opt < %s -instcombine -S | not grep {call.*llvm.memset} -declare void @llvm.memset.i32(i8*, i8, i32, i32) - define i32 @main() { - %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1] - %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=5] - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 0, i32 1 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 1, i32 1 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 2, i32 2 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 4, i32 4 ) - call void @llvm.memset.i32( i8* %target_p, i8 1, i32 8, i32 8 ) - ret i32 0 + %target = alloca [1024 x i8] + %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 0, i32 1, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 1, i32 1, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 2, i32 2, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 4, i32 4, i1 false) + call void @llvm.memset.p0i8.i32(i8* %target_p, i8 1, i32 8, i32 8, i1 false) + ret i32 0 } +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/not.ll b/test/Transforms/InstCombine/not.ll index c58ce11..4a8825b 100644 --- a/test/Transforms/InstCombine/not.ll +++ b/test/Transforms/InstCombine/not.ll @@ -43,7 +43,7 @@ define i32 @test5(i32 %A, i32 %B) { } ; PR2298 -define i8 @test6(i32 %a, i32 %b) zeroext nounwind { +define zeroext i8 @test6(i32 %a, i32 %b) nounwind { entry: %tmp1not = xor i32 %a, -1 ; <i32> [#uses=1] %tmp2not = xor i32 %b, -1 ; <i32> [#uses=1] diff --git a/test/Transforms/InstCombine/objsize.ll b/test/Transforms/InstCombine/objsize.ll index 043525b..28ceb68 100644 --- a/test/Transforms/InstCombine/objsize.ll +++ b/test/Transforms/InstCombine/objsize.ll @@ -149,8 +149,6 @@ declare i8* @__memset_chk(i8*, i32, i32, i32) nounwind declare noalias i8* @malloc(i32) nounwind -declare i32 @llvm.objectsize.i32(i8*, i1) nounwind readonly - define i32 @test7() { ; CHECK: @test7 %alloc = call noalias i8* @malloc(i32 48) nounwind diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll index cd865ae..219545c 100644 --- a/test/Transforms/InstCombine/phi.ll +++ b/test/Transforms/InstCombine/phi.ll @@ -139,7 +139,7 @@ BB2: ; CHECK: @test8 ; CHECK-NOT: phi ; CHECK: BB2: -; CHECK-NEXT: %B = getelementptr %0 +; CHECK-NEXT: %B = getelementptr { i32, i32 }* %A ; CHECK-NEXT: ret i32* %B } diff --git a/test/Transforms/InstCombine/select-crash.ll b/test/Transforms/InstCombine/select-crash.ll index 8ee3369..18af152 100644 --- a/test/Transforms/InstCombine/select-crash.ll +++ b/test/Transforms/InstCombine/select-crash.ll @@ -18,3 +18,15 @@ entry: %add94 = fadd double undef, %mul91 ret double %add94 } + +; PR10180: same crash, but with vectors +define <4 x float> @foo(i1 %b, <4 x float> %x, <4 x float> %y, <4 x float> %z) { +; CHECK: @foo +; CHECK: fsub <4 x float> +; CHECK: select +; CHECK: fadd <4 x float> + %a = fadd <4 x float> %x, %y + %sub = fsub <4 x float> %x, %z + %sel = select i1 %b, <4 x float> %a, <4 x float> %sub + ret <4 x float> %sel +} diff --git a/test/Transforms/InstCombine/sqrt.ll b/test/Transforms/InstCombine/sqrt.ll index 69e511b..cc78417 100644 --- a/test/Transforms/InstCombine/sqrt.ll +++ b/test/Transforms/InstCombine/sqrt.ll @@ -14,8 +14,6 @@ entry: ret float %conv1 } -declare double @sqrt(double) - ; PR8096 define float @test2(float %x) nounwind readnone ssp { entry: @@ -30,3 +28,27 @@ entry: ; CHECK: ret float ret float %conv1 } + +; rdar://9763193 +; Can't fold (fptrunc (sqrt (fpext x))) -> (sqrtf x) since there is another +; use of sqrt result. +define float @test3(float* %v) nounwind uwtable ssp { +entry: +; CHECK: @test3 +; CHECK: sqrt( +; CHECK-NOT: sqrtf( +; CHECK: fptrunc + %arrayidx13 = getelementptr inbounds float* %v, i64 2 + %tmp14 = load float* %arrayidx13 + %mul18 = fmul float %tmp14, %tmp14 + %add19 = fadd float undef, %mul18 + %conv = fpext float %add19 to double + %call34 = call double @sqrt(double %conv) readnone + %call36 = call i32 (double)* @foo(double %call34) nounwind + %conv38 = fptrunc double %call34 to float + ret float %conv38 +} + +declare i32 @foo(double) + +declare double @sqrt(double) readnone diff --git a/test/Transforms/InstCombine/stack-overalign.ll b/test/Transforms/InstCombine/stack-overalign.ll index 88b4114..2fc8414 100644 --- a/test/Transforms/InstCombine/stack-overalign.ll +++ b/test/Transforms/InstCombine/stack-overalign.ll @@ -17,13 +17,13 @@ define void @foo() nounwind { entry: - %src = alloca [1024 x i8], align 1 - %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0 - call void @llvm.memcpy.i32(i8* getelementptr ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1) - call void @frob(i8* %src1) nounwind - ret void + %src = alloca [1024 x i8], align 1 + %src1 = getelementptr [1024 x i8]* %src, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* getelementptr inbounds ([1024 x i8]* @dst, i32 0, i32 0), i8* %src1, i32 1024, i32 1, i1 false) + call void @frob(i8* %src1) nounwind + ret void } -declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind - declare void @frob(i8*) + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/InstCombine/sub.ll b/test/Transforms/InstCombine/sub.ll index 9656a7e..37de328 100644 --- a/test/Transforms/InstCombine/sub.ll +++ b/test/Transforms/InstCombine/sub.ll @@ -203,7 +203,7 @@ define i1 @test21(i32 %g, i32 %h) { } ; PR2298 -define i1 @test22(i32 %a, i32 %b) zeroext nounwind { +define zeroext i1 @test22(i32 %a, i32 %b) nounwind { %tmp2 = sub i32 0, %a %tmp4 = sub i32 0, %b %tmp5 = icmp eq i32 %tmp2, %tmp4 diff --git a/test/Transforms/InstCombine/vec_narrow.ll b/test/Transforms/InstCombine/vec_narrow.ll index c05c802..2be43599 100644 --- a/test/Transforms/InstCombine/vec_narrow.ll +++ b/test/Transforms/InstCombine/vec_narrow.ll @@ -1,12 +1,10 @@ -; RUN: opt < %s -instcombine -S | \ -; RUN: grep {fadd float} +; RUN: opt < %s -instcombine -S | grep {fadd float} - %V = type <4 x float> -define float @test(%V %A, %V %B, float %f) { - %C = insertelement %V %A, float %f, i32 0 ; <%V> [#uses=1] - %D = fadd %V %C, %B ; <%V> [#uses=1] - %E = extractelement %V %D, i32 0 ; <float> [#uses=1] +define float @test(<4 x float> %A, <4 x float> %B, float %f) { + %C = insertelement <4 x float> %A, float %f, i32 0 ; <%V> [#uses=1] + %D = fadd <4 x float> %C, %B ; <%V> [#uses=1] + %E = extractelement <4 x float> %D, i32 0 ; <float> [#uses=1] ret float %E } diff --git a/test/Transforms/InstCombine/vec_shuffle.ll b/test/Transforms/InstCombine/vec_shuffle.ll index bd36e9e..896cb88 100644 --- a/test/Transforms/InstCombine/vec_shuffle.ll +++ b/test/Transforms/InstCombine/vec_shuffle.ll @@ -1,28 +1,25 @@ ; RUN: opt < %s -instcombine -S | FileCheck %s -%T = type <4 x float> - - -define %T @test1(%T %v1) { +define <4 x float> @test1(<4 x float> %v1) { ; CHECK: @test1 -; CHECK: ret %T %v1 - %v2 = shufflevector %T %v1, %T undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> - ret %T %v2 +; CHECK: ret <4 x float> %v1 + %v2 = shufflevector <4 x float> %v1, <4 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3> + ret <4 x float> %v2 } -define %T @test2(%T %v1) { +define <4 x float> @test2(<4 x float> %v1) { ; CHECK: @test2 -; CHECK: ret %T %v1 - %v2 = shufflevector %T %v1, %T %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7> - ret %T %v2 +; CHECK: ret <4 x float> %v1 + %v2 = shufflevector <4 x float> %v1, <4 x float> %v1, <4 x i32> <i32 0, i32 5, i32 2, i32 7> + ret <4 x float> %v2 } -define float @test3(%T %A, %T %B, float %f) { +define float @test3(<4 x float> %A, <4 x float> %B, float %f) { ; CHECK: @test3 ; CHECK: ret float %f - %C = insertelement %T %A, float %f, i32 0 - %D = shufflevector %T %C, %T %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7> - %E = extractelement %T %D, i32 1 + %C = insertelement <4 x float> %A, float %f, i32 0 + %D = shufflevector <4 x float> %C, <4 x float> %B, <4 x i32> <i32 5, i32 0, i32 2, i32 7> + %E = extractelement <4 x float> %D, i32 1 ret float %E } @@ -57,7 +54,7 @@ define float @test6(<4 x float> %X) { define <4 x float> @test7(<4 x float> %tmp45.i) { ; CHECK: @test7 -; CHECK-NEXT: ret %T %tmp45.i +; CHECK-NEXT: ret <4 x float> %tmp45.i %tmp1642.i = shufflevector <4 x float> %tmp45.i, <4 x float> undef, <4 x i32> < i32 0, i32 1, i32 6, i32 7 > ret <4 x float> %tmp1642.i } diff --git a/test/Transforms/InstCombine/zext-or-icmp.ll b/test/Transforms/InstCombine/zext-or-icmp.ll index 969c301..ddc6083 100644 --- a/test/Transforms/InstCombine/zext-or-icmp.ll +++ b/test/Transforms/InstCombine/zext-or-icmp.ll @@ -4,7 +4,7 @@ %struct.Rock = type { i16, i16 } @some_idx = internal constant [4 x i8] c"\0A\0B\0E\0F" ; <[4 x i8]*> [#uses=1] -define i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) zeroext nounwind { +define zeroext i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) nounwind { entry: %tmp2 = lshr i32 %blk_i, 1 ; <i32> [#uses=1] %tmp3 = and i32 %tmp2, 2 ; <i32> [#uses=1] diff --git a/test/Transforms/InstSimplify/undef.ll b/test/Transforms/InstSimplify/undef.ll new file mode 100644 index 0000000..8134cc8 --- /dev/null +++ b/test/Transforms/InstSimplify/undef.ll @@ -0,0 +1,127 @@ +; RUN: opt -instsimplify -S < %s | FileCheck %s + +; @test0 +; CHECK: ret i64 undef +define i64 @test0() { + %r = mul i64 undef, undef + ret i64 %r +} + +; @test1 +; CHECK: ret i64 undef +define i64 @test1() { + %r = mul i64 3, undef + ret i64 %r +} + +; @test2 +; CHECK: ret i64 undef +define i64 @test2() { + %r = mul i64 undef, 3 + ret i64 %r +} + +; @test3 +; CHECK: ret i64 0 +define i64 @test3() { + %r = mul i64 undef, 6 + ret i64 %r +} + +; @test4 +; CHECK: ret i64 0 +define i64 @test4() { + %r = mul i64 6, undef + ret i64 %r +} + +; @test5 +; CHECK: ret i64 undef +define i64 @test5() { + %r = and i64 undef, undef + ret i64 %r +} + +; @test6 +; CHECK: ret i64 undef +define i64 @test6() { + %r = or i64 undef, undef + ret i64 %r +} + +; @test7 +; CHECK: ret i64 undef +define i64 @test7() { + %r = udiv i64 undef, 1 + ret i64 %r +} + +; @test8 +; CHECK: ret i64 undef +define i64 @test8() { + %r = sdiv i64 undef, 1 + ret i64 %r +} + +; @test9 +; CHECK: ret i64 0 +define i64 @test9() { + %r = urem i64 undef, 1 + ret i64 %r +} + +; @test10 +; CHECK: ret i64 0 +define i64 @test10() { + %r = srem i64 undef, 1 + ret i64 %r +} + +; @test11 +; CHECK: ret i64 undef +define i64 @test11() { + %r = shl i64 undef, undef + ret i64 %r +} + +; @test12 +; CHECK: ret i64 undef +define i64 @test12() { + %r = ashr i64 undef, undef + ret i64 %r +} + +; @test13 +; CHECK: ret i64 undef +define i64 @test13() { + %r = lshr i64 undef, undef + ret i64 %r +} + +; @test14 +; CHECK: ret i1 undef +define i1 @test14() { + %r = icmp slt i64 undef, undef + ret i1 %r +} + +; @test15 +; CHECK: ret i1 undef +define i1 @test15() { + %r = icmp ult i64 undef, undef + ret i1 %r +} + +; @test16 +; CHECK: ret i64 undef +define i64 @test16(i64 %a) { + %r = select i1 undef, i64 %a, i64 undef + ret i64 %r +} + +; @test17 +; CHECK: ret i64 undef +define i64 @test17(i64 %a) { + %r = select i1 undef, i64 undef, i64 %a + ret i64 %r +} diff --git a/test/Transforms/JumpThreading/crash.ll b/test/Transforms/JumpThreading/crash.ll index aed51a1..2115dd3 100644 --- a/test/Transforms/JumpThreading/crash.ll +++ b/test/Transforms/JumpThreading/crash.ll @@ -18,7 +18,7 @@ bb13: ; preds = %bb br label %bb bb110: ; preds = %bb - %mrv_gr124 = getresult %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0] + %mrv_gr124 = extractvalue %struct.system__secondary_stack__mark_id %tmp120, 1 ; <i64> [#uses=0] unreachable } diff --git a/test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll b/test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll deleted file mode 100644 index 91740cf..0000000 --- a/test/Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll +++ /dev/null @@ -1,9 +0,0 @@ -; RUN: opt < %s -licm -disable-output - -define void @test({ i32 }* %P) { - br label %Loop -Loop: ; preds = %Loop, %0 - free { i32 }* %P - br label %Loop -} - diff --git a/test/Transforms/LICM/2011-07-06-Alignment.ll b/test/Transforms/LICM/2011-07-06-Alignment.ll new file mode 100644 index 0000000..f97b701 --- /dev/null +++ b/test/Transforms/LICM/2011-07-06-Alignment.ll @@ -0,0 +1,26 @@ +; RUN: opt -licm -S %s | FileCheck %s + +@A = common global [1024 x float] zeroinitializer, align 4 + +define i32 @main() nounwind { +entry: + br label %for.cond + +for.cond: + %indvar = phi i64 [ %indvar.next, %for.body ], [ 0, %entry ] + %arrayidx = getelementptr [1024 x float]* @A, i64 0, i64 3 + %vecidx = bitcast float* %arrayidx to <4 x float>* + store <4 x float> zeroinitializer, <4 x float>* %vecidx, align 4 + %indvar.next = add i64 %indvar, 1 + %exitcond = icmp ne i64 %indvar, 1024 + br i1 %exitcond, label %for.body, label %for.end + +for.body: + br label %for.cond + +for.end: + ret i32 0 +} + +;CHECK: store <4 x float> {{.*}} align 4 + diff --git a/test/Transforms/LoopDeletion/2011-06-21-phioperands.ll b/test/Transforms/LoopDeletion/2011-06-21-phioperands.ll new file mode 100644 index 0000000..40c6629 --- /dev/null +++ b/test/Transforms/LoopDeletion/2011-06-21-phioperands.ll @@ -0,0 +1,182 @@ +; RUN: opt %s -loop-deletion -disable-output + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" + +%0 = type { %"class.llvm::SmallVectorImpl", [1 x %"union.llvm::SmallVectorBase::U"] } +%"class.clang::SourceLocation" = type { i32 } +%"class.clang::driver::Arg" = type { %"class.clang::driver::Option"*, %"class.clang::driver::Arg"*, i32, i8, %0 } +%"class.clang::driver::Option" = type { i32 (...)**, i32, %"class.clang::SourceLocation", i8*, %"class.clang::driver::OptionGroup"*, %"class.clang::driver::Option"*, i8 } +%"class.clang::driver::OptionGroup" = type { %"class.clang::driver::Option" } +%"class.llvm::SmallVectorBase" = type { i8*, i8*, i8*, %"union.llvm::SmallVectorBase::U" } +%"class.llvm::SmallVectorImpl" = type { %"class.llvm::SmallVectorTemplateBase" } +%"class.llvm::SmallVectorTemplateBase" = type { %"class.llvm::SmallVectorTemplateCommon" } +%"class.llvm::SmallVectorTemplateCommon" = type { %"class.llvm::SmallVectorBase" } +%"union.llvm::SmallVectorBase::U" = type { x86_fp80 } + +define void @_ZNK5clang6driver7ArgList20AddAllArgsTranslatedERN4llvm11SmallVectorIPKcLj16EEENS0_12OptSpecifierES5_b(i1 zeroext %Joined) nounwind align 2 { +entry: + br i1 undef, label %entry.split.us, label %entry.entry.split_crit_edge + +entry.entry.split_crit_edge: ; preds = %entry + br label %entry.split + +entry.split.us: ; preds = %entry + br label %for.cond.i14.us + +for.cond.i14.us: ; preds = %for.inc.i38.us, %entry.split.us + br i1 true, label %for.cond.i50.us-lcssa.us, label %if.end.i23.us + +for.inc.i38.us: ; preds = %if.end.i23.us + br label %for.cond.i14.us + +if.end.i23.us: ; preds = %for.cond.i14.us + br i1 true, label %for.cond.i50.us-lcssa.us, label %for.inc.i38.us + +for.cond.i50.us-lcssa.us: ; preds = %if.end.i23.us, %for.cond.i14.us + br label %for.cond.i50 + +entry.split: ; preds = %entry.entry.split_crit_edge + br label %for.cond.i14 + +for.cond.i14: ; preds = %for.inc.i38, %entry.split + br i1 undef, label %for.cond.i50.us-lcssa, label %if.end.i23 + +if.end.i23: ; preds = %for.cond.i14 + br i1 undef, label %for.cond.i50.us-lcssa, label %for.inc.i38 + +for.inc.i38: ; preds = %if.end.i23 + br label %for.cond.i14 + +for.cond.i50.us-lcssa: ; preds = %if.end.i23, %for.cond.i14 + br label %for.cond.i50 + +for.cond.i50: ; preds = %for.cond.i50.us-lcssa, %for.cond.i50.us-lcssa.us + br label %for.cond + +for.cond.loopexit.us-lcssa: ; preds = %if.end.i, %for.cond.i + br label %for.cond.loopexit + +for.cond.loopexit: ; preds = %for.cond.loopexit.us-lcssa.us, %for.cond.loopexit.us-lcssa + br label %for.cond + +for.cond: ; preds = %for.cond.loopexit, %for.cond.i50 + br i1 undef, label %for.end, label %for.body + +for.body: ; preds = %for.cond + br i1 %Joined, label %if.then, label %if.else + +if.then: ; preds = %for.body + br i1 undef, label %cond.false.i.i, label %_ZN4llvm9StringRefC1EPKc.exit + +cond.false.i.i: ; preds = %if.then + unreachable + +_ZN4llvm9StringRefC1EPKc.exit: ; preds = %if.then + br i1 undef, label %_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit, label %cond.false.i.i91 + +cond.false.i.i91: ; preds = %_ZN4llvm9StringRefC1EPKc.exit + unreachable + +_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit: ; preds = %_ZN4llvm9StringRefC1EPKc.exit + br i1 undef, label %cond.false.i.i.i, label %if.end13.i.i.i.i + +if.end13.i.i.i.i: ; preds = %_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit + br i1 undef, label %land.lhs.true16.i.i.i.i, label %if.end19.i.i.i.i + +land.lhs.true16.i.i.i.i: ; preds = %if.end13.i.i.i.i + br i1 undef, label %cond.false.i.i.i, label %_ZNK4llvm5Twine8isBinaryEv.exit8.i.i.i.i + +_ZNK4llvm5Twine8isBinaryEv.exit8.i.i.i.i: ; preds = %land.lhs.true16.i.i.i.i + br i1 undef, label %cond.false.i.i.i, label %if.end19.i.i.i.i + +if.end19.i.i.i.i: ; preds = %_ZNK4llvm5Twine8isBinaryEv.exit8.i.i.i.i, %if.end13.i.i.i.i + br i1 undef, label %land.lhs.true22.i.i.i.i, label %_ZN4llvmplERKNS_9StringRefEPKc.exit + +land.lhs.true22.i.i.i.i: ; preds = %if.end19.i.i.i.i + br i1 undef, label %cond.false.i.i.i, label %_ZNK4llvm5Twine8isBinaryEv.exit.i.i.i.i + +_ZNK4llvm5Twine8isBinaryEv.exit.i.i.i.i: ; preds = %land.lhs.true22.i.i.i.i + br i1 undef, label %cond.false.i.i.i, label %_ZN4llvmplERKNS_9StringRefEPKc.exit + +cond.false.i.i.i: ; preds = %_ZNK4llvm5Twine8isBinaryEv.exit.i.i.i.i, %land.lhs.true22.i.i.i.i, %_ZNK4llvm5Twine8isBinaryEv.exit8.i.i.i.i, %land.lhs.true16.i.i.i.i, %_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit + unreachable + +_ZN4llvmplERKNS_9StringRefEPKc.exit: ; preds = %_ZNK4llvm5Twine8isBinaryEv.exit.i.i.i.i, %if.end19.i.i.i.i + br i1 undef, label %Retry.i, label %if.end.i99 + +Retry.i: ; preds = %if.end.i99, %_ZN4llvmplERKNS_9StringRefEPKc.exit + br i1 undef, label %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit, label %new.notnull.i + +new.notnull.i: ; preds = %Retry.i + br label %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit + +if.end.i99: ; preds = %_ZN4llvmplERKNS_9StringRefEPKc.exit + br label %Retry.i + +_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit: ; preds = %new.notnull.i, %Retry.i + br label %for.cond.i.preheader + +if.else: ; preds = %for.body + br i1 undef, label %Retry.i108, label %if.end.i113 + +Retry.i108: ; preds = %if.end.i113, %if.else + br i1 undef, label %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit114, label %new.notnull.i110 + +new.notnull.i110: ; preds = %Retry.i108 + br label %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit114 + +if.end.i113: ; preds = %if.else + br label %Retry.i108 + +_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit114: ; preds = %new.notnull.i110, %Retry.i108 + br i1 undef, label %_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit125, label %cond.false.i.i123 + +cond.false.i.i123: ; preds = %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit114 + unreachable + +_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit125: ; preds = %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit114 + br i1 undef, label %Retry.i134, label %if.end.i139 + +Retry.i134: ; preds = %if.end.i139, %_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit125 + br i1 undef, label %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit140, label %new.notnull.i136 + +new.notnull.i136: ; preds = %Retry.i134 + br label %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit140 + +if.end.i139: ; preds = %_ZNK5clang6driver3Arg8getValueERKNS0_7ArgListEj.exit125 + br label %Retry.i134 + +_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit140: ; preds = %new.notnull.i136, %Retry.i134 + br label %for.cond.i.preheader + +for.cond.i.preheader: ; preds = %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit140, %_ZN4llvm15SmallVectorImplIPKcE9push_backERKS2_.exit + br i1 undef, label %for.cond.i.preheader.split.us, label %for.cond.i.preheader.for.cond.i.preheader.split_crit_edge + +for.cond.i.preheader.for.cond.i.preheader.split_crit_edge: ; preds = %for.cond.i.preheader + br label %for.cond.i.preheader.split + +for.cond.i.preheader.split.us: ; preds = %for.cond.i.preheader + br label %for.cond.i.us + +for.cond.i.us: ; preds = %if.end.i.us, %for.cond.i.preheader.split.us + br i1 true, label %for.cond.loopexit.us-lcssa.us, label %if.end.i.us + +if.end.i.us: ; preds = %for.cond.i.us + br i1 true, label %for.cond.loopexit.us-lcssa.us, label %for.cond.i.us + +for.cond.loopexit.us-lcssa.us: ; preds = %if.end.i.us, %for.cond.i.us + %tmp178218.us.lcssa = phi %"class.clang::driver::Arg"** [ undef, %if.end.i.us ], [ undef, %for.cond.i.us ] + br label %for.cond.loopexit + +for.cond.i.preheader.split: ; preds = %for.cond.i.preheader.for.cond.i.preheader.split_crit_edge + br label %for.cond.i + +for.cond.i: ; preds = %if.end.i, %for.cond.i.preheader.split + br i1 undef, label %for.cond.loopexit.us-lcssa, label %if.end.i + +if.end.i: ; preds = %for.cond.i + br i1 undef, label %for.cond.loopexit.us-lcssa, label %for.cond.i + +for.end: ; preds = %for.cond + ret void +} diff --git a/test/Transforms/LoopIdiom/memset_noidiom.ll b/test/Transforms/LoopIdiom/memset_noidiom.ll new file mode 100644 index 0000000..168eb95 --- /dev/null +++ b/test/Transforms/LoopIdiom/memset_noidiom.ll @@ -0,0 +1,30 @@ +; RUN: opt -loop-idiom < %s -S | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" + +; CHECK: @memset +; CHECK-NOT: llvm.memset +define i8* @memset(i8* %b, i32 %c, i64 %len) nounwind uwtable ssp { +entry: + %cmp1 = icmp ult i64 0, %len + br i1 %cmp1, label %for.body.lr.ph, label %for.end + +for.body.lr.ph: ; preds = %entry + %conv6 = trunc i32 %c to i8 + br label %for.body + +for.body: ; preds = %for.body.lr.ph, %for.body + %indvar = phi i64 [ 0, %for.body.lr.ph ], [ %indvar.next, %for.body ] + %p.02 = getelementptr i8* %b, i64 %indvar + store i8 %conv6, i8* %p.02, align 1 + %indvar.next = add i64 %indvar, 1 + %exitcond = icmp ne i64 %indvar.next, %len + br i1 %exitcond, label %for.body, label %for.cond.for.end_crit_edge + +for.cond.for.end_crit_edge: ; preds = %for.body + br label %for.end + +for.end: ; preds = %for.cond.for.end_crit_edge, %entry + ret i8* %b +} + diff --git a/test/Transforms/LoopRotate/PhiRename-1.ll b/test/Transforms/LoopRotate/PhiRename-1.ll index 74426a8..9cb55b4 100644 --- a/test/Transforms/LoopRotate/PhiRename-1.ll +++ b/test/Transforms/LoopRotate/PhiRename-1.ll @@ -33,7 +33,6 @@ entry: %c = alloca i32, align 4 ; <i32*> [#uses=4] %l = alloca %struct.list*, align 4 ; <%struct.list**> [#uses=5] %op = alloca %struct.operator*, align 4 ; <%struct.operator**> [#uses=3] - "alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] store i32 %arity, i32* %arity_addr store i32 0, i32* %c %tmp1 = load %struct.list** @operators ; <%struct.list*> [#uses=1] diff --git a/test/Transforms/LoopRotate/crash.ll b/test/Transforms/LoopRotate/crash.ll index 16a6868..954b834 100644 --- a/test/Transforms/LoopRotate/crash.ll +++ b/test/Transforms/LoopRotate/crash.ll @@ -113,7 +113,7 @@ bb116: ; preds = %bb131, %entry br i1 false, label %bb141, label %bb131 bb131: ; preds = %bb116 - %mrv_gr125 = getresult %struct.NSRange %tmp123, 1 ; <i64> [#uses=0] + %mrv_gr125 = extractvalue %struct.NSRange %tmp123, 1 ; <i64> [#uses=0] br label %bb116 bb141: ; preds = %bb116 diff --git a/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll b/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll index e73fff1..e7d0f84 100644 --- a/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll +++ b/test/Transforms/LoopSimplify/2007-10-28-InvokeCrash.ll @@ -278,7 +278,7 @@ invcont: ; preds = %bb_main br label %bb_main invcont.fragment: ; preds = %bb_main - invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* null sret , %struct.Fibonacci* %this_this, i32 %n_i_n_i ) + invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* sret null , %struct.Fibonacci* %this_this, i32 %n_i_n_i ) to label %invcont14 unwind label %meshBB37 invcont.unwind10_crit_edge: ; preds = %bb_main @@ -304,7 +304,7 @@ invcont14: ; preds = %invcont.fragment, %bb_main br label %bb_main invcont14.normaldest: ; No predecessors! - invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* null noalias ) + invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* noalias null ) to label %invcont15 unwind label %meshBB345 ; <%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*>:0 [#uses=0] invcont14.unwind10_crit_edge: ; preds = %bb_main @@ -372,7 +372,7 @@ invcont.cond_next_crit_edge: ; preds = %bb_main br label %bb_main cond_true: ; preds = %bb_main - invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* null sret , %struct.Fibonacci* %this_this, i32 %n_i_n_i ) + invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* sret null , %struct.Fibonacci* %this_this, i32 %n_i_n_i ) to label %meshBB323 unwind label %cond_true.unwind_crit_edge cond_true.unwind_crit_edge: ; preds = %cond_true, %bb_main @@ -385,7 +385,7 @@ invcont12: ; preds = %bb_main br label %bb_main invcont12.fragment: ; preds = %bb_main - invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* null noalias ) + invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* noalias null ) to label %meshBB30 unwind label %meshBB337 ; <%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*>:1 [#uses=0] invcont12.unwind_crit_edge: ; preds = %bb_main @@ -467,7 +467,7 @@ invcont30.unwind_crit_edge.unwinddest: ; No predecessors! br label %bb_main invcont33: ; preds = %bb_main - invoke void @_ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* null sret , %"struct.std::ostringstream"* null ) + invoke void @_ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* sret null , %"struct.std::ostringstream"* null ) to label %invcont36 unwind label %invcont33.unwind_crit_edge invcont33.unwind_crit_edge: ; preds = %invcont33, %bb_main diff --git a/test/Transforms/LowerExpectIntrinsic/basic.ll b/test/Transforms/LowerExpectIntrinsic/basic.ll new file mode 100644 index 0000000..c00127e --- /dev/null +++ b/test/Transforms/LowerExpectIntrinsic/basic.ll @@ -0,0 +1,251 @@ +; RUN: opt -lower-expect -strip-dead-prototypes -S -o - < %s | FileCheck %s + +; CHECK: @test1 +define i32 @test1(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %cmp = icmp sgt i32 %tmp, 1 + %conv = zext i1 %cmp to i32 + %conv1 = sext i32 %conv to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv1, i64 1) + %tobool = icmp ne i64 %expval, 0 +; CHECK: !prof !0 +; CHECK-NOT: @llvm.expect + br i1 %tobool, label %if.then, label %if.end + +if.then: ; preds = %entry + %call = call i32 (...)* @f() + store i32 %call, i32* %retval + br label %return + +if.end: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %if.end, %if.then + %0 = load i32* %retval + ret i32 %0 +} + +declare i64 @llvm.expect.i64(i64, i64) nounwind readnone + +declare i32 @f(...) + +; CHECK: @test2 +define i32 @test2(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %conv = sext i32 %tmp to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1) + %tobool = icmp ne i64 %expval, 0 +; CHECK: !prof !0 +; CHECK-NOT: @llvm.expect + br i1 %tobool, label %if.then, label %if.end + +if.then: ; preds = %entry + %call = call i32 (...)* @f() + store i32 %call, i32* %retval + br label %return + +if.end: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %if.end, %if.then + %0 = load i32* %retval + ret i32 %0 +} + +; CHECK: @test3 +define i32 @test3(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %tobool = icmp ne i32 %tmp, 0 + %lnot = xor i1 %tobool, true + %lnot.ext = zext i1 %lnot to i32 + %conv = sext i32 %lnot.ext to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1) + %tobool1 = icmp ne i64 %expval, 0 +; CHECK: !prof !0 +; CHECK-NOT: @llvm.expect + br i1 %tobool1, label %if.then, label %if.end + +if.then: ; preds = %entry + %call = call i32 (...)* @f() + store i32 %call, i32* %retval + br label %return + +if.end: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %if.end, %if.then + %0 = load i32* %retval + ret i32 %0 +} + +; CHECK: @test4 +define i32 @test4(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %tobool = icmp ne i32 %tmp, 0 + %lnot = xor i1 %tobool, true + %lnot1 = xor i1 %lnot, true + %lnot.ext = zext i1 %lnot1 to i32 + %conv = sext i32 %lnot.ext to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1) + %tobool2 = icmp ne i64 %expval, 0 +; CHECK: !prof !0 +; CHECK-NOT: @llvm.expect + br i1 %tobool2, label %if.then, label %if.end + +if.then: ; preds = %entry + %call = call i32 (...)* @f() + store i32 %call, i32* %retval + br label %return + +if.end: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %if.end, %if.then + %0 = load i32* %retval + ret i32 %0 +} + +; CHECK: @test5 +define i32 @test5(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %cmp = icmp slt i32 %tmp, 0 + %conv = zext i1 %cmp to i32 + %conv1 = sext i32 %conv to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv1, i64 0) + %tobool = icmp ne i64 %expval, 0 +; CHECK: !prof !1 +; CHECK-NOT: @llvm.expect + br i1 %tobool, label %if.then, label %if.end + +if.then: ; preds = %entry + %call = call i32 (...)* @f() + store i32 %call, i32* %retval + br label %return + +if.end: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %if.end, %if.then + %0 = load i32* %retval + ret i32 %0 +} + +; CHECK: @test6 +define i32 @test6(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %conv = sext i32 %tmp to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1) +; CHECK: !prof !2 +; CHECK-NOT: @llvm.expect + switch i64 %expval, label %sw.epilog [ + i64 1, label %sw.bb + i64 2, label %sw.bb + ] + +sw.bb: ; preds = %entry, %entry + store i32 0, i32* %retval + br label %return + +sw.epilog: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %sw.epilog, %sw.bb + %0 = load i32* %retval + ret i32 %0 +} + +; CHECK: @test7 +define i32 @test7(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %conv = sext i32 %tmp to i64 + %expval = call i64 @llvm.expect.i64(i64 %conv, i64 1) +; CHECK: !prof !3 +; CHECK-NOT: @llvm.expect + switch i64 %expval, label %sw.epilog [ + i64 2, label %sw.bb + i64 3, label %sw.bb + ] + +sw.bb: ; preds = %entry, %entry + %tmp1 = load i32* %x.addr, align 4 + store i32 %tmp1, i32* %retval + br label %return + +sw.epilog: ; preds = %entry + store i32 0, i32* %retval + br label %return + +return: ; preds = %sw.epilog, %sw.bb + %0 = load i32* %retval + ret i32 %0 +} + +; CHECK: @test8 +define i32 @test8(i32 %x) nounwind uwtable ssp { +entry: + %retval = alloca i32, align 4 + %x.addr = alloca i32, align 4 + store i32 %x, i32* %x.addr, align 4 + %tmp = load i32* %x.addr, align 4 + %cmp = icmp sgt i32 %tmp, 1 + %conv = zext i1 %cmp to i32 + %expval = call i32 @llvm.expect.i32(i32 %conv, i32 1) + %tobool = icmp ne i32 %expval, 0 +; CHECK: !prof !0 +; CHECK-NOT: @llvm.expect + br i1 %tobool, label %if.then, label %if.end + +if.then: ; preds = %entry + %call = call i32 (...)* @f() + store i32 %call, i32* %retval + br label %return + +if.end: ; preds = %entry + store i32 1, i32* %retval + br label %return + +return: ; preds = %if.end, %if.then + %0 = load i32* %retval + ret i32 %0 +} + +declare i32 @llvm.expect.i32(i32, i32) nounwind readnone + +; CHECK: !0 = metadata !{metadata !"branch_weights", i32 64, i32 4} +; CHECK: !1 = metadata !{metadata !"branch_weights", i32 4, i32 64} +; CHECK: !2 = metadata !{metadata !"branch_weights", i32 4, i32 64, i32 4} +; CHECK: !3 = metadata !{metadata !"branch_weights", i32 64, i32 4, i32 4} diff --git a/test/Transforms/LowerExpectIntrinsic/dg.exp b/test/Transforms/LowerExpectIntrinsic/dg.exp new file mode 100644 index 0000000..f200589 --- /dev/null +++ b/test/Transforms/LowerExpectIntrinsic/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] diff --git a/test/Transforms/LowerSetJmp/simpletest.ll b/test/Transforms/LowerSetJmp/simpletest.ll index 1430dff..dece840 100644 --- a/test/Transforms/LowerSetJmp/simpletest.ll +++ b/test/Transforms/LowerSetJmp/simpletest.ll @@ -1,6 +1,5 @@ ; RUN: opt < %s -lowersetjmp -S | grep invoke - %JmpBuf = type i32 @.str_1 = internal constant [13 x i8] c"returned %d\0A\00" ; <[13 x i8]*> [#uses=1] declare void @llvm.longjmp(i32*, i32) diff --git a/test/Transforms/Mem2Reg/ignore-lifetime.ll b/test/Transforms/Mem2Reg/ignore-lifetime.ll new file mode 100644 index 0000000..5e4f9bf --- /dev/null +++ b/test/Transforms/Mem2Reg/ignore-lifetime.ll @@ -0,0 +1,26 @@ +; RUN: opt -mem2reg -S -o - < %s | FileCheck %s + +declare void @llvm.lifetime.start(i64 %size, i8* nocapture %ptr) +declare void @llvm.lifetime.end(i64 %size, i8* nocapture %ptr) + +define void @test1() { +; CHECK: test1 +; CHECK-NOT: alloca + %A = alloca i32 + %B = bitcast i32* %A to i8* + call void @llvm.lifetime.start(i64 2, i8* %B) + store i32 1, i32* %A + call void @llvm.lifetime.end(i64 2, i8* %B) + ret void +} + +define void @test2() { +; CHECK: test2 +; CHECK-NOT: alloca + %A = alloca {i8, i16} + %B = getelementptr {i8, i16}* %A, i32 0, i32 0 + call void @llvm.lifetime.start(i64 2, i8* %B) + store {i8, i16} zeroinitializer, {i8, i16}* %A + call void @llvm.lifetime.end(i64 2, i8* %B) + ret void +} diff --git a/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll b/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll index 9f1e280..b95ad91 100644 --- a/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll +++ b/test/Transforms/MemCpyOpt/2008-02-24-MultipleUseofSRet.ll @@ -4,31 +4,33 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-pc-linux-gnu" -define internal fastcc void @initialize({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind { +%0 = type { x86_fp80, x86_fp80 } + +define internal fastcc void @initialize(%0* noalias sret %agg.result) nounwind { entry: - %agg.result.03 = getelementptr { x86_fp80, x86_fp80 }* %agg.result, i32 0, i32 0 ; <x86_fp80*> [#uses=1] - store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.03 - %agg.result.15 = getelementptr { x86_fp80, x86_fp80 }* %agg.result, i32 0, i32 1 ; <x86_fp80*> [#uses=1] - store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.15 - ret void + %agg.result.03 = getelementptr %0* %agg.result, i32 0, i32 0 + store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.03 + %agg.result.15 = getelementptr %0* %agg.result, i32 0, i32 1 + store x86_fp80 0xK00000000000000000000, x86_fp80* %agg.result.15 + ret void } -declare fastcc x86_fp80 @passed_uninitialized({ x86_fp80, x86_fp80 }* %x) nounwind +declare fastcc x86_fp80 @passed_uninitialized(%0*) nounwind -define fastcc void @badly_optimized() nounwind { +define fastcc void @badly_optimized() nounwind { entry: - %z = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=2] - %tmp = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=2] - %memtmp = alloca { x86_fp80, x86_fp80 }, align 8 ; <{ x86_fp80, x86_fp80 }*> [#uses=2] - call fastcc void @initialize( { x86_fp80, x86_fp80 }* noalias sret %memtmp ) - %tmp1 = bitcast { x86_fp80, x86_fp80 }* %tmp to i8* ; <i8*> [#uses=1] - %memtmp2 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp1, i8* %memtmp2, i32 24, i32 8 ) - %z3 = bitcast { x86_fp80, x86_fp80 }* %z to i8* ; <i8*> [#uses=1] - %tmp4 = bitcast { x86_fp80, x86_fp80 }* %tmp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %z3, i8* %tmp4, i32 24, i32 8 ) - %tmp5 = call fastcc x86_fp80 @passed_uninitialized( { x86_fp80, x86_fp80 }* %z ) ; <x86_fp80> [#uses=0] - ret void + %z = alloca %0 + %tmp = alloca %0 + %memtmp = alloca %0, align 8 + call fastcc void @initialize(%0* noalias sret %memtmp) + %tmp1 = bitcast %0* %tmp to i8* + %memtmp2 = bitcast %0* %memtmp to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp1, i8* %memtmp2, i32 24, i32 8, i1 false) + %z3 = bitcast %0* %z to i8* + %tmp4 = bitcast %0* %tmp to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %z3, i8* %tmp4, i32 24, i32 8, i1 false) + %tmp5 = call fastcc x86_fp80 @passed_uninitialized(%0* %z) + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll b/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll index 418761e..24cf576 100644 --- a/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll +++ b/test/Transforms/MemCpyOpt/2008-03-13-ReturnSlotBitcast.ll @@ -1,20 +1,22 @@ ; RUN: opt < %s -basicaa -memcpyopt -S | not grep {call.*memcpy.} target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64" - %a = type { i32 } - %b = type { float } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +%a = type { i32 } +%b = type { float } + declare void @g(%a*) define float @f() { entry: - %a_var = alloca %a - %b_var = alloca %b - call void @g(%a *%a_var) - %a_i8 = bitcast %a* %a_var to i8* - %b_i8 = bitcast %b* %b_var to i8* - call void @llvm.memcpy.i32(i8* %b_i8, i8* %a_i8, i32 4, i32 4) - %tmp1 = getelementptr %b* %b_var, i32 0, i32 0 - %tmp2 = load float* %tmp1 - ret float %tmp2 + %a_var = alloca %a + %b_var = alloca %b + call void @g(%a* %a_var) + %a_i8 = bitcast %a* %a_var to i8* + %b_i8 = bitcast %b* %b_var to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %b_i8, i8* %a_i8, i32 4, i32 4, i1 false) + %tmp1 = getelementptr %b* %b_var, i32 0, i32 0 + %tmp2 = load float* %tmp1 + ret float %tmp2 } + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/MemCpyOpt/memcpy.ll b/test/Transforms/MemCpyOpt/memcpy.ll index 5c6a94c..71d4d4e 100644 --- a/test/Transforms/MemCpyOpt/memcpy.ll +++ b/test/Transforms/MemCpyOpt/memcpy.ll @@ -3,17 +3,21 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin9" -define void @test1({ x86_fp80, x86_fp80 }* sret %agg.result, x86_fp80 %z.0, x86_fp80 %z.1) nounwind { +%0 = type { x86_fp80, x86_fp80 } +%1 = type { i32, i32 } + +define void @test1(%0* sret %agg.result, x86_fp80 %z.0, x86_fp80 %z.1) nounwind { entry: - %tmp2 = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=1] - %memtmp = alloca { x86_fp80, x86_fp80 }, align 16 ; <{ x86_fp80, x86_fp80 }*> [#uses=2] - %tmp5 = fsub x86_fp80 0xK80000000000000000000, %z.1 ; <x86_fp80> [#uses=1] - call void @ccoshl( { x86_fp80, x86_fp80 }* sret %memtmp, x86_fp80 %tmp5, x86_fp80 %z.0 ) nounwind - %tmp219 = bitcast { x86_fp80, x86_fp80 }* %tmp2 to i8* ; <i8*> [#uses=2] - %memtmp20 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp219, i8* %memtmp20, i32 32, i32 16 ) - %agg.result21 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %agg.result21, i8* %tmp219, i32 32, i32 16 ) + %tmp2 = alloca %0 + %memtmp = alloca %0, align 16 + %tmp5 = fsub x86_fp80 0xK80000000000000000000, %z.1 + call void @ccoshl(%0* sret %memtmp, x86_fp80 %tmp5, x86_fp80 %z.0) nounwind + %tmp219 = bitcast %0* %tmp2 to i8* + %memtmp20 = bitcast %0* %memtmp to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp219, i8* %memtmp20, i32 32, i32 16, i1 false) + %agg.result21 = bitcast %0* %agg.result to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %agg.result21, i8* %tmp219, i32 32, i32 16, i1 false) + ret void ; Check that one of the memcpy's are removed. ;; FIXME: PR 8643 We should be able to eliminate the last memcpy here. @@ -23,22 +27,19 @@ entry: ; CHECK: call void @llvm.memcpy ; CHECK-NOT: llvm.memcpy ; CHECK: ret void - ret void } -declare void @ccoshl({ x86_fp80, x86_fp80 }* sret , x86_fp80, x86_fp80) nounwind - -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @ccoshl(%0* sret , x86_fp80, x86_fp80) nounwind ; The intermediate alloca and one of the memcpy's should be eliminated, the ; other should be related with a memmove. define void @test2(i8* %P, i8* %Q) nounwind { - %memtmp = alloca { x86_fp80, x86_fp80 }, align 16 - %R = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* - call void @llvm.memcpy.i32( i8* %R, i8* %P, i32 32, i32 16 ) - call void @llvm.memcpy.i32( i8* %Q, i8* %R, i32 32, i32 16 ) - ret void + %memtmp = alloca %0, align 16 + %R = bitcast %0* %memtmp to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %R, i8* %P, i32 32, i32 16, i1 false) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %Q, i8* %R, i32 32, i32 16, i1 false) + ret void ; CHECK: @test2 ; CHECK-NEXT: call void @llvm.memmove{{.*}}(i8* %Q, i8* %P @@ -48,15 +49,15 @@ define void @test2(i8* %P, i8* %Q) nounwind { -@x = external global { x86_fp80, x86_fp80 } +@x = external global %0 -define void @test3({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind { - %x.0 = alloca { x86_fp80, x86_fp80 } - %x.01 = bitcast { x86_fp80, x86_fp80 }* %x.0 to i8* - call void @llvm.memcpy.i32( i8* %x.01, i8* bitcast ({ x86_fp80, x86_fp80 }* @x to i8*), i32 32, i32 16 ) - %agg.result2 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* - call void @llvm.memcpy.i32( i8* %agg.result2, i8* %x.01, i32 32, i32 16 ) - ret void +define void @test3(%0* noalias sret %agg.result) nounwind { + %x.0 = alloca %0 + %x.01 = bitcast %0* %x.0 to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %x.01, i8* bitcast (%0* @x to i8*), i32 32, i32 16, i1 false) + %agg.result2 = bitcast %0* %agg.result to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %agg.result2, i8* %x.01, i32 32, i32 16, i1 false) + ret void ; CHECK: @test3 ; CHECK-NEXT: %agg.result2 = bitcast ; CHECK-NEXT: call void @llvm.memcpy @@ -66,10 +67,10 @@ define void @test3({ x86_fp80, x86_fp80 }* noalias sret %agg.result) nounwind { ; PR8644 define void @test4(i8 *%P) { - %A = alloca {i32, i32} - %a = bitcast {i32, i32}* %A to i8* + %A = alloca %1 + %a = bitcast %1* %A to i8* call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* %P, i64 8, i32 4, i1 false) - call void @test4a(i8* byval align 1 %a) + call void @test4a(i8* byval align 1 %a) ret void ; CHECK: @test4 ; CHECK-NEXT: call void @test4a( @@ -84,7 +85,6 @@ declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, declare void @test5a(%struct.S* byval align 16) nounwind ssp -declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind ; rdar://8713376 - This memcpy can't be eliminated. define i32 @test5(i32 %x) nounwind ssp { @@ -128,4 +128,5 @@ entry: declare i32 @g(%struct.p* byval align 8) +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/MemCpyOpt/memmove.ll b/test/Transforms/MemCpyOpt/memmove.ll index 8babb04..7f1667a 100644 --- a/test/Transforms/MemCpyOpt/memmove.ll +++ b/test/Transforms/MemCpyOpt/memmove.ll @@ -4,25 +4,28 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" target triple = "x86_64-apple-darwin9.0" -declare void @llvm.memmove.i64(i8* nocapture, i8* nocapture, i64, i32) nounwind +declare void @llvm.memmove.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind define i8* @test1(i8* nocapture %src) nounwind { entry: ; CHECK: @test1 ; CHECK: call void @llvm.memcpy - %call3 = malloc [13 x i8] ; <[13 x i8]*> [#uses=1] - %call3.sub = getelementptr inbounds [13 x i8]* %call3, i64 0, i64 0 ; <i8*> [#uses=2] - tail call void @llvm.memmove.i64(i8* %call3.sub, i8* %src, i64 13, i32 1) + %malloccall = tail call i8* @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (i8* getelementptr (i8* null, i32 1) to i64), i64 13) to i32)) + %call3 = bitcast i8* %malloccall to [13 x i8]* + %call3.sub = getelementptr inbounds [13 x i8]* %call3, i64 0, i64 0 + tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %call3.sub, i8* %src, i64 13, i32 1, i1 false) ret i8* %call3.sub } +declare noalias i8* @malloc(i32) + define void @test2(i8* %P) nounwind { entry: ; CHECK: @test2 ; CHECK: call void @llvm.memcpy - %add.ptr = getelementptr i8* %P, i64 16 ; <i8*> [#uses=1] - tail call void @llvm.memmove.i64(i8* %P, i8* %add.ptr, i64 16, i32 1) + %add.ptr = getelementptr i8* %P, i64 16 + tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 16, i32 1, i1 false) ret void } @@ -31,7 +34,7 @@ define void @test3(i8* %P) nounwind { entry: ; CHECK: @test3 ; CHECK: call void @llvm.memmove - %add.ptr = getelementptr i8* %P, i64 16 ; <i8*> [#uses=1] - tail call void @llvm.memmove.i64(i8* %P, i8* %add.ptr, i64 17, i32 1) + %add.ptr = getelementptr i8* %P, i64 16 + tail call void @llvm.memmove.p0i8.p0i8.i64(i8* %P, i8* %add.ptr, i64 17, i32 1, i1 false) ret void } diff --git a/test/Transforms/MemCpyOpt/sret.ll b/test/Transforms/MemCpyOpt/sret.ll index ddfd0fd..8eac7da 100644 --- a/test/Transforms/MemCpyOpt/sret.ll +++ b/test/Transforms/MemCpyOpt/sret.ll @@ -3,26 +3,28 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i686-apple-darwin9" -define void @ccosl({ x86_fp80, x86_fp80 }* noalias sret %agg.result, { x86_fp80, x86_fp80 }* byval align 8 %z) nounwind { +%0 = type { x86_fp80, x86_fp80 } + +define void @ccosl(%0* noalias sret %agg.result, %0* byval align 8 %z) nounwind { entry: - %iz = alloca { x86_fp80, x86_fp80 } ; <{ x86_fp80, x86_fp80 }*> [#uses=3] - %memtmp = alloca { x86_fp80, x86_fp80 }, align 16 ; <{ x86_fp80, x86_fp80 }*> [#uses=2] - %tmp1 = getelementptr { x86_fp80, x86_fp80 }* %z, i32 0, i32 1 ; <x86_fp80*> [#uses=1] - %tmp2 = load x86_fp80* %tmp1, align 16 ; <x86_fp80> [#uses=1] - %tmp3 = fsub x86_fp80 0xK80000000000000000000, %tmp2 ; <x86_fp80> [#uses=1] - %tmp4 = getelementptr { x86_fp80, x86_fp80 }* %iz, i32 0, i32 1 ; <x86_fp80*> [#uses=1] - %real = getelementptr { x86_fp80, x86_fp80 }* %iz, i32 0, i32 0 ; <x86_fp80*> [#uses=1] - %tmp7 = getelementptr { x86_fp80, x86_fp80 }* %z, i32 0, i32 0 ; <x86_fp80*> [#uses=1] - %tmp8 = load x86_fp80* %tmp7, align 16 ; <x86_fp80> [#uses=1] - store x86_fp80 %tmp3, x86_fp80* %real, align 16 - store x86_fp80 %tmp8, x86_fp80* %tmp4, align 16 - call void @ccoshl( { x86_fp80, x86_fp80 }* noalias sret %memtmp, { x86_fp80, x86_fp80 }* byval align 8 %iz ) nounwind - %memtmp14 = bitcast { x86_fp80, x86_fp80 }* %memtmp to i8* ; <i8*> [#uses=1] - %agg.result15 = bitcast { x86_fp80, x86_fp80 }* %agg.result to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %agg.result15, i8* %memtmp14, i32 32, i32 16 ) - ret void + %iz = alloca %0 + %memtmp = alloca %0, align 16 + %tmp1 = getelementptr %0* %z, i32 0, i32 1 + %tmp2 = load x86_fp80* %tmp1, align 16 + %tmp3 = fsub x86_fp80 0xK80000000000000000000, %tmp2 + %tmp4 = getelementptr %0* %iz, i32 0, i32 1 + %real = getelementptr %0* %iz, i32 0, i32 0 + %tmp7 = getelementptr %0* %z, i32 0, i32 0 + %tmp8 = load x86_fp80* %tmp7, align 16 + store x86_fp80 %tmp3, x86_fp80* %real, align 16 + store x86_fp80 %tmp8, x86_fp80* %tmp4, align 16 + call void @ccoshl(%0* noalias sret %memtmp, %0* byval align 8 %iz) nounwind + %memtmp14 = bitcast %0* %memtmp to i8* + %agg.result15 = bitcast %0* %agg.result to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %agg.result15, i8* %memtmp14, i32 32, i32 16, i1 false) + ret void } -declare void @ccoshl({ x86_fp80, x86_fp80 }* noalias sret , { x86_fp80, x86_fp80 }* byval ) nounwind +declare void @ccoshl(%0* noalias sret, %0* byval) nounwind -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ObjCARC/basic.ll b/test/Transforms/ObjCARC/basic.ll new file mode 100644 index 0000000..a6bbf86 --- /dev/null +++ b/test/Transforms/ObjCARC/basic.ll @@ -0,0 +1,1898 @@ +; RUN: opt -objc-arc -S < %s | FileCheck %s + +target datalayout = "e-p:64:64:64" + +declare i8* @objc_retain(i8*) +declare void @objc_release(i8*) +declare i8* @objc_autorelease(i8*) +declare void @objc_autoreleasePoolPop(i8*) +declare void @objc_autoreleasePoolPush() +declare i8* @objc_retainBlock(i8*) + +declare i8* @objc_retainedObject(i8*) +declare i8* @objc_unretainedObject(i8*) +declare i8* @objc_unretainedPointer(i8*) + +declare void @use_pointer(i8*) +declare void @callee() +declare void @callee_fnptr(void ()*) +declare void @invokee() +declare i8* @returner() + +declare void @llvm.dbg.value(metadata, i64, metadata) + +declare i8* @objc_msgSend(i8*, i8*, ...) + +; Simple retain+release pair deletion, with some intervening control +; flow and harmless instructions. + +; CHECK: define void @test0( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test0(i32* %x, i1 %p) nounwind { +entry: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + br i1 %p, label %t, label %f + +t: + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + br label %return + +f: + store i32 7, i32* %x + br label %return + +return: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void +} + +; Like test0 but the release isn't always executed when the retain is, +; so the optimization is not safe. + +; TODO: Make the objc_release's argument be %0. + +; CHECK: define void @test1( +; CHECK: @objc_retain(i8* %a) +; CHECK: @objc_release +; CHECK: } +define void @test1(i32* %x, i1 %p, i1 %q) nounwind { +entry: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + br i1 %p, label %t, label %f + +t: + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + br label %return + +f: + store i32 7, i32* %x + call void @callee() + br i1 %q, label %return, label %alt_return + +return: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void + +alt_return: + ret void +} + +; Like test0 but the pointer is passed to an intervening call, +; so the optimization is not safe. + +; CHECK: define void @test2( +; CHECK: @objc_retain(i8* %a) +; CHECK: @objc_release +; CHECK: } +define void @test2(i32* %x, i1 %p) nounwind { +entry: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + br i1 %p, label %t, label %f + +t: + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + br label %return + +f: + store i32 7, i32* %x + call void @use_pointer(i8* %0) + %d = bitcast i32* %x to float* + store float 3.0, float* %d + br label %return + +return: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void +} + +; Like test0 but the release is in a loop, +; so the optimization is not safe. + +; TODO: For now, assume this can't happen. + +; CHECK: define void @test3( +; TODO: @objc_retain(i8* %a) +; TODO: @objc_release +; CHECK: } +define void @test3(i32* %x, i1* %q) nounwind { +entry: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + br label %loop + +loop: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + %j = volatile load i1* %q + br i1 %j, label %loop, label %return + +return: + ret void +} + +; TODO: For now, assume this can't happen. + +; Like test0 but the retain is in a loop, +; so the optimization is not safe. + +; CHECK: define void @test4( +; TODO: @objc_retain(i8* %a) +; TODO: @objc_release +; CHECK: } +define void @test4(i32* %x, i1* %q) nounwind { +entry: + br label %loop + +loop: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + %j = volatile load i1* %q + br i1 %j, label %loop, label %return + +return: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void +} + +; Like test0 but the pointer is conditionally passed to an intervening call, +; so the optimization is not safe. + +; CHECK: define void @test5( +; CHECK: @objc_retain(i8* +; CHECK: @objc_release +; CHECK: } +define void @test5(i32* %x, i1 %q, i8* %y) nounwind { +entry: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + %s = select i1 %q, i8* %y, i8* %0 + call void @use_pointer(i8* %s) + store i32 7, i32* %x + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void +} + +; retain+release pair deletion, where the release happens on two different +; flow paths. + +; CHECK: define void @test6( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test6(i32* %x, i1 %p) nounwind { +entry: + %a = bitcast i32* %x to i8* + %0 = call i8* @objc_retain(i8* %a) nounwind + br i1 %p, label %t, label %f + +t: + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + %ct = bitcast i32* %x to i8* + call void @objc_release(i8* %ct) nounwind + br label %return + +f: + store i32 7, i32* %x + call void @callee() + %cf = bitcast i32* %x to i8* + call void @objc_release(i8* %cf) nounwind + br label %return + +return: + ret void +} + +; retain+release pair deletion, where the retain happens on two different +; flow paths. + +; CHECK: define void @test7( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test7(i32* %x, i1 %p) nounwind { +entry: + %a = bitcast i32* %x to i8* + br i1 %p, label %t, label %f + +t: + %0 = call i8* @objc_retain(i8* %a) nounwind + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + br label %return + +f: + %1 = call i8* @objc_retain(i8* %a) nounwind + store i32 7, i32* %x + call void @callee() + br label %return + +return: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void +} + +; Like test7, but there's a retain/retainBlock mismatch. Don't delete! + +; CHECK: define void @test7b +; CHECK: t: +; CHECK: call i8* @objc_retainBlock +; CHECK: f: +; CHECK: call i8* @objc_retain +; CHECK: return: +; CHECK: call void @objc_release +; CHECK: } +define void @test7b(i32* %x, i1 %p) nounwind { +entry: + %a = bitcast i32* %x to i8* + br i1 %p, label %t, label %f + +t: + %0 = call i8* @objc_retainBlock(i8* %a) nounwind + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + br label %return + +f: + %1 = call i8* @objc_retain(i8* %a) nounwind + store i32 7, i32* %x + call void @callee() + br label %return + +return: + %c = bitcast i32* %x to i8* + call void @objc_release(i8* %c) nounwind + ret void +} + +; retain+release pair deletion, where the retain and release both happen on +; different flow paths. Wild! + +; CHECK: define void @test8( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test8(i32* %x, i1 %p, i1 %q) nounwind { +entry: + %a = bitcast i32* %x to i8* + br i1 %p, label %t, label %f + +t: + %0 = call i8* @objc_retain(i8* %a) nounwind + store i8 3, i8* %a + %b = bitcast i32* %x to float* + store float 2.0, float* %b + br label %mid + +f: + %1 = call i8* @objc_retain(i8* %a) nounwind + store i32 7, i32* %x + br label %mid + +mid: + br i1 %q, label %u, label %g + +u: + call void @callee() + %cu = bitcast i32* %x to i8* + call void @objc_release(i8* %cu) nounwind + br label %return + +g: + %cg = bitcast i32* %x to i8* + call void @objc_release(i8* %cg) nounwind + br label %return + +return: + ret void +} + +; Trivial retain+release pair deletion. + +; CHECK: define void @test9( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test9(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call void @objc_release(i8* %0) nounwind + ret void +} + +; Retain+release pair, but on an unknown pointer relationship. Don't delete! + +; CHECK: define void @test9b +; CHECK: @objc_retain(i8* %x) +; CHECK: @objc_release(i8* %s) +; CHECK: } +define void @test9b(i8* %x, i1 %j, i8* %p) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + %s = select i1 %j, i8* %x, i8* %p + call void @objc_release(i8* %s) nounwind + ret void +} + +; Trivial retain+release pair with intervening calls - don't delete! + +; CHECK: define void @test10( +; CHECK: @objc_retain(i8* %x) +; CHECK: @use_pointer +; CHECK: @objc_release +; CHECK: } +define void @test10(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + call void @objc_release(i8* %0) nounwind + ret void +} + +; Trivial retain+autoreleaserelease pair. Don't delete! +; Also, add a tail keyword, since objc_retain can never be passed +; a stack argument. + +; CHECK: define void @test11( +; CHECK: tail call i8* @objc_retain(i8* %x) nounwind +; CHECK: tail call i8* @objc_autorelease(i8* %0) nounwind +; CHECK: } +define void @test11(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_autorelease(i8* %0) nounwind + call void @use_pointer(i8* %x) + ret void +} + +; Same as test11 but with no use_pointer call. Delete the pair! + +; CHECK: define void @test11a( +; CHECK: entry: +; CHECK-NEXT: ret void +; CHECK: } +define void @test11a(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_autorelease(i8* %0) nounwind + ret void +} + +; Same as test11 but the value is returned. Do an RV optimization. + +; CHECK: define i8* @test11b( +; CHECK: tail call i8* @objc_retain(i8* %x) nounwind +; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind +; CHECK: } +define i8* @test11b(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_autorelease(i8* %0) nounwind + ret i8* %x +} + +; Trivial retain,release pair with intervening call, but it's dominated +; by another retain - delete! + +; CHECK: define void @test12( +; CHECK-NEXT: entry: +; CHECK-NEXT: @objc_retain(i8* %x) +; CHECK-NOT: @objc_ +; CHECK: } +define void @test12(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + call void @objc_release(i8* %x) nounwind + ret void +} + +; Trivial retain,autorelease pair. Don't delete! + +; CHECK: define void @test13( +; CHECK: tail call i8* @objc_retain(i8* %x) nounwind +; CHECK: tail call i8* @objc_retain(i8* %x) nounwind +; CHECK: @use_pointer(i8* %x) +; CHECK: tail call i8* @objc_autorelease(i8* %x) nounwind +; CHECK: } +define void @test13(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call i8* @objc_autorelease(i8* %x) nounwind + ret void +} + +; Delete the retain+release pair. + +; CHECK: define void @test13b +; CHECK-NEXT: entry: +; CHECK-NEXT: @objc_retain(i8* %x) +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: ret void +define void @test13b(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + call void @objc_release(i8* %x) nounwind + ret void +} + +; Don't delete the retain+release pair because there's an +; autoreleasePoolPop in the way. + +; CHECK: define void @test13c +; CHECK: @objc_retain(i8* %x) +; CHECK: @objc_autoreleasePoolPop +; CHECK: @objc_retain(i8* %x) +; CHECK: @use_pointer +; CHECK: @objc_release +; CHECK: } +define void @test13c(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call void @objc_autoreleasePoolPop(i8* undef) + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + call void @objc_release(i8* %x) nounwind + ret void +} + +; Like test13c, but there's an autoreleasePoolPush in the way, but that +; doesn't matter. + +; CHECK: define void @test13d +; CHECK-NEXT: entry: +; CHECK-NEXT: @objc_retain(i8* %x) +; CHECK-NEXT: @objc_autoreleasePoolPush +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: ret void +define void @test13d(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call void @objc_autoreleasePoolPush() + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + call void @objc_release(i8* %x) nounwind + ret void +} + +; Trivial retain,release pair with intervening call, but it's post-dominated +; by another release - delete! + +; CHECK: define void @test14( +; CHECK-NEXT: entry: +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: @objc_release +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test14(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + call void @objc_release(i8* %x) nounwind + call void @objc_release(i8* %x) nounwind + ret void +} + +; Trivial retain,autorelease pair with intervening call, but it's post-dominated +; by another release. Don't delete anything. + +; CHECK: define void @test15( +; CHECK-NEXT: entry: +; CHECK-NEXT: @objc_retain(i8* %x) +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: @objc_autorelease(i8* %x) +; CHECK-NEXT: @objc_release +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test15(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + call i8* @objc_autorelease(i8* %x) nounwind + call void @objc_release(i8* %x) nounwind + ret void +} + +; Trivial retain,autorelease pair, post-dominated +; by another release. Delete the retain and release. + +; CHECK: define void @test15b +; CHECK-NEXT: entry: +; CHECK-NEXT: @objc_autorelease +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test15b(i8* %x, i64 %n) { +entry: + call i8* @objc_retain(i8* %x) nounwind + call i8* @objc_autorelease(i8* %x) nounwind + call void @objc_release(i8* %x) nounwind + ret void +} + +; Retain+release pairs in diamonds, all dominated by a retain. + +; CHECK: define void @test16( +; CHECK: @objc_retain(i8* %x) +; CHECK-NOT: @objc +; CHECK: } +define void @test16(i1 %a, i1 %b, i8* %x) { +entry: + call i8* @objc_retain(i8* %x) nounwind + br i1 %a, label %red, label %orange + +red: + call i8* @objc_retain(i8* %x) nounwind + br label %yellow + +orange: + call i8* @objc_retain(i8* %x) nounwind + br label %yellow + +yellow: + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + br i1 %b, label %green, label %blue + +green: + call void @objc_release(i8* %x) nounwind + br label %purple + +blue: + call void @objc_release(i8* %x) nounwind + br label %purple + +purple: + ret void +} + +; Retain+release pairs in diamonds, all post-dominated by a release. + +; CHECK: define void @test17( +; CHECK-NOT: @objc_ +; CHECK: purple: +; CHECK: @objc_release +; CHECK: } +define void @test17(i1 %a, i1 %b, i8* %x) { +entry: + br i1 %a, label %red, label %orange + +red: + call i8* @objc_retain(i8* %x) nounwind + br label %yellow + +orange: + call i8* @objc_retain(i8* %x) nounwind + br label %yellow + +yellow: + call void @use_pointer(i8* %x) + call void @use_pointer(i8* %x) + br i1 %b, label %green, label %blue + +green: + call void @objc_release(i8* %x) nounwind + br label %purple + +blue: + call void @objc_release(i8* %x) nounwind + br label %purple + +purple: + call void @objc_release(i8* %x) nounwind + ret void +} + +; Delete no-ops. + +; CHECK: define void @test18( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test18() { + call i8* @objc_retain(i8* null) + call void @objc_release(i8* null) + call i8* @objc_autorelease(i8* null) + ret void +} + +; Delete no-ops where undef can be assumed to be null. + +; CHECK: define void @test18b +; CHECK-NOT: @objc_ +; CHECK: } +define void @test18b() { + call i8* @objc_retain(i8* undef) + call void @objc_release(i8* undef) + call i8* @objc_autorelease(i8* undef) + ret void +} + +; Replace uses of arguments with uses of return values, to reduce +; register pressure. + +; CHECK: define void @test19(i32* %y) { +; CHECK: %z = bitcast i32* %y to i8* +; CHECK: %0 = bitcast i32* %y to i8* +; CHECK: %1 = tail call i8* @objc_retain(i8* %0) +; CHECK: call void @use_pointer(i8* %z) +; CHECK: call void @use_pointer(i8* %z) +; CHECK: %2 = bitcast i32* %y to i8* +; CHECK: call void @objc_release(i8* %2) +; CHECK: ret void +; CHECK: } +define void @test19(i32* %y) { +entry: + %x = bitcast i32* %y to i8* + %0 = call i8* @objc_retain(i8* %x) nounwind + %z = bitcast i32* %y to i8* + call void @use_pointer(i8* %z) + call void @use_pointer(i8* %z) + call void @objc_release(i8* %x) + ret void +} + +; Bitcast insertion + +; CHECK: define void @test20( +; CHECK: %tmp1 = tail call i8* @objc_retain(i8* %tmp) nounwind +; CHECK-NEXT: invoke +define void @test20(double* %self) { +if.then12: + %tmp = bitcast double* %self to i8* + %tmp1 = call i8* @objc_retain(i8* %tmp) nounwind + invoke void @invokee() + to label %invoke.cont23 unwind label %lpad20 + +invoke.cont23: ; preds = %if.then12 + invoke void @invokee() + to label %if.end unwind label %lpad20 + +lpad20: ; preds = %invoke.cont23, %if.then12 + %tmp502 = phi double* [ undef, %invoke.cont23 ], [ %self, %if.then12 ] + unreachable + +if.end: ; preds = %invoke.cont23 + ret void +} + +; Delete a redundant retain,autorelease when forwaring a call result +; directly to a return value. + +; CHECK: define i8* @test21( +; CHECK: call i8* @returner() +; CHECK-NEXT: ret i8* %call +define i8* @test21() { +entry: + %call = call i8* @returner() + %0 = call i8* @objc_retain(i8* %call) nounwind + %1 = call i8* @objc_autorelease(i8* %0) nounwind + ret i8* %1 +} + +; Move an objc call up through a phi that has null operands. + +; CHECK: define void @test22( +; CHECK: B: +; CHECK: %1 = bitcast double* %p to i8* +; CHECK: call void @objc_release(i8* %1) +; CHECK: br label %C +; CHECK: C: ; preds = %B, %A +; CHECK-NOT: @objc_release +; CHECK: } +define void @test22(double* %p, i1 %a) { + br i1 %a, label %A, label %B +A: + br label %C +B: + br label %C +C: + %h = phi double* [ null, %A ], [ %p, %B ] + %c = bitcast double* %h to i8* + call void @objc_release(i8* %c) + ret void +} + +; Optimize objc_retainBlock. + +; CHECK: define void @test23( +; CHECK-NOT: @objc_ +; CHECK: } +%block0 = type { i64, i64, i8*, i8* } +%block1 = type { i8**, i32, i32, i32 (%struct.__block_literal_1*)*, %block0* } +%struct.__block_descriptor = type { i64, i64 } +%struct.__block_literal_1 = type { i8**, i32, i32, i8**, %struct.__block_descriptor* } +@__block_holder_tmp_1 = external constant %block1 +define void @test23() { +entry: + %0 = call i8* @objc_retainBlock(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind + call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*)) + call void @bar(i32 ()* bitcast (%block1* @__block_holder_tmp_1 to i32 ()*)) + call void @objc_release(i8* bitcast (%block1* @__block_holder_tmp_1 to i8*)) nounwind + ret void +} + +; Don't optimize objc_retainBlock. + +; CHECK: define void @test23b +; CHECK: @objc_retainBlock +; CHECK: @objc_release +; CHECK: } +define void @test23b(i8* %p) { +entry: + %0 = call i8* @objc_retainBlock(i8* %p) nounwind + call void @use_pointer(i8* %p) + call void @use_pointer(i8* %p) + call void @objc_release(i8* %p) nounwind + ret void +} + +; Any call can decrement a retain count. + +; CHECK: define void @test24( +; CHECK: @objc_retain(i8* %a) +; CHECK: @objc_release +; CHECK: } +define void @test24(i8* %r, i8* %a) { + call i8* @objc_retain(i8* %a) + call void @use_pointer(i8* %r) + %q = load i8* %a + call void @objc_release(i8* %a) + ret void +} + +; Don't move a retain/release pair if the release can be moved +; but the retain can't be moved to balance it. + +; CHECK: define void @test25( +; CHECK: entry: +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: true: +; CHECK: done: +; CHECK: call void @objc_release(i8* %p) +; CHECK: } +define void @test25(i8* %p, i1 %x) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + call void @callee() + br i1 %x, label %true, label %done + +true: + store i8 0, i8* %p + br label %done + +done: + call void @objc_release(i8* %p) + ret void +} + +; Don't move a retain/release pair if the retain can be moved +; but the release can't be moved to balance it. + +; CHECK: define void @test26( +; CHECK: entry: +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: true: +; CHECK: done: +; CHECK: call void @objc_release(i8* %p) +; CHECK: } +define void @test26(i8* %p, i1 %x) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + br label %done + +done: + store i8 0, i8* %p + call void @objc_release(i8* %p) + ret void +} + +; Don't sink the retain,release into the loop. + +; CHECK: define void @test27( +; CHECK: entry: +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: loop: +; CHECK-NOT: @objc_ +; CHECK: done: +; CHECK: call void @objc_release +; CHECK: } +define void @test27(i8* %p, i1 %x, i1 %y) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %loop, label %done + +loop: + call void @callee() + store i8 0, i8* %p + br i1 %y, label %done, label %loop + +done: + call void @objc_release(i8* %p) + ret void +} + +; Trivial code motion case: Triangle. + +; CHECK: define void @test28( +; CHECK-NOT: @objc_ +; CHECK: true: +; CHECK: call i8* @objc_retain( +; CHECK: call void @callee() +; CHECK: store +; CHECK: call void @objc_release +; CHECK: done: +; CHECK-NOT: @objc_ +; CHECK: } +define void @test28(i8* %p, i1 %x) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + store i8 0, i8* %p + br label %done + +done: + call void @objc_release(i8* %p), !clang.imprecise_release !0 + ret void +} + +; Trivial code motion case: Triangle, but no metadata. Don't move past +; unrelated memory references! + +; CHECK: define void @test28b +; CHECK: call i8* @objc_retain( +; CHECK: true: +; CHECK-NOT: @objc_ +; CHECK: call void @callee() +; CHECK-NOT: @objc_ +; CHECK: store +; CHECK-NOT: @objc_ +; CHECK: done: +; CHECK: @objc_release +; CHECK: } +define void @test28b(i8* %p, i1 %x, i8* noalias %t) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + store i8 0, i8* %p + br label %done + +done: + store i8 0, i8* %t + call void @objc_release(i8* %p) + ret void +} + +; Trivial code motion case: Triangle, with metadata. Do move past +; unrelated memory references! And preserve the metadata. + +; CHECK: define void @test28c +; CHECK-NOT: @objc_ +; CHECK: true: +; CHECK: call i8* @objc_retain( +; CHECK: call void @callee() +; CHECK: store +; CHECK: call void @objc_release(i8* %p) nounwind, !clang.imprecise_release +; CHECK: done: +; CHECK-NOT: @objc_ +; CHECK: } +define void @test28c(i8* %p, i1 %x, i8* noalias %t) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + store i8 0, i8* %p + br label %done + +done: + store i8 0, i8* %t + call void @objc_release(i8* %p), !clang.imprecise_release !0 + ret void +} + +; Like test28. but with two releases. + +; CHECK: define void @test29( +; CHECK-NOT: @objc_ +; CHECK: true: +; CHECK: call i8* @objc_retain( +; CHECK: call void @callee() +; CHECK: store +; CHECK: call void @objc_release +; CHECK-NOT: @objc_release +; CHECK: done: +; CHECK-NOT: @objc_ +; CHECK: ohno: +; CHECK-NOT: @objc_ +; CHECK: } +define void @test29(i8* %p, i1 %x, i1 %y) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + store i8 0, i8* %p + br i1 %y, label %done, label %ohno + +done: + call void @objc_release(i8* %p) + ret void + +ohno: + call void @objc_release(i8* %p) + ret void +} + +; Basic case with the use and call in a diamond +; with an extra release. + +; CHECK: define void @test30( +; CHECK-NOT: @objc_ +; CHECK: true: +; CHECK: call i8* @objc_retain( +; CHECK: call void @callee() +; CHECK: store +; CHECK: call void @objc_release +; CHECK-NOT: @objc_release +; CHECK: false: +; CHECK-NOT: @objc_ +; CHECK: done: +; CHECK-NOT: @objc_ +; CHECK: ohno: +; CHECK-NOT: @objc_ +; CHECK: } +define void @test30(i8* %p, i1 %x, i1 %y, i1 %z) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %false + +true: + call void @callee() + store i8 0, i8* %p + br i1 %y, label %done, label %ohno + +false: + br i1 %z, label %done, label %ohno + +done: + call void @objc_release(i8* %p) + ret void + +ohno: + call void @objc_release(i8* %p) + ret void +} + +; Basic case with a mergeable release. + +; CHECK: define void @test31( +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: call void @callee() +; CHECK: store +; CHECK: call void @objc_release +; CHECK-NOT: @objc_release +; CHECK: true: +; CHECK-NOT: @objc_release +; CHECK: false: +; CHECK-NOT: @objc_release +; CHECK: ret void +; CHECK-NOT: @objc_release +; CHECK: } +define void @test31(i8* %p, i1 %x) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + call void @callee() + store i8 0, i8* %p + br i1 %x, label %true, label %false +true: + call void @objc_release(i8* %p) + ret void +false: + call void @objc_release(i8* %p) + ret void +} + +; Don't consider bitcasts or getelementptrs direct uses. + +; CHECK: define void @test32( +; CHECK-NOT: @objc_ +; CHECK: true: +; CHECK: call i8* @objc_retain( +; CHECK: call void @callee() +; CHECK: store +; CHECK: call void @objc_release +; CHECK: done: +; CHECK-NOT: @objc_ +; CHECK: } +define void @test32(i8* %p, i1 %x) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + store i8 0, i8* %p + br label %done + +done: + %g = bitcast i8* %p to i8* + %h = getelementptr i8* %g, i64 0 + call void @objc_release(i8* %g) + ret void +} + +; Do consider icmps to be direct uses. + +; CHECK: define void @test33( +; CHECK-NOT: @objc_ +; CHECK: true: +; CHECK: call i8* @objc_retain( +; CHECK: call void @callee() +; CHECK: icmp +; CHECK: call void @objc_release +; CHECK: done: +; CHECK-NOT: @objc_ +; CHECK: } +define void @test33(i8* %p, i1 %x, i8* %y) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + %v = icmp eq i8* %p, %y + br label %done + +done: + %g = bitcast i8* %p to i8* + %h = getelementptr i8* %g, i64 0 + call void @objc_release(i8* %g) + ret void +} + +; Delete retain,release if there's just a possible dec. + +; CHECK: define void @test34( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test34(i8* %p, i1 %x, i8* %y) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + call void @callee() + br label %done + +done: + %g = bitcast i8* %p to i8* + %h = getelementptr i8* %g, i64 0 + call void @objc_release(i8* %g) + ret void +} + +; Delete retain,release if there's just a use. + +; CHECK: define void @test35( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test35(i8* %p, i1 %x, i8* %y) { +entry: + %f0 = call i8* @objc_retain(i8* %p) + br i1 %x, label %true, label %done + +true: + %v = icmp eq i8* %p, %y + br label %done + +done: + %g = bitcast i8* %p to i8* + %h = getelementptr i8* %g, i64 0 + call void @objc_release(i8* %g) + ret void +} + +; Delete a retain,release if there's no actual use. + +; CHECK: define void @test36( +; CHECK-NOT: @objc_ +; CHECK: call void @callee() +; CHECK-NOT: @objc_ +; CHECK: call void @callee() +; CHECK-NOT: @objc_ +; CHECK: } +define void @test36(i8* %p) { +entry: + call i8* @objc_retain(i8* %p) + call void @callee() + call void @callee() + call void @objc_release(i8* %p) + ret void +} + +; Like test36, but with metadata. + +; CHECK: define void @test37( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test37(i8* %p) { +entry: + call i8* @objc_retain(i8* %p) + call void @callee() + call void @callee() + call void @objc_release(i8* %p), !clang.imprecise_release !0 + ret void +} + +; Be aggressive about analyzing phis to eliminate possible uses. + +; CHECK: define void @test38( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test38(i8* %p, i1 %u, i1 %m, i8* %z, i8* %y, i8* %x, i8* %w) { +entry: + call i8* @objc_retain(i8* %p) + br i1 %u, label %true, label %false +true: + br i1 %m, label %a, label %b +false: + br i1 %m, label %c, label %d +a: + br label %e +b: + br label %e +c: + br label %f +d: + br label %f +e: + %j = phi i8* [ %z, %a ], [ %y, %b ] + br label %g +f: + %k = phi i8* [ %w, %c ], [ %x, %d ] + br label %g +g: + %h = phi i8* [ %j, %e ], [ %k, %f ] + call void @use_pointer(i8* %h) + call void @objc_release(i8* %p), !clang.imprecise_release !0 + ret void +} + +; Delete retain,release pairs around loops. + +; CHECK: define void @test39( +; CHECK_NOT: @objc_ +; CHECK: } +define void @test39(i8* %p) { +entry: + %0 = call i8* @objc_retain(i8* %p) + br label %loop + +loop: ; preds = %loop, %entry + br i1 undef, label %loop, label %exit + +exit: ; preds = %loop + call void @objc_release(i8* %0), !clang.imprecise_release !0 + ret void +} + +; Delete retain,release pairs around loops containing uses. + +; CHECK: define void @test39b( +; CHECK_NOT: @objc_ +; CHECK: } +define void @test39b(i8* %p) { +entry: + %0 = call i8* @objc_retain(i8* %p) + br label %loop + +loop: ; preds = %loop, %entry + store i8 0, i8* %0 + br i1 undef, label %loop, label %exit + +exit: ; preds = %loop + call void @objc_release(i8* %0), !clang.imprecise_release !0 + ret void +} + +; Delete retain,release pairs around loops containing potential decrements. + +; CHECK: define void @test39c( +; CHECK_NOT: @objc_ +; CHECK: } +define void @test39c(i8* %p) { +entry: + %0 = call i8* @objc_retain(i8* %p) + br label %loop + +loop: ; preds = %loop, %entry + call void @use_pointer(i8* %0) + br i1 undef, label %loop, label %exit + +exit: ; preds = %loop + call void @objc_release(i8* %0), !clang.imprecise_release !0 + ret void +} + +; Delete retain,release pairs around loops even if +; the successors are in a different order. + +; CHECK: define void @test40( +; CHECK_NOT: @objc_ +; CHECK: } +define void @test40(i8* %p) { +entry: + %0 = call i8* @objc_retain(i8* %p) + br label %loop + +loop: ; preds = %loop, %entry + call void @use_pointer(i8* %0) + br i1 undef, label %exit, label %loop + +exit: ; preds = %loop + call void @objc_release(i8* %0), !clang.imprecise_release !0 + ret void +} + +; Do the known-incremented retain+release elimination even if the pointer +; is also autoreleased. + +; CHECK: define void @test42( +; CHECK-NEXT: entry: +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: call i8* @objc_autorelease(i8* %p) +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test42(i8* %p) { +entry: + call i8* @objc_retain(i8* %p) + call i8* @objc_autorelease(i8* %p) + call i8* @objc_retain(i8* %p) + call void @use_pointer(i8* %p) + call void @use_pointer(i8* %p) + call void @objc_release(i8* %p) + ret void +} + +; Don't the known-incremented retain+release elimination if the pointer is +; autoreleased and there's an autoreleasePoolPop. + +; CHECK: define void @test43( +; CHECK-NEXT: entry: +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: call i8* @objc_autorelease(i8* %p) +; CHECK-NEXT: call i8* @objc_retain +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: call void @objc_autoreleasePoolPop(i8* undef) +; CHECK-NEXT: call void @objc_release +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test43(i8* %p) { +entry: + call i8* @objc_retain(i8* %p) + call i8* @objc_autorelease(i8* %p) + call i8* @objc_retain(i8* %p) + call void @use_pointer(i8* %p) + call void @use_pointer(i8* %p) + call void @objc_autoreleasePoolPop(i8* undef) + call void @objc_release(i8* %p) + ret void +} + +; Do the known-incremented retain+release elimination if the pointer is +; autoreleased and there's an autoreleasePoolPush. + +; CHECK: define void @test43b +; CHECK-NEXT: entry: +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: call i8* @objc_autorelease(i8* %p) +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: call void @objc_autoreleasePoolPush() +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test43b(i8* %p) { +entry: + call i8* @objc_retain(i8* %p) + call i8* @objc_autorelease(i8* %p) + call i8* @objc_retain(i8* %p) + call void @use_pointer(i8* %p) + call void @use_pointer(i8* %p) + call void @objc_autoreleasePoolPush() + call void @objc_release(i8* %p) + ret void +} + +; Do retain+release elimination for non-provenance pointers. + +; CHECK: define void @test44( +; CHECK-NOT: objc_ +; CHECK: } +define void @test44(i8** %pp) { + %p = load i8** %pp + %q = call i8* @objc_retain(i8* %p) + call void @objc_release(i8* %q) + ret void +} + +; Don't delete retain+release with an unknown-provenance +; may-alias objc_release between them. + +; CHECK: define void @test45( +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: call void @objc_release(i8* %q) +; CHECK: call void @use_pointer(i8* %p) +; CHECK: call void @objc_release(i8* %p) +define void @test45(i8** %pp, i8** %qq) { + %p = load i8** %pp + %q = load i8** %qq + call i8* @objc_retain(i8* %p) + call void @objc_release(i8* %q) + call void @use_pointer(i8* %p) + call void @objc_release(i8* %p) + ret void +} + +; Don't delete retain and autorelease here. + +; CHECK: define void @test46( +; CHECK: tail call i8* @objc_retain(i8* %p) nounwind +; CHECK: true: +; CHECK: tail call i8* @objc_autorelease(i8* %p) nounwind +define void @test46(i8* %p, i1 %a) { +entry: + call i8* @objc_retain(i8* %p) + br i1 %a, label %true, label %false + +true: + call i8* @objc_autorelease(i8* %p) + call void @use_pointer(i8* %p) + ret void + +false: + ret void +} + +; Delete no-op cast calls. + +; CHECK: define i8* @test47( +; CHECK-NOT: call +; CHECK: ret i8* %p +define i8* @test47(i8* %p) nounwind { + %x = call i8* @objc_retainedObject(i8* %p) + ret i8* %x +} + +; Delete no-op cast calls. + +; CHECK: define i8* @test48( +; CHECK-NOT: call +; CHECK: ret i8* %p +define i8* @test48(i8* %p) nounwind { + %x = call i8* @objc_unretainedObject(i8* %p) + ret i8* %x +} + +; Delete no-op cast calls. + +; CHECK: define i8* @test49( +; CHECK-NOT: call +; CHECK: ret i8* %p +define i8* @test49(i8* %p) nounwind { + %x = call i8* @objc_unretainedPointer(i8* %p) + ret i8* %x +} + +; Do delete retain+release with intervening stores of the +; address value; + +; CHECK: define void @test50( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test50(i8* %p, i8** %pp) { + call i8* @objc_retain(i8* %p) + call void @callee() + store i8* %p, i8** %pp + call void @objc_release(i8* %p) + ret void +} + +; Don't delete retain+release with intervening stores through the +; address value. + +; CHECK: define void @test51( +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: call void @objc_release(i8* %p) +define void @test51(i8* %p) { + call i8* @objc_retain(i8* %p) + call void @callee() + store i8 0, i8* %p + call void @objc_release(i8* %p) + ret void +} + +; Don't delete retain+release with intervening use of a pointer of +; unknown provenance. + +; CHECK: define void @test52( +; CHECK: call i8* @objc_retain +; CHECK: call void @callee() +; CHECK: call void @use_pointer(i8* %z) +; CHECK: call void @objc_release +define void @test52(i8** %zz, i8** %pp) { + %p = load i8** %pp + %1 = call i8* @objc_retain(i8* %p) + call void @callee() + %z = load i8** %zz + call void @use_pointer(i8* %z) + call void @objc_release(i8* %p) + ret void +} + +; Like test52, but the pointer has function type, so it's assumed to +; be not reference counted. + +; CHECK: define void @test53( +; CHECK-NOT: @objc_ +; CHECK: } +define void @test53(void ()** %zz, i8** %pp) { + %p = load i8** %pp + %1 = call i8* @objc_retain(i8* %p) + call void @callee() + %z = load void ()** %zz + call void @callee_fnptr(void ()* %z) + call void @objc_release(i8* %p) + ret void +} + +; Convert autorelease to release if the value is unused. + +; CHECK: define void @test54( +; CHECK: call i8* @returner() +; CHECK-NEXT: call void @objc_release(i8* %t) nounwind, !clang.imprecise_release !0 +; CHECK-NEXT: ret void +define void @test54() { + %t = call i8* @returner() + call i8* @objc_autorelease(i8* %t) + ret void +} + +; Nested retain+release pairs. Delete them both. + +; CHECK: define void @test55( +; CHECK-NOT: @objc +; CHECK: } +define void @test55(i8* %x) { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + %1 = call i8* @objc_retain(i8* %x) nounwind + call void @objc_release(i8* %x) nounwind + call void @objc_release(i8* %x) nounwind + ret void +} + +; Nested retain+release pairs where the inner pair depends +; on the outer pair to be removed, and then the outer pair +; can be partially eliminated. Plus an extra outer pair to +; eliminate, for fun. + +; CHECK: define void @test56( +; CHECK-NOT: @objc +; CHECK: if.then: +; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %x) nounwind +; CHECK-NEXT: tail call void @use_pointer(i8* %x) +; CHECK-NEXT: tail call void @use_pointer(i8* %x) +; CHECK-NEXT: tail call void @objc_release(i8* %x) nounwind, !clang.imprecise_release !0 +; CHECK-NEXT: br label %if.end +; CHECK-NOT: @objc +; CHECK: } +define void @test56(i8* %x, i32 %n) { +entry: + %0 = tail call i8* @objc_retain(i8* %x) nounwind + %1 = tail call i8* @objc_retain(i8* %0) nounwind + %tobool = icmp eq i32 %n, 0 + br i1 %tobool, label %if.end, label %if.then + +if.then: ; preds = %entry + %2 = tail call i8* @objc_retain(i8* %1) nounwind + tail call void @use_pointer(i8* %2) + tail call void @use_pointer(i8* %2) + tail call void @objc_release(i8* %2) nounwind, !clang.imprecise_release !0 + br label %if.end + +if.end: ; preds = %entry, %if.then + tail call void @objc_release(i8* %1) nounwind, !clang.imprecise_release !0 + tail call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 + ret void +} + +declare void @bar(i32 ()*) + +; A few real-world testcases. + +@.str4 = private unnamed_addr constant [33 x i8] c"-[A z] = { %f, %f, { %f, %f } }\0A\00" +@"OBJC_IVAR_$_A.myZ" = global i64 20, section "__DATA, __objc_const", align 8 +declare i32 @printf(i8* nocapture, ...) nounwind +declare i32 @puts(i8* nocapture) nounwind +@str = internal constant [16 x i8] c"-[ Top0 _getX ]\00" + +; CHECK: @"\01-[A z]" +; CHECK-NOT: @objc_ +; CHECK: } + +define {<2 x float>, <2 x float>} @"\01-[A z]"({}* %self, i8* nocapture %_cmd) nounwind { +invoke.cont: + %0 = bitcast {}* %self to i8* + %1 = tail call i8* @objc_retain(i8* %0) nounwind + tail call void @llvm.dbg.value(metadata !{{}* %self}, i64 0, metadata !0) + tail call void @llvm.dbg.value(metadata !{{}* %self}, i64 0, metadata !0) + %ivar = load i64* @"OBJC_IVAR_$_A.myZ", align 8 + %add.ptr = getelementptr i8* %0, i64 %ivar + %tmp1 = bitcast i8* %add.ptr to float* + %tmp2 = load float* %tmp1, align 4 + %conv = fpext float %tmp2 to double + %add.ptr.sum = add i64 %ivar, 4 + %tmp6 = getelementptr inbounds i8* %0, i64 %add.ptr.sum + %2 = bitcast i8* %tmp6 to float* + %tmp7 = load float* %2, align 4 + %conv8 = fpext float %tmp7 to double + %add.ptr.sum36 = add i64 %ivar, 8 + %tmp12 = getelementptr inbounds i8* %0, i64 %add.ptr.sum36 + %arrayidx = bitcast i8* %tmp12 to float* + %tmp13 = load float* %arrayidx, align 4 + %conv14 = fpext float %tmp13 to double + %tmp12.sum = add i64 %ivar, 12 + %arrayidx19 = getelementptr inbounds i8* %0, i64 %tmp12.sum + %3 = bitcast i8* %arrayidx19 to float* + %tmp20 = load float* %3, align 4 + %conv21 = fpext float %tmp20 to double + %call = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([33 x i8]* @.str4, i64 0, i64 0), double %conv, double %conv8, double %conv14, double %conv21) + %ivar23 = load i64* @"OBJC_IVAR_$_A.myZ", align 8 + %add.ptr24 = getelementptr i8* %0, i64 %ivar23 + %4 = bitcast i8* %add.ptr24 to i128* + %srcval = load i128* %4, align 4 + tail call void @objc_release(i8* %0) nounwind + %tmp29 = trunc i128 %srcval to i64 + %tmp30 = bitcast i64 %tmp29 to <2 x float> + %tmp31 = insertvalue {<2 x float>, <2 x float>} undef, <2 x float> %tmp30, 0 + %tmp32 = lshr i128 %srcval, 64 + %tmp33 = trunc i128 %tmp32 to i64 + %tmp34 = bitcast i64 %tmp33 to <2 x float> + %tmp35 = insertvalue {<2 x float>, <2 x float>} %tmp31, <2 x float> %tmp34, 1 + ret {<2 x float>, <2 x float>} %tmp35 +} + +; CHECK: @"\01-[Top0 _getX]" +; CHECK-NOT: @objc_ +; CHECK: } + +define i32 @"\01-[Top0 _getX]"({}* %self, i8* nocapture %_cmd) nounwind { +invoke.cont: + %0 = bitcast {}* %self to i8* + %1 = tail call i8* @objc_retain(i8* %0) nounwind + %puts = tail call i32 @puts(i8* getelementptr inbounds ([16 x i8]* @str, i64 0, i64 0)) + tail call void @objc_release(i8* %0) nounwind + ret i32 0 +} + +@"\01L_OBJC_METH_VAR_NAME_" = internal global [5 x i8] c"frob\00", section "__TEXT,__cstring,cstring_literals", align 1@"\01L_OBJC_SELECTOR_REFERENCES_" = internal global i8* getelementptr inbounds ([5 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip" +@llvm.used = appending global [3 x i8*] [i8* getelementptr inbounds ([5 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_" to i8*), i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*)], section "llvm.metadata" + +; A simple loop. Eliminate the retain and release inside of it! + +; CHECK: define void @loop +; CHECK: for.body: +; CHECK-NOT: @objc_ +; CHECK: @objc_msgSend +; CHECK-NOT: @objc_ +; CHECK: for.end: +define void @loop(i8* %x, i64 %n) { +entry: + %0 = tail call i8* @objc_retain(i8* %x) nounwind + %cmp9 = icmp sgt i64 %n, 0 + br i1 %cmp9, label %for.body, label %for.end + +for.body: ; preds = %entry, %for.body + %i.010 = phi i64 [ %inc, %for.body ], [ 0, %entry ] + %1 = tail call i8* @objc_retain(i8* %x) nounwind + %tmp5 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8 + %call = tail call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %1, i8* %tmp5) + tail call void @objc_release(i8* %1) nounwind, !clang.imprecise_release !0 + %inc = add nsw i64 %i.010, 1 + %exitcond = icmp eq i64 %inc, %n + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body, %entry + tail call void @objc_release(i8* %x) nounwind, !clang.imprecise_release !0 + ret void +} + +; ObjCARCOpt can delete the retain,release on self. + +; CHECK: define void @TextEditTest +; CHECK-NOT: call i8* @objc_retain(i8* %tmp7) +; CHECK: } + +%0 = type { i8* (i8*, %struct._message_ref_t*, ...)*, i8* } +%1 = type opaque +%2 = type opaque +%3 = type opaque +%4 = type opaque +%5 = type opaque +%struct.NSConstantString = type { i32*, i32, i8*, i64 } +%struct._NSRange = type { i64, i64 } +%struct.__CFString = type opaque +%struct.__method_list_t = type { i32, i32, [0 x %struct._objc_method] } +%struct._class_ro_t = type { i32, i32, i32, i8*, i8*, %struct.__method_list_t*, %struct._objc_protocol_list*, %struct._ivar_list_t*, i8*, %struct._prop_list_t* } +%struct._class_t = type { %struct._class_t*, %struct._class_t*, %struct._objc_cache*, i8* (i8*, i8*)**, %struct._class_ro_t* } +%struct._ivar_list_t = type { i32, i32, [0 x %struct._ivar_t] } +%struct._ivar_t = type { i64*, i8*, i8*, i32, i32 } +%struct._message_ref_t = type { i8*, i8* } +%struct._objc_cache = type opaque +%struct._objc_method = type { i8*, i8*, i8* } +%struct._objc_protocol_list = type { i64, [0 x %struct._protocol_t*] } +%struct._prop_list_t = type { i32, i32, [0 x %struct._message_ref_t] } +%struct._protocol_t = type { i8*, i8*, %struct._objc_protocol_list*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct.__method_list_t*, %struct._prop_list_t*, i32, i32 } + +@"\01L_OBJC_CLASSLIST_REFERENCES_$_17" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@kUTTypePlainText = external constant %struct.__CFString* +@"\01L_OBJC_SELECTOR_REFERENCES_19" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_21" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_23" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_25" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_26" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_28" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_29" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_31" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_33" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_35" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_37" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_38" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_40" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_42" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@_unnamed_cfstring_44 = external hidden constant %struct.NSConstantString, section "__DATA,__cfstring" +@"\01L_OBJC_SELECTOR_REFERENCES_46" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_48" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01l_objc_msgSend_fixup_isEqual_" = external hidden global %0, section "__DATA, __objc_msgrefs, coalesced", align 16 +@"\01L_OBJC_CLASSLIST_REFERENCES_$_50" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@NSCocoaErrorDomain = external constant %1* +@"\01L_OBJC_CLASSLIST_REFERENCES_$_51" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@NSFilePathErrorKey = external constant %1* +@"\01L_OBJC_SELECTOR_REFERENCES_53" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_55" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_56" = external hidden global %struct._class_t*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_58" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_60" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" + +declare %1* @truncatedString(%1*, i64) +define void @TextEditTest(%2* %self, %3* %pboard) { +entry: + %err = alloca %4*, align 8 + %tmp7 = bitcast %2* %self to i8* + %tmp8 = call i8* @objc_retain(i8* %tmp7) nounwind + store %4* null, %4** %err, align 8 + %tmp1 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_17", align 8 + %tmp2 = load %struct.__CFString** @kUTTypePlainText, align 8 + %tmp3 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_19", align 8 + %tmp4 = bitcast %struct._class_t* %tmp1 to i8* + %call5 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp4, i8* %tmp3, %struct.__CFString* %tmp2) + %tmp5 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_21", align 8 + %tmp6 = bitcast %3* %pboard to i8* + %call76 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp6, i8* %tmp5, i8* %call5) + %tmp9 = call i8* @objc_retain(i8* %call76) nounwind + %tobool = icmp eq i8* %tmp9, null + br i1 %tobool, label %end, label %land.lhs.true + +land.lhs.true: ; preds = %entry + %tmp11 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_23", align 8 + %call137 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp6, i8* %tmp11, i8* %tmp9) + %tmp = bitcast i8* %call137 to %1* + %tmp10 = call i8* @objc_retain(i8* %call137) nounwind + call void @objc_release(i8* null) nounwind + %tmp12 = call i8* @objc_retain(i8* %call137) nounwind + call void @objc_release(i8* null) nounwind + %tobool16 = icmp eq i8* %call137, null + br i1 %tobool16, label %end, label %if.then + +if.then: ; preds = %land.lhs.true + %tmp19 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_25", align 8 + %call21 = call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*)*)(i8* %call137, i8* %tmp19) + %tobool22 = icmp eq i8 %call21, 0 + br i1 %tobool22, label %if.then44, label %land.lhs.true23 + +land.lhs.true23: ; preds = %if.then + %tmp24 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_26", align 8 + %tmp26 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_28", align 8 + %tmp27 = bitcast %struct._class_t* %tmp24 to i8* + %call2822 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp27, i8* %tmp26, i8* %call137) + %tmp13 = bitcast i8* %call2822 to %5* + %tmp14 = call i8* @objc_retain(i8* %call2822) nounwind + call void @objc_release(i8* null) nounwind + %tobool30 = icmp eq i8* %call2822, null + br i1 %tobool30, label %if.then44, label %if.end + +if.end: ; preds = %land.lhs.true23 + %tmp32 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_29", align 8 + %tmp33 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_31", align 8 + %tmp34 = bitcast %struct._class_t* %tmp32 to i8* + %call35 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp34, i8* %tmp33) + %tmp37 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_33", align 8 + %call3923 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %call35, i8* %tmp37, i8* %call2822, i32 signext 1, %4** %err) + %cmp = icmp eq i8* %call3923, null + br i1 %cmp, label %if.then44, label %end + +if.then44: ; preds = %if.end, %land.lhs.true23, %if.then + %url.025 = phi %5* [ %tmp13, %if.end ], [ %tmp13, %land.lhs.true23 ], [ null, %if.then ] + %tmp49 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_35", align 8 + %call51 = call %struct._NSRange bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %struct._NSRange (i8*, i8*, i64, i64)*)(i8* %call137, i8* %tmp49, i64 0, i64 0) + %call513 = extractvalue %struct._NSRange %call51, 0 + %call514 = extractvalue %struct._NSRange %call51, 1 + %tmp52 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_37", align 8 + %call548 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %call137, i8* %tmp52, i64 %call513, i64 %call514) + %tmp55 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_38", align 8 + %tmp56 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_40", align 8 + %tmp57 = bitcast %struct._class_t* %tmp55 to i8* + %call58 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp57, i8* %tmp56) + %tmp59 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_42", align 8 + %call6110 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %call548, i8* %tmp59, i8* %call58) + %tmp15 = call i8* @objc_retain(i8* %call6110) nounwind + call void @objc_release(i8* %call137) nounwind + %tmp64 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_46", align 8 + %call66 = call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, %1*)*)(i8* %call6110, i8* %tmp64, %1* bitcast (%struct.NSConstantString* @_unnamed_cfstring_44 to %1*)) + %tobool67 = icmp eq i8 %call66, 0 + br i1 %tobool67, label %if.end74, label %if.then68 + +if.then68: ; preds = %if.then44 + %tmp70 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_48", align 8 + %call7220 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %call6110, i8* %tmp70) + %tmp16 = call i8* @objc_retain(i8* %call7220) nounwind + call void @objc_release(i8* %call6110) nounwind + br label %if.end74 + +if.end74: ; preds = %if.then68, %if.then44 + %filename.0.in = phi i8* [ %call7220, %if.then68 ], [ %call6110, %if.then44 ] + %filename.0 = bitcast i8* %filename.0.in to %1* + %tmp17 = load i8** bitcast (%0* @"\01l_objc_msgSend_fixup_isEqual_" to i8**), align 16 + %tmp18 = bitcast i8* %tmp17 to i8 (i8*, %struct._message_ref_t*, i8*, ...)* + %call78 = call signext i8 (i8*, %struct._message_ref_t*, i8*, ...)* %tmp18(i8* %call137, %struct._message_ref_t* bitcast (%0* @"\01l_objc_msgSend_fixup_isEqual_" to %struct._message_ref_t*), i8* %filename.0.in) + %tobool79 = icmp eq i8 %call78, 0 + br i1 %tobool79, label %land.lhs.true80, label %if.then109 + +land.lhs.true80: ; preds = %if.end74 + %tmp82 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_25", align 8 + %call84 = call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*)*)(i8* %filename.0.in, i8* %tmp82) + %tobool86 = icmp eq i8 %call84, 0 + br i1 %tobool86, label %if.then109, label %if.end106 + +if.end106: ; preds = %land.lhs.true80 + %tmp88 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_26", align 8 + %tmp90 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_28", align 8 + %tmp91 = bitcast %struct._class_t* %tmp88 to i8* + %call9218 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp91, i8* %tmp90, i8* %filename.0.in) + %tmp20 = bitcast i8* %call9218 to %5* + %tmp21 = call i8* @objc_retain(i8* %call9218) nounwind + %tmp22 = bitcast %5* %url.025 to i8* + call void @objc_release(i8* %tmp22) nounwind + %tmp94 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_29", align 8 + %tmp95 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_31", align 8 + %tmp96 = bitcast %struct._class_t* %tmp94 to i8* + %call97 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp96, i8* %tmp95) + %tmp99 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_33", align 8 + %call10119 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %call97, i8* %tmp99, i8* %call9218, i32 signext 1, %4** %err) + %phitmp = icmp eq i8* %call10119, null + br i1 %phitmp, label %if.then109, label %end + +if.then109: ; preds = %if.end106, %land.lhs.true80, %if.end74 + %url.129 = phi %5* [ %tmp20, %if.end106 ], [ %url.025, %if.end74 ], [ %url.025, %land.lhs.true80 ] + %tmp110 = load %4** %err, align 8 + %tobool111 = icmp eq %4* %tmp110, null + br i1 %tobool111, label %if.then112, label %if.end125 + +if.then112: ; preds = %if.then109 + %tmp113 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_50", align 8 + %tmp114 = load %1** @NSCocoaErrorDomain, align 8 + %tmp115 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_51", align 8 + %call117 = call %1* @truncatedString(%1* %filename.0, i64 1034) + %tmp118 = load %1** @NSFilePathErrorKey, align 8 + %tmp119 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_53", align 8 + %tmp120 = bitcast %struct._class_t* %tmp115 to i8* + %call12113 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp120, i8* %tmp119, %1* %call117, %1* %tmp118, i8* null) + %tmp122 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_55", align 8 + %tmp123 = bitcast %struct._class_t* %tmp113 to i8* + %call12414 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp123, i8* %tmp122, %1* %tmp114, i64 258, i8* %call12113) + %tmp23 = call i8* @objc_retain(i8* %call12414) nounwind + %tmp25 = call i8* @objc_autorelease(i8* %tmp23) nounwind + %tmp28 = bitcast i8* %tmp25 to %4* + store %4* %tmp28, %4** %err, align 8 + br label %if.end125 + +if.end125: ; preds = %if.then112, %if.then109 + %tmp127 = phi %4* [ %tmp110, %if.then109 ], [ %tmp28, %if.then112 ] + %tmp126 = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_$_56", align 8 + %tmp128 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_58", align 8 + %tmp129 = bitcast %struct._class_t* %tmp126 to i8* + %call13015 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %tmp129, i8* %tmp128, %4* %tmp127) + %tmp131 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_60", align 8 + %call13317 = call i8* (i8*, i8*, ...)* @objc_msgSend(i8* %call13015, i8* %tmp131) + br label %end + +end: ; preds = %if.end125, %if.end106, %if.end, %land.lhs.true, %entry + %filename.2 = phi %1* [ %filename.0, %if.end106 ], [ %filename.0, %if.end125 ], [ %tmp, %land.lhs.true ], [ null, %entry ], [ %tmp, %if.end ] + %origFilename.0 = phi %1* [ %tmp, %if.end106 ], [ %tmp, %if.end125 ], [ %tmp, %land.lhs.true ], [ null, %entry ], [ %tmp, %if.end ] + %url.2 = phi %5* [ %tmp20, %if.end106 ], [ %url.129, %if.end125 ], [ null, %land.lhs.true ], [ null, %entry ], [ %tmp13, %if.end ] + call void @objc_release(i8* %tmp9) nounwind, !clang.imprecise_release !0 + %tmp29 = bitcast %5* %url.2 to i8* + call void @objc_release(i8* %tmp29) nounwind, !clang.imprecise_release !0 + %tmp30 = bitcast %1* %origFilename.0 to i8* + call void @objc_release(i8* %tmp30) nounwind, !clang.imprecise_release !0 + %tmp31 = bitcast %1* %filename.2 to i8* + call void @objc_release(i8* %tmp31) nounwind, !clang.imprecise_release !0 + call void @objc_release(i8* %tmp7) nounwind, !clang.imprecise_release !0 + ret void +} + +!0 = metadata !{} diff --git a/test/Transforms/ObjCARC/cfg-hazards.ll b/test/Transforms/ObjCARC/cfg-hazards.ll new file mode 100644 index 0000000..e3624df --- /dev/null +++ b/test/Transforms/ObjCARC/cfg-hazards.ll @@ -0,0 +1,86 @@ +; RUN: opt -S -objc-arc < %s | FileCheck %s +; rdar://9503416 + +; Detect loop boundaries and don't move retains and releases +; across them. + +declare void @use_pointer(i8*) +declare i8* @objc_retain(i8*) +declare void @objc_release(i8*) + +; CHECK: define void @test0( +; CHECK: call i8* @objc_retain( +; CHECK: for.body: +; CHECK-NOT: @objc +; CHECK: for.end: +; CHECK: call void @objc_release( +; CHECK: } +define void @test0(i8* %digits) { +entry: + %tmp1 = call i8* @objc_retain(i8* %digits) nounwind + call void @use_pointer(i8* %tmp1) + br label %for.body + +for.body: ; preds = %for.body, %entry + %upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ] + call void @use_pointer(i8* %tmp1) + %inc = add i64 %upcDigitIndex.01, 1 + %cmp = icmp ult i64 %inc, 12 + br i1 %cmp, label %for.body, label %for.end + +for.end: ; preds = %for.body + call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0 + ret void +} + +; CHECK: define void @test1( +; CHECK: call i8* @objc_retain( +; CHECK: for.body: +; CHECK-NOT: @objc +; CHECK: for.end: +; CHECK: void @objc_release( +; CHECK: } +define void @test1(i8* %digits) { +entry: + %tmp1 = call i8* @objc_retain(i8* %digits) nounwind + br label %for.body + +for.body: ; preds = %for.body, %entry + %upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ] + call void @use_pointer(i8* %tmp1) + call void @use_pointer(i8* %tmp1) + %inc = add i64 %upcDigitIndex.01, 1 + %cmp = icmp ult i64 %inc, 12 + br i1 %cmp, label %for.body, label %for.end + +for.end: ; preds = %for.body + call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0 + ret void +} + +; CHECK: define void @test2( +; CHECK: call i8* @objc_retain( +; CHECK: for.body: +; CHECK-NOT: @objc +; CHECK: for.end: +; CHECK: void @objc_release( +; CHECK: } +define void @test2(i8* %digits) { +entry: + %tmp1 = call i8* @objc_retain(i8* %digits) nounwind + br label %for.body + +for.body: ; preds = %for.body, %entry + %upcDigitIndex.01 = phi i64 [ 2, %entry ], [ %inc, %for.body ] + call void @use_pointer(i8* %tmp1) + %inc = add i64 %upcDigitIndex.01, 1 + %cmp = icmp ult i64 %inc, 12 + br i1 %cmp, label %for.body, label %for.end + +for.end: ; preds = %for.body + call void @use_pointer(i8* %tmp1) + call void @objc_release(i8* %tmp1) nounwind, !clang.imprecise_release !0 + ret void +} + +!0 = metadata !{} diff --git a/test/Transforms/ObjCARC/contract-marker.ll b/test/Transforms/ObjCARC/contract-marker.ll new file mode 100644 index 0000000..01d978a --- /dev/null +++ b/test/Transforms/ObjCARC/contract-marker.ll @@ -0,0 +1,23 @@ +; RUN: opt -S -objc-arc-contract < %s | FileCheck %s + +; CHECK: %call = tail call i32* @qux() +; CHECK-NEXT: %tcall = bitcast i32* %call to i8* +; CHECK-NEXT: call void asm sideeffect "mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue", ""() +; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tcall) nounwind + +define void @foo() { +entry: + %call = tail call i32* @qux() + %tcall = bitcast i32* %call to i8* + %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tcall) nounwind + tail call void @bar(i8* %0) + ret void +} + +declare i32* @qux() +declare i8* @objc_retainAutoreleasedReturnValue(i8*) +declare void @bar(i8*) + +!clang.arc.retainAutoreleasedReturnValueMarker = !{!0} + +!0 = metadata !{metadata !"mov\09r7, r7\09\09@ marker for objc_retainAutoreleaseReturnValue"} diff --git a/test/Transforms/ObjCARC/contract-storestrong-ivar.ll b/test/Transforms/ObjCARC/contract-storestrong-ivar.ll new file mode 100644 index 0000000..4ad78e7 --- /dev/null +++ b/test/Transforms/ObjCARC/contract-storestrong-ivar.ll @@ -0,0 +1,31 @@ +; RUN: opt -objc-arc-contract -S < %s | FileCheck %s + +; CHECK: call void @objc_storeStrong(i8** + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin11.0.0" + +%0 = type opaque +%1 = type opaque + +@"OBJC_IVAR_$_Controller.preferencesController" = external global i64, section "__DATA, __objc_const", align 8 + +declare i8* @objc_retain(i8*) + +declare void @objc_release(i8*) + +define hidden void @y(%0* nocapture %self, %1* %preferencesController) nounwind { +entry: + %ivar = load i64* @"OBJC_IVAR_$_Controller.preferencesController", align 8 + %tmp = bitcast %0* %self to i8* + %add.ptr = getelementptr inbounds i8* %tmp, i64 %ivar + %tmp1 = bitcast i8* %add.ptr to %1** + %tmp2 = load %1** %tmp1, align 8 + %tmp3 = bitcast %1* %preferencesController to i8* + %tmp4 = tail call i8* @objc_retain(i8* %tmp3) nounwind + %tmp5 = bitcast %1* %tmp2 to i8* + tail call void @objc_release(i8* %tmp5) nounwind + %tmp6 = bitcast i8* %tmp4 to %1* + store %1* %tmp6, %1** %tmp1, align 8 + ret void +} diff --git a/test/Transforms/ObjCARC/contract-storestrong.ll b/test/Transforms/ObjCARC/contract-storestrong.ll new file mode 100644 index 0000000..50ed260 --- /dev/null +++ b/test/Transforms/ObjCARC/contract-storestrong.ll @@ -0,0 +1,59 @@ +; RUN: opt -objc-arc-contract -S < %s | FileCheck %s + +target datalayout = "e-p:64:64:64" + +declare i8* @objc_retain(i8*) +declare void @objc_release(i8*) + +@x = external global i8* + +; CHECK: define void @test0( +; CHECK: entry: +; CHECK-NEXT: call void @objc_storeStrong(i8** @x, i8* %p) nounwind +; CHECK-NEXT: ret void +define void @test0(i8* %p) { +entry: + %0 = tail call i8* @objc_retain(i8* %p) nounwind + %tmp = load i8** @x, align 8 + store i8* %0, i8** @x, align 8 + tail call void @objc_release(i8* %tmp) nounwind + ret void +} + +; Don't do this if the load is volatile. + +; CHECK: define void @test1(i8* %p) { +; CHECK-NEXT: entry: +; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) nounwind +; CHECK-NEXT: %tmp = volatile load i8** @x, align 8 +; CHECK-NEXT: store i8* %0, i8** @x, align 8 +; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test1(i8* %p) { +entry: + %0 = tail call i8* @objc_retain(i8* %p) nounwind + %tmp = volatile load i8** @x, align 8 + store i8* %0, i8** @x, align 8 + tail call void @objc_release(i8* %tmp) nounwind + ret void +} + +; Don't do this if the store is volatile. + +; CHECK: define void @test2(i8* %p) { +; CHECK-NEXT: entry: +; CHECK-NEXT: %0 = tail call i8* @objc_retain(i8* %p) nounwind +; CHECK-NEXT: %tmp = load i8** @x, align 8 +; CHECK-NEXT: volatile store i8* %0, i8** @x, align 8 +; CHECK-NEXT: tail call void @objc_release(i8* %tmp) nounwind +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test2(i8* %p) { +entry: + %0 = tail call i8* @objc_retain(i8* %p) nounwind + %tmp = load i8** @x, align 8 + volatile store i8* %0, i8** @x, align 8 + tail call void @objc_release(i8* %tmp) nounwind + ret void +} diff --git a/test/Transforms/ObjCARC/contract-testcases.ll b/test/Transforms/ObjCARC/contract-testcases.ll new file mode 100644 index 0000000..69fa837 --- /dev/null +++ b/test/Transforms/ObjCARC/contract-testcases.ll @@ -0,0 +1,63 @@ +; RUN: opt -objc-arc-contract -S < %s | FileCheck %s +; rdar://9511608 + +%0 = type opaque +%1 = type opaque +%2 = type { i64, i64 } +%3 = type { i8*, i8* } +%4 = type opaque + +declare %0* @"\01-[NSAttributedString(Terminal) pathAtIndex:effectiveRange:]"(%1*, i8* nocapture, i64, %2*) optsize +declare i8* @objc_retainAutoreleasedReturnValue(i8*) +declare i8* @objc_msgSend_fixup(i8*, %3*, ...) +declare void @objc_release(i8*) +declare %2 @NSUnionRange(i64, i64, i64, i64) optsize +declare i8* @objc_autoreleaseReturnValue(i8*) +declare i8* @objc_autorelease(i8*) +declare i8* @objc_msgSend() nonlazybind + +; Don't get in trouble on bugpointed code. + +; CHECK: define void @test0( +define void @test0() { +bb: + %tmp = bitcast %4* undef to i8* + %tmp1 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tmp) nounwind + br label %bb3 + +bb3: ; preds = %bb2 + br i1 undef, label %bb6, label %bb4 + +bb4: ; preds = %bb3 + switch i64 undef, label %bb5 [ + i64 9223372036854775807, label %bb6 + i64 0, label %bb6 + ] + +bb5: ; preds = %bb4 + br label %bb6 + +bb6: ; preds = %bb5, %bb4, %bb4, %bb3 + %tmp7 = phi %4* [ undef, %bb5 ], [ undef, %bb4 ], [ undef, %bb3 ], [ undef, %bb4 ] + unreachable +} + +; When rewriting operands for a phi which has multiple operands +; for the same block, use the exactly same value in each block. + +; CHECK: define void @test1( +; CHECK: %0 = bitcast i8* %tmp3 to %0* +; CHECK: br i1 undef, label %bb7, label %bb7 +; CHECK: bb7: +; CHECK: %tmp8 = phi %0* [ %0, %bb ], [ %0, %bb ] +define void @test1() { +bb: + %tmp = tail call %0* bitcast (i8* ()* @objc_msgSend to %0* ()*)() + %tmp2 = bitcast %0* %tmp to i8* + %tmp3 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %tmp2) nounwind + br i1 undef, label %bb7, label %bb7 + +bb7: ; preds = %bb6, %bb6, %bb5 + %tmp8 = phi %0* [ %tmp, %bb ], [ %tmp, %bb ] + unreachable +} diff --git a/test/Transforms/ObjCARC/contract.ll b/test/Transforms/ObjCARC/contract.ll new file mode 100644 index 0000000..04ae3ca --- /dev/null +++ b/test/Transforms/ObjCARC/contract.ll @@ -0,0 +1,145 @@ +; RUN: opt -objc-arc-contract -S < %s | FileCheck %s + +target datalayout = "e-p:64:64:64" + +declare i8* @objc_retain(i8*) +declare void @objc_release(i8*) +declare i8* @objc_autorelease(i8*) +declare i8* @objc_autoreleaseReturnValue(i8*) +declare i8* @objc_retainAutoreleasedReturnValue(i8*) + +declare void @use_pointer(i8*) +declare i8* @returner() + +; CHECK: define void @test0 +; CHECK: call void @use_pointer(i8* %0) +; CHECK: } +define void @test0(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + ret void +} + +; CHECK: define void @test1 +; CHECK: call void @use_pointer(i8* %0) +; CHECK: } +define void @test1(i8* %x) nounwind { +entry: + %0 = call i8* @objc_autorelease(i8* %x) nounwind + call void @use_pointer(i8* %x) + ret void +} + +; Merge objc_retain and objc_autorelease into objc_retainAutorelease. + +; CHECK: define void @test2( +; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) nounwind +; CHECK: } +define void @test2(i8* %x) nounwind { +entry: + %0 = tail call i8* @objc_retain(i8* %x) nounwind + tail call i8* @objc_autorelease(i8* %0) nounwind + call void @use_pointer(i8* %x) + ret void +} + +; Same as test2 but the value is returned. Do an RV optimization. + +; CHECK: define i8* @test2b( +; CHECK: tail call i8* @objc_retainAutoreleaseReturnValue(i8* %x) nounwind +; CHECK: } +define i8* @test2b(i8* %x) nounwind { +entry: + %0 = tail call i8* @objc_retain(i8* %x) nounwind + tail call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind + ret i8* %x +} + +; Merge a retain,autorelease pair around a call. + +; CHECK: define void @test3( +; CHECK: tail call i8* @objc_retainAutorelease(i8* %x) nounwind +; CHECK: @use_pointer(i8* %0) +; CHECK: } +define void @test3(i8* %x, i64 %n) { +entry: + tail call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + tail call i8* @objc_autorelease(i8* %x) nounwind + ret void +} + +; Trivial retain,autorelease pair with intervening call, but it's post-dominated +; by another release. The retain and autorelease can be merged. + +; CHECK: define void @test4( +; CHECK-NEXT: entry: +; CHECK-NEXT: @objc_retainAutorelease(i8* %x) nounwind +; CHECK-NEXT: @use_pointer +; CHECK-NEXT: @objc_release +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test4(i8* %x, i64 %n) { +entry: + tail call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %x) + tail call i8* @objc_autorelease(i8* %x) nounwind + tail call void @objc_release(i8* %x) nounwind + ret void +} + +; Don't merge retain and autorelease if they're not control-equivalent. + +; CHECK: define void @test5( +; CHECK: tail call i8* @objc_retain(i8* %p) nounwind +; CHECK: true: +; CHECK: tail call i8* @objc_autorelease(i8* %0) nounwind +; CHECK: } +define void @test5(i8* %p, i1 %a) { +entry: + tail call i8* @objc_retain(i8* %p) nounwind + br i1 %a, label %true, label %false + +true: + tail call i8* @objc_autorelease(i8* %p) nounwind + call void @use_pointer(i8* %p) + ret void + +false: + ret void +} + +; Don't eliminate objc_retainAutoreleasedReturnValue by merging it into +; an objc_autorelease. +; TODO? Merge objc_retainAutoreleasedReturnValue and objc_autorelease into +; objc_retainAutoreleasedReturnValueAutorelease and merge +; objc_retainAutoreleasedReturnValue and objc_autoreleaseReturnValue +; into objc_retainAutoreleasedReturnValueAutoreleaseReturnValue? +; Those entrypoints don't exist yet though. + +; CHECK: define i8* @test6( +; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p) nounwind +; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %1) nounwind +; CHECK: } +define i8* @test6() { + %p = call i8* @returner() + tail call i8* @objc_retainAutoreleasedReturnValue(i8* %p) nounwind + %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p) nounwind + call void @use_pointer(i8* %t) + ret i8* %t +} + +; Don't spoil the RV optimization. + +; CHECK: define i8* @test7(i8* %p) +; CHECK: tail call i8* @objc_retain(i8* %p) +; CHECK: call void @use_pointer(i8* %1) +; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %1) +; CHECK: ret i8* %2 +define i8* @test7(i8* %p) { + %1 = tail call i8* @objc_retain(i8* %p) + call void @use_pointer(i8* %p) + %2 = tail call i8* @objc_autoreleaseReturnValue(i8* %p) + ret i8* %p +} diff --git a/test/Transforms/ObjCARC/dg.exp b/test/Transforms/ObjCARC/dg.exp new file mode 100644 index 0000000..f200589 --- /dev/null +++ b/test/Transforms/ObjCARC/dg.exp @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,c,cpp}]] diff --git a/test/Transforms/ObjCARC/expand.ll b/test/Transforms/ObjCARC/expand.ll new file mode 100644 index 0000000..5388673 --- /dev/null +++ b/test/Transforms/ObjCARC/expand.ll @@ -0,0 +1,28 @@ +; RUN: opt -objc-arc-expand -S < %s | FileCheck %s + +target datalayout = "e-p:64:64:64" + +declare i8* @objc_retain(i8*) +declare i8* @objc_autorelease(i8*) + +declare void @use_pointer(i8*) + +; CHECK: define void @test0 +; CHECK: call void @use_pointer(i8* %x) +; CHECK: } +define void @test0(i8* %x) nounwind { +entry: + %0 = call i8* @objc_retain(i8* %x) nounwind + call void @use_pointer(i8* %0) + ret void +} + +; CHECK: define void @test1 +; CHECK: call void @use_pointer(i8* %x) +; CHECK: } +define void @test1(i8* %x) nounwind { +entry: + %0 = call i8* @objc_autorelease(i8* %x) nounwind + call void @use_pointer(i8* %x) + ret void +} diff --git a/test/Transforms/ObjCARC/gvn.ll b/test/Transforms/ObjCARC/gvn.ll new file mode 100644 index 0000000..6917b02 --- /dev/null +++ b/test/Transforms/ObjCARC/gvn.ll @@ -0,0 +1,21 @@ +; RUN: opt -S -basicaa -objc-arc -gvn < %s | FileCheck %s + +@x = common global i8* null, align 8 + +declare i8* @objc_retain(i8*) + +; GVN should be able to eliminate this redundant load, with ARC-specific +; alias analysis. + +; CHECK: @foo +; CHECK-NEXT: entry: +; CHECK-NEXT: %s = load i8** @x +; CHECK-NOT: load +; CHECK: ret i8* %s +define i8* @foo(i32 %n) nounwind { +entry: + %s = load i8** @x + %0 = tail call i8* @objc_retain(i8* %s) nounwind + %t = load i8** @x + ret i8* %s +} diff --git a/test/Transforms/ObjCARC/invoke.ll b/test/Transforms/ObjCARC/invoke.ll new file mode 100644 index 0000000..a1b87d2 --- /dev/null +++ b/test/Transforms/ObjCARC/invoke.ll @@ -0,0 +1,67 @@ +; RUN: opt -S -objc-arc < %s | FileCheck %s + +declare i8* @objc_retain(i8*) +declare void @objc_release(i8*) +declare i8* @objc_msgSend(i8*, i8*, ...) +declare void @use_pointer(i8*) +declare void @callee() + +; ARCOpt shouldn't try to move the releases to the block containing the invoke. + +; CHECK: define void @test0( +; CHECK: invoke.cont: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: ret void +; CHECK: lpad: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: ret void +define void @test0(i8* %zipFile) { +entry: + call i8* @objc_retain(i8* %zipFile) nounwind + call void @use_pointer(i8* %zipFile) + invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*)*)(i8* %zipFile) + to label %invoke.cont unwind label %lpad + +invoke.cont: ; preds = %entry + call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 + ret void + +lpad: ; preds = %entry + call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 + ret void +} + +; ARCOpt should move the release before the callee calls. + +; CHECK: define void @test1( +; CHECK: invoke.cont: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: call void @callee() +; CHECK: br label %done +; CHECK: lpad: +; CHECK: call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 +; CHECK: call void @callee() +; CHECK: br label %done +; CHECK: done: +; CHECK-NEXT: ret void +define void @test1(i8* %zipFile) { +entry: + call i8* @objc_retain(i8* %zipFile) nounwind + call void @use_pointer(i8* %zipFile) + invoke void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*)*)(i8* %zipFile) + to label %invoke.cont unwind label %lpad + +invoke.cont: ; preds = %entry + call void @callee() + br label %done + +lpad: ; preds = %entry + call void @callee() + br label %done + +done: + call void @objc_release(i8* %zipFile) nounwind, !clang.imprecise_release !0 + ret void +} + +!0 = metadata !{} diff --git a/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll b/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll new file mode 100644 index 0000000..170d0a9 --- /dev/null +++ b/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll @@ -0,0 +1,221 @@ +; RUN: opt -S -objc-arc-contract < %s | FileCheck %s + +; The optimizer should be able to move the autorelease past a control triangle +; and various scary looking things and fold it into an objc_retainAutorelease. + +; CHECK: bb57: +; CHECK: tail call i8* @objc_retainAutorelease(i8* %tmp71x) nounwind +; CHECK: bb99: + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin11.0.0" + +%0 = type { i8* (i8*, %1*, ...)*, i8* } +%1 = type { i8*, i8* } +%2 = type { %2*, %2*, %3*, i8* (i8*, i8*)**, %4* } +%3 = type opaque +%4 = type { i32, i32, i32, i8*, i8*, %5*, %7*, %10*, i8*, %9* } +%5 = type { i32, i32, [0 x %6] } +%6 = type { i8*, i8*, i8* } +%7 = type { i64, [0 x %8*] } +%8 = type { i8*, i8*, %7*, %5*, %5*, %5*, %5*, %9*, i32, i32 } +%9 = type { i32, i32, [0 x %1] } +%10 = type { i32, i32, [0 x %11] } +%11 = type { i64*, i8*, i8*, i32, i32 } +%12 = type { i32*, i32, i8*, i64 } +%13 = type opaque +%14 = type opaque +%15 = type opaque +%16 = type opaque +%17 = type opaque +%18 = type opaque +%19 = type opaque +%20 = type opaque +%21 = type opaque +%22 = type opaque +%23 = type opaque +%24 = type opaque +%25 = type opaque + +@"\01l_objc_msgSend_fixup_alloc" = external hidden global %0, section "__DATA, __objc_msgrefs, coalesced", align 16 +@"\01L_OBJC_SELECTOR_REFERENCES_8" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_3725" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_40" = external hidden global %2*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_4227" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_4631" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_70" = external hidden global %2*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_148" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_159" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_188" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_328" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01l_objc_msgSend_fixup_objectAtIndex_" = external hidden global %0, section "__DATA, __objc_msgrefs, coalesced", align 16 +@_unnamed_cfstring_386 = external hidden constant %12, section "__DATA,__cfstring" +@"\01l_objc_msgSend_fixup_count" = external hidden global %0, section "__DATA, __objc_msgrefs, coalesced", align 16 +@"\01L_OBJC_SELECTOR_REFERENCES_389" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_391" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_393" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@NSPrintHeaderAndFooter = external constant %13* +@"\01L_OBJC_SELECTOR_REFERENCES_395" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_396" = external hidden global %2*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_398" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_400" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_402" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_404" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_406" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_408" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_CLASSLIST_REFERENCES_$_409" = external hidden global %2*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +@"\01L_OBJC_SELECTOR_REFERENCES_411" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_413" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_415" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" + +declare i8* @objc_msgSend(i8*, i8*, ...) + +declare i8* @objc_retain(i8*) + +declare void @objc_release(i8*) + +declare i8* @objc_autorelease(i8*) + +declare i8* @objc_explicit_autorelease(i8*) + +define hidden %14* @foo(%15* %arg, %16* %arg2) { +bb: + %tmp = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_3725", align 8 + %tmp4 = bitcast %15* %arg to i8* + %tmp5 = tail call %18* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %18* (i8*, i8*)*)(i8* %tmp4, i8* %tmp) + %tmp6 = bitcast %18* %tmp5 to i8* + %tmp7 = tail call i8* @objc_retain(i8* %tmp6) nounwind + %tmp8 = load %2** @"\01L_OBJC_CLASSLIST_REFERENCES_$_40", align 8 + %tmp9 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_4227", align 8 + %tmp10 = bitcast %2* %tmp8 to i8* + %tmp11 = tail call %19* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %19* (i8*, i8*)*)(i8* %tmp10, i8* %tmp9) + %tmp12 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_4631", align 8 + %tmp13 = bitcast %19* %tmp11 to i8* + %tmp14 = tail call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*, %13*)*)(i8* %tmp13, i8* %tmp12, %13* bitcast (%12* @_unnamed_cfstring_386 to %13*)) + %tmp15 = bitcast %16* %arg2 to i8* + %tmp16 = load i8** bitcast (%0* @"\01l_objc_msgSend_fixup_count" to i8**), align 16 + %tmp17 = bitcast i8* %tmp16 to i64 (i8*, %1*)* + %tmp18 = tail call i64 %tmp17(i8* %tmp15, %1* bitcast (%0* @"\01l_objc_msgSend_fixup_count" to %1*)) + %tmp19 = icmp eq i64 %tmp18, 0 + br i1 %tmp19, label %bb22, label %bb20 + +bb20: ; preds = %bb + %tmp21 = icmp eq i8 %tmp14, 0 + br label %bb25 + +bb22: ; preds = %bb + %tmp23 = bitcast i8* %tmp7 to %18* + %tmp24 = icmp eq i8 %tmp14, 0 + br i1 %tmp24, label %bb46, label %bb25 + +bb25: ; preds = %bb22, %bb20 + %tmp26 = phi i1 [ %tmp21, %bb20 ], [ false, %bb22 ] + %tmp27 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_188", align 8 + %tmp28 = tail call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %tmp7, i8* %tmp27) + %tmp29 = tail call i8* @objc_explicit_autorelease(i8* %tmp28) nounwind + %tmp30 = bitcast i8* %tmp29 to %18* + tail call void @objc_release(i8* %tmp7) nounwind + %tmp31 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_389", align 8 + %tmp32 = tail call %20* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %20* (i8*, i8*)*)(i8* %tmp29, i8* %tmp31) + %tmp33 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_391", align 8 + %tmp34 = bitcast %20* %tmp32 to i8* + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %16*)*)(i8* %tmp34, i8* %tmp33, %16* %arg2) + br i1 %tmp26, label %bb46, label %bb35 + +bb35: ; preds = %bb25 + %tmp36 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_389", align 8 + %tmp37 = tail call %20* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %20* (i8*, i8*)*)(i8* %tmp29, i8* %tmp36) + %tmp38 = load %2** @"\01L_OBJC_CLASSLIST_REFERENCES_$_70", align 8 + %tmp39 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_393", align 8 + %tmp40 = bitcast %2* %tmp38 to i8* + %tmp41 = tail call %21* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %21* (i8*, i8*, i8)*)(i8* %tmp40, i8* %tmp39, i8 signext 1) + %tmp42 = bitcast %21* %tmp41 to i8* + %tmp43 = load %13** @NSPrintHeaderAndFooter, align 8 + %tmp44 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_159", align 8 + %tmp45 = bitcast %20* %tmp37 to i8* + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8*, %13*)*)(i8* %tmp45, i8* %tmp44, i8* %tmp42, %13* %tmp43) + br label %bb46 + +bb46: ; preds = %bb35, %bb25, %bb22 + %tmp47 = phi %18* [ %tmp30, %bb35 ], [ %tmp30, %bb25 ], [ %tmp23, %bb22 ] + %tmp48 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_328", align 8 + %tmp49 = tail call %22* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %22* (i8*, i8*)*)(i8* %tmp4, i8* %tmp48) + %tmp50 = bitcast %22* %tmp49 to i8* + %tmp51 = load i8** bitcast (%0* @"\01l_objc_msgSend_fixup_count" to i8**), align 16 + %tmp52 = bitcast i8* %tmp51 to i64 (i8*, %1*)* + %tmp53 = tail call i64 %tmp52(i8* %tmp50, %1* bitcast (%0* @"\01l_objc_msgSend_fixup_count" to %1*)) + %tmp54 = icmp eq i64 %tmp53, 0 + br i1 %tmp54, label %bb55, label %bb57 + +bb55: ; preds = %bb46 + %tmp56 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_395", align 8 + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*)(i8* %tmp4, i8* %tmp56) + br label %bb57 + +bb57: ; preds = %bb55, %bb46 + %tmp58 = load %2** @"\01L_OBJC_CLASSLIST_REFERENCES_$_396", align 8 + %tmp59 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_328", align 8 + %tmp60 = tail call %22* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %22* (i8*, i8*)*)(i8* %tmp4, i8* %tmp59) + %tmp61 = bitcast %22* %tmp60 to i8* + %tmp62 = load i8** bitcast (%0* @"\01l_objc_msgSend_fixup_objectAtIndex_" to i8**), align 16 + %tmp63 = bitcast i8* %tmp62 to i8* (i8*, %1*, i64)* + %tmp64 = tail call i8* %tmp63(i8* %tmp61, %1* bitcast (%0* @"\01l_objc_msgSend_fixup_objectAtIndex_" to %1*), i64 0) + %tmp65 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_398", align 8 + %tmp66 = tail call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %tmp64, i8* %tmp65) + %tmp67 = bitcast i8* %tmp66 to %23* + %tmp68 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_400", align 8 + %tmp69 = bitcast %2* %tmp58 to i8* + %tmp70 = tail call %14* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %14* (i8*, i8*, %23*, %18*)*)(i8* %tmp69, i8* %tmp68, %23* %tmp67, %18* %tmp47) + %tmp71 = bitcast %14* %tmp70 to i8* + ; hack to prevent the optimize from using objc_retainAutoreleasedReturnValue. + %tmp71x = getelementptr i8* %tmp71, i64 1 + %tmp72 = tail call i8* @objc_retain(i8* %tmp71x) nounwind + %tmp73 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_402", align 8 + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8)*)(i8* %tmp72, i8* %tmp73, i8 signext 1) + %tmp74 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_404", align 8 + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i8)*)(i8* %tmp72, i8* %tmp74, i8 signext 1) + %tmp75 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_328", align 8 + %tmp76 = tail call %22* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %22* (i8*, i8*)*)(i8* %tmp4, i8* %tmp75) + %tmp77 = bitcast %22* %tmp76 to i8* + %tmp78 = load i8** bitcast (%0* @"\01l_objc_msgSend_fixup_objectAtIndex_" to i8**), align 16 + %tmp79 = bitcast i8* %tmp78 to i8* (i8*, %1*, i64)* + %tmp80 = tail call i8* %tmp79(i8* %tmp77, %1* bitcast (%0* @"\01l_objc_msgSend_fixup_objectAtIndex_" to %1*), i64 0) + %tmp81 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_406", align 8 + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i64)*)(i8* %tmp80, i8* %tmp81, i64 9223372036854775807) + %tmp82 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_408", align 8 + %tmp83 = tail call %24* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %24* (i8*, i8*)*)(i8* %tmp72, i8* %tmp82) + %tmp84 = bitcast %24* %tmp83 to i8* + %tmp85 = tail call i8* @objc_retain(i8* %tmp84) nounwind + %tmp86 = load %2** @"\01L_OBJC_CLASSLIST_REFERENCES_$_409", align 8 + %tmp87 = bitcast %2* %tmp86 to i8* + %tmp88 = load i8** bitcast (%0* @"\01l_objc_msgSend_fixup_alloc" to i8**), align 16 + %tmp89 = bitcast i8* %tmp88 to i8* (i8*, %1*)* + %tmp90 = tail call i8* %tmp89(i8* %tmp87, %1* bitcast (%0* @"\01l_objc_msgSend_fixup_alloc" to %1*)) + %tmp91 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_8", align 8 + %tmp92 = tail call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %tmp90, i8* %tmp91) + %tmp93 = tail call i8* @objc_explicit_autorelease(i8* %tmp92) nounwind + %tmp94 = bitcast i8* %tmp93 to %25* + %tmp95 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_411", align 8 + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %25*)*)(i8* %tmp85, i8* %tmp95, %25* %tmp94) + tail call void @objc_release(i8* %tmp93) nounwind + %tmp96 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_148", align 8 + %tmp97 = tail call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*)*)(i8* %tmp4, i8* %tmp96) + %tmp98 = icmp eq i8 %tmp97, 0 + br i1 %tmp98, label %bb99, label %bb104 + +bb99: ; preds = %bb57 + %tmp100 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_413", align 8 + %tmp101 = tail call i64 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i64 (i8*, i8*)*)(i8* %tmp85, i8* %tmp100) + %tmp102 = or i64 %tmp101, 12 + %tmp103 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_415", align 8 + tail call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i64)*)(i8* %tmp85, i8* %tmp103, i64 %tmp102) + br label %bb104 + +bb104: ; preds = %bb99, %bb57 + %tmp105 = tail call i8* @objc_autorelease(i8* %tmp72) nounwind + %tmp106 = bitcast i8* %tmp105 to %14* + tail call void @objc_release(i8* %tmp85) nounwind + %tmp107 = bitcast %18* %tmp47 to i8* + tail call void @objc_release(i8* %tmp107) nounwind + ret %14* %tmp106 +} diff --git a/test/Transforms/ObjCARC/move-and-merge-autorelease.ll b/test/Transforms/ObjCARC/move-and-merge-autorelease.ll new file mode 100644 index 0000000..8462c70 --- /dev/null +++ b/test/Transforms/ObjCARC/move-and-merge-autorelease.ll @@ -0,0 +1,108 @@ +; RUN: opt -S -objc-arc < %s | FileCheck %s + +; The optimizer should be able to move the autorelease past two phi nodes +; and fold it with the release in bb65. + +; CHECK: bb65: +; CHECK: call i8* @objc_retainAutorelease +; CHECK: br label %bb76 + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin11.0.0" + +%0 = type opaque +%1 = type opaque +%2 = type opaque +%3 = type opaque +%4 = type opaque +%5 = type opaque + +@"\01L_OBJC_SELECTOR_REFERENCES_11" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_421455" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_598" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_620" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_622" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_624" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +@"\01L_OBJC_SELECTOR_REFERENCES_626" = external hidden global i8*, section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" + +declare i8* @objc_msgSend(i8*, i8*, ...) + +declare i8* @objc_retain(i8*) + +declare void @objc_release(i8*) + +declare i8* @objc_autorelease(i8*) + +define hidden %0* @foo(%1* %arg, %3* %arg3) { +bb: + %tmp16 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_620", align 8 + %tmp17 = bitcast %3* %arg3 to i8* + %tmp18 = call %4* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %4* (i8*, i8*)*)(i8* %tmp17, i8* %tmp16) + %tmp19 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_622", align 8 + %tmp20 = bitcast %4* %tmp18 to i8* + %tmp21 = call %5* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %5* (i8*, i8*)*)(i8* %tmp20, i8* %tmp19) + %tmp22 = bitcast %5* %tmp21 to i8* + %tmp23 = call i8* @objc_retain(i8* %tmp22) nounwind + %tmp24 = bitcast i8* %tmp23 to %5* + %tmp26 = icmp eq i8* %tmp23, null + br i1 %tmp26, label %bb81, label %bb27 + +bb27: ; preds = %bb + %tmp29 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_11", align 8 + %tmp30 = bitcast %1* %arg to i8* + %tmp31 = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* %tmp30, i8* %tmp29) + %tmp34 = call i8* @objc_retain(i8* %tmp31) nounwind + %tmp37 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_421455", align 8 + %tmp39 = call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*)*)(i8* %tmp34, i8* %tmp37) + %tmp40 = bitcast %0* %tmp39 to i8* + %tmp41 = call i8* @objc_retain(i8* %tmp40) nounwind + %tmp42 = bitcast i8* %tmp41 to %0* + %tmp44 = icmp eq i8* %tmp41, null + br i1 %tmp44, label %bb45, label %bb55 + +bb45: ; preds = %bb27 + %tmp47 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_624", align 8 + %tmp49 = call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*)*)(i8* %tmp34, i8* %tmp47) + %tmp51 = bitcast %0* %tmp49 to i8* + %tmp52 = call i8* @objc_retain(i8* %tmp51) nounwind + call void @objc_release(i8* %tmp41) nounwind + br label %bb55 + +bb55: ; preds = %bb27, %bb45 + %tmp13.0 = phi %0* [ %tmp42, %bb27 ], [ %tmp49, %bb45 ] + %tmp57 = icmp eq %0* %tmp13.0, null + br i1 %tmp57, label %bb76, label %bb58 + +bb58: ; preds = %bb55 + %tmp60 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_598", align 8 + %tmp61 = bitcast %0* %tmp13.0 to i8* + %tmp62 = call signext i8 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8 (i8*, i8*)*)(i8* %tmp61, i8* %tmp60) + %tmp64 = icmp eq i8 %tmp62, 0 + br i1 %tmp64, label %bb76, label %bb65 + +bb65: ; preds = %bb58 + %tmp68 = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_626", align 8 + %tmp69 = bitcast %0* %tmp13.0 to i8* + %tmp70 = call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %5*)*)(i8* %tmp69, i8* %tmp68, %5* %tmp24) + %tmp72 = bitcast %0* %tmp70 to i8* + %tmp73 = call i8* @objc_retain(i8* %tmp72) nounwind + br label %bb76 + +bb76: ; preds = %bb58, %bb55, %bb65 + %tmp10.0 = phi %0* [ %tmp70, %bb65 ], [ null, %bb58 ], [ null, %bb55 ] + %tmp78 = bitcast %0* %tmp13.0 to i8* + call void @objc_release(i8* %tmp78) nounwind + call void @objc_release(i8* %tmp34) nounwind + br label %bb81 + +bb81: ; preds = %bb, %bb76 + %tmp10.1 = phi %0* [ %tmp10.0, %bb76 ], [ null, %bb ] + %tmp83 = bitcast %0* %tmp10.1 to i8* + %tmp84 = call i8* @objc_retain(i8* %tmp83) nounwind + %tmp88 = bitcast i8* %tmp87 to %0* + call void @objc_release(i8* %tmp23) nounwind + %tmp87 = call i8* @objc_autorelease(i8* %tmp84) nounwind + %tmp92 = bitcast %0* %tmp10.1 to i8* + call void @objc_release(i8* %tmp92) nounwind + ret %0* %tmp88 +} diff --git a/test/Transforms/ObjCARC/post-inlining.ll b/test/Transforms/ObjCARC/post-inlining.ll new file mode 100644 index 0000000..ad69ccd --- /dev/null +++ b/test/Transforms/ObjCARC/post-inlining.ll @@ -0,0 +1,48 @@ +; RUN: opt -S -objc-arc < %s | FileCheck %s + +declare void @use_pointer(i8*) +declare i8* @returner() +declare i8* @objc_retain(i8*) +declare i8* @objc_autoreleaseReturnValue(i8*) +declare i8* @objc_retainAutoreleasedReturnValue(i8*) + +; Clean up residue left behind after inlining. + +; CHECK: define void @test0( +; CHECK: entry: +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test0(i8* %call.i) { +entry: + %0 = tail call i8* @objc_retain(i8* %call.i) nounwind + %1 = tail call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind + ret void +} + +; Same as test0, but with slightly different use arrangements. + +; CHECK: define void @test1( +; CHECK: entry: +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test1(i8* %call.i) { +entry: + %0 = tail call i8* @objc_retain(i8* %call.i) nounwind + %1 = tail call i8* @objc_autoreleaseReturnValue(i8* %call.i) nounwind + ret void +} + +; Delete a retainRV+autoreleaseRV even if the pointer is used. + +; CHECK: define void @test24( +; CHECK-NEXT: entry: +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test24(i8* %p) { +entry: + call i8* @objc_autoreleaseReturnValue(i8* %p) nounwind + call i8* @objc_retainAutoreleasedReturnValue(i8* %p) nounwind + call void @use_pointer(i8* %p) + ret void +} diff --git a/test/Transforms/ObjCARC/retain-not-declared.ll b/test/Transforms/ObjCARC/retain-not-declared.ll new file mode 100644 index 0000000..e1fe117 --- /dev/null +++ b/test/Transforms/ObjCARC/retain-not-declared.ll @@ -0,0 +1,25 @@ +; RUN: opt -S -objc-arc -objc-arc-contract < %s | FileCheck %s + +; Test that the optimizer can create an objc_retainAutoreleaseReturnValue +; declaration even if no objc_retain declaration exists. +; rdar://9401303 + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +declare i8* @objc_unretainedObject(i8*) +declare i8* @objc_retainAutoreleasedReturnValue(i8*) +declare i8* @objc_autoreleaseReturnValue(i8*) + +; CHECK: define i8* @foo(i8* %p) { +; CHECK-NEXT: entry: +; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleaseReturnValue(i8* %p) nounwind +; CHECK-NEXT: ret i8* %0 +; CHECK-NEXT: } + +define i8* @foo(i8* %p) { +entry: + %call = tail call i8* @objc_unretainedObject(i8* %p) + %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind + %1 = tail call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind + ret i8* %1 +} + diff --git a/test/Transforms/ObjCARC/rle-s2l.ll b/test/Transforms/ObjCARC/rle-s2l.ll new file mode 100644 index 0000000..8f8d5c0 --- /dev/null +++ b/test/Transforms/ObjCARC/rle-s2l.ll @@ -0,0 +1,135 @@ +; RUN: opt -S -basicaa -objc-arc < %s | FileCheck %s + +declare i8* @objc_loadWeak(i8**) +declare i8* @objc_loadWeakRetained(i8**) +declare i8* @objc_storeWeak(i8**, i8*) +declare i8* @objc_initWeak(i8**, i8*) +declare void @use_pointer(i8*) +declare void @callee() + +; Basic redundant @objc_loadWeak elimination. + +; CHECK: define void @test0(i8** %p) { +; CHECK-NEXT: %y = call i8* @objc_loadWeak(i8** %p) +; CHECK-NEXT: call void @use_pointer(i8* %y) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test0(i8** %p) { + %x = call i8* @objc_loadWeak(i8** %p) + %y = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; DCE the @objc_loadWeak. + +; CHECK: define void @test1(i8** %p) { +; CHECK-NEXT: %y = call i8* @objc_loadWeakRetained(i8** %p) +; CHECK-NEXT: call void @use_pointer(i8* %y) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test1(i8** %p) { + %x = call i8* @objc_loadWeak(i8** %p) + %y = call i8* @objc_loadWeakRetained(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; Basic redundant @objc_loadWeakRetained elimination. + +; CHECK: define void @test2(i8** %p) { +; CHECK-NEXT: %x = call i8* @objc_loadWeak(i8** %p) +; CHECK-NEXT: store i8 3, i8* %x +; CHECK-NEXT: %1 = tail call i8* @objc_retain(i8* %x) +; CHECK-NEXT: call void @use_pointer(i8* %x) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test2(i8** %p) { + %x = call i8* @objc_loadWeak(i8** %p) + store i8 3, i8* %x + %y = call i8* @objc_loadWeakRetained(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; Basic redundant @objc_loadWeakRetained elimination, this time +; with a readonly call instead of a store. + +; CHECK: define void @test3(i8** %p) { +; CHECK-NEXT: %x = call i8* @objc_loadWeak(i8** %p) +; CHECK-NEXT: call void @use_pointer(i8* %x) readonly +; CHECK-NEXT: %1 = tail call i8* @objc_retain(i8* %x) +; CHECK-NEXT: call void @use_pointer(i8* %x) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test3(i8** %p) { + %x = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %x) readonly + %y = call i8* @objc_loadWeakRetained(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; A regular call blocks redundant weak load elimination. + +; CHECK: define void @test4(i8** %p) { +; CHECK-NEXT: %x = call i8* @objc_loadWeak(i8** %p) +; CHECK-NEXT: call void @use_pointer(i8* %x) readonly +; CHECK-NEXT: call void @callee() +; CHECK-NEXT: %y = call i8* @objc_loadWeak(i8** %p) +; CHECK-NEXT: call void @use_pointer(i8* %y) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test4(i8** %p) { + %x = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %x) readonly + call void @callee() + %y = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; Store to load forwarding. + +; CHECK: define void @test5(i8** %p, i8* %n) { +; CHECK-NEXT: %1 = call i8* @objc_storeWeak(i8** %p, i8* %n) +; CHECK-NEXT: call void @use_pointer(i8* %n) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test5(i8** %p, i8* %n) { + call i8* @objc_storeWeak(i8** %p, i8* %n) + %y = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; Store to load forwarding with objc_initWeak. + +; CHECK: define void @test6(i8** %p, i8* %n) { +; CHECK-NEXT: %1 = call i8* @objc_initWeak(i8** %p, i8* %n) +; CHECK-NEXT: call void @use_pointer(i8* %n) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test6(i8** %p, i8* %n) { + call i8* @objc_initWeak(i8** %p, i8* %n) + %y = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %y) + ret void +} + +; Don't forward if there's a may-alias store in the way. + +; CHECK: define void @test7(i8** %p, i8* %n, i8** %q, i8* %m) { +; CHECK-NEXT: call i8* @objc_initWeak(i8** %p, i8* %n) +; CHECK-NEXT: call i8* @objc_storeWeak(i8** %q, i8* %m) +; CHECK-NEXT: %y = call i8* @objc_loadWeak(i8** %p) +; CHECK-NEXT: call void @use_pointer(i8* %y) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test7(i8** %p, i8* %n, i8** %q, i8* %m) { + call i8* @objc_initWeak(i8** %p, i8* %n) + call i8* @objc_storeWeak(i8** %q, i8* %m) + %y = call i8* @objc_loadWeak(i8** %p) + call void @use_pointer(i8* %y) + ret void +} diff --git a/test/Transforms/ObjCARC/rv.ll b/test/Transforms/ObjCARC/rv.ll new file mode 100644 index 0000000..da53a86 --- /dev/null +++ b/test/Transforms/ObjCARC/rv.ll @@ -0,0 +1,331 @@ +; RUN: opt -objc-arc -S < %s | FileCheck %s + +target datalayout = "e-p:64:64:64" + +declare i8* @objc_retain(i8*) +declare i8* @objc_retainAutoreleasedReturnValue(i8*) +declare void @objc_release(i8*) +declare i8* @objc_autorelease(i8*) +declare i8* @objc_autoreleaseReturnValue(i8*) +declare i8* @objc_retainAutoreleaseReturnValue(i8*) +declare void @objc_autoreleasePoolPop(i8*) +declare void @objc_autoreleasePoolPush() +declare i8* @objc_retainBlock(i8*) + +declare i8* @objc_retainedObject(i8*) +declare i8* @objc_unretainedObject(i8*) +declare i8* @objc_unretainedPointer(i8*) + +declare void @use_pointer(i8*) +declare void @callee() +declare void @callee_fnptr(void ()*) +declare void @invokee() +declare i8* @returner() + +; Test that retain+release elimination is suppressed when the +; retain is an objc_retainAutoreleasedReturnValue, since it's +; better to do the RV optimization. + +; CHECK: define void @test0( +; CHECK-NEXT: entry: +; CHECK-NEXT: %x = call i8* @returner +; CHECK-NEXT: %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %x) nounwind +; CHECK: t: +; CHECK-NOT: @objc_ +; CHECK: return: +; CHECK-NEXT: call void @objc_release(i8* %x) +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @test0(i1 %p) nounwind { +entry: + %x = call i8* @returner() + %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %x) + br i1 %p, label %t, label %return + +t: + call void @use_pointer(i8* %x) + store i8 0, i8* %x + br label %return + +return: + call void @objc_release(i8* %x) nounwind + ret void +} + +; Delete no-ops. + +; CHECK: define void @test2 +; CHECK-NOT: @objc_ +; CHECK: } +define void @test2() { + call i8* @objc_retainAutoreleasedReturnValue(i8* null) + call i8* @objc_autoreleaseReturnValue(i8* null) + ; call i8* @objc_retainAutoreleaseReturnValue(i8* null) ; TODO + ret void +} + +; Delete a redundant retainRV,autoreleaseRV when forwaring a call result +; directly to a return value. + +; CHECK: define i8* @test3 +; CHECK: call i8* @returner() +; CHECK-NEXT: ret i8* %call +define i8* @test3() { +entry: + %call = call i8* @returner() + %0 = call i8* @objc_retainAutoreleasedReturnValue(i8* %call) nounwind + %1 = call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind + ret i8* %1 +} + +; Delete a redundant retain,autoreleaseRV when forwaring a call result +; directly to a return value. + +; CHECK: define i8* @test4 +; CHECK: call i8* @returner() +; CHECK-NEXT: ret i8* %call +define i8* @test4() { +entry: + %call = call i8* @returner() + %0 = call i8* @objc_retain(i8* %call) nounwind + %1 = call i8* @objc_autoreleaseReturnValue(i8* %0) nounwind + ret i8* %1 +} + +; Delete a redundant fused retain+autoreleaseRV when forwaring a call result +; directly to a return value. + +; TODO +; HECK: define i8* @test5 +; HECK: call i8* @returner() +; HECK-NEXT: ret i8* %call +;define i8* @test5() { +;entry: +; %call = call i8* @returner() +; %0 = call i8* @objc_retainAutoreleaseReturnValue(i8* %call) nounwind +; ret i8* %0 +;} + +; Don't eliminate objc_retainAutoreleasedReturnValue by merging it into +; an objc_autorelease. +; TODO? Merge objc_retainAutoreleasedReturnValue and objc_autorelease into +; objc_retainAutoreleasedReturnValueAutorelease and merge +; objc_retainAutoreleasedReturnValue and objc_autoreleaseReturnValue +; into objc_retainAutoreleasedReturnValueAutoreleaseReturnValue? +; Those entrypoints don't exist yet though. + +; CHECK: define i8* @test7( +; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %p) +; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p) +define i8* @test7() { + %p = call i8* @returner() + call i8* @objc_retainAutoreleasedReturnValue(i8* %p) + %t = call i8* @objc_autoreleaseReturnValue(i8* %p) + call void @use_pointer(i8* %t) + ret i8* %t +} + +; CHECK: define i8* @test7b( +; CHECK: call i8* @objc_retain(i8* %p) +; CHECK: %t = tail call i8* @objc_autoreleaseReturnValue(i8* %p) +define i8* @test7b() { + %p = call i8* @returner() + call void @use_pointer(i8* %p) + call i8* @objc_retainAutoreleasedReturnValue(i8* %p) + %t = call i8* @objc_autoreleaseReturnValue(i8* %p) + ret i8* %t +} + +; Turn objc_retain into objc_retainAutoreleasedReturnValue if its operand +; is a return value. + +; CHECK: define void @test8() +; CHECK: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %p) +define void @test8() { + %p = call i8* @returner() + call i8* @objc_retain(i8* %p) + ret void +} + +; Don't apply the RV optimization to autorelease if there's no retain. + +; CHECK: define i8* @test9(i8* %p) +; CHECK: tail call i8* @objc_autorelease(i8* %p) +define i8* @test9(i8* %p) { + call i8* @objc_autorelease(i8* %p) + ret i8* %p +} + +; Apply the RV optimization. + +; CHECK: define i8* @test10(i8* %p) +; CHECK: tail call i8* @objc_retain(i8* %p) nounwind +; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %p) nounwind +; CHECK-NEXT: ret i8* %p +define i8* @test10(i8* %p) { + %1 = call i8* @objc_retain(i8* %p) + %2 = call i8* @objc_autorelease(i8* %p) + ret i8* %p +} + +; Don't do the autoreleaseRV optimization because @use_pointer +; could undo the retain. + +; CHECK: define i8* @test11(i8* %p) +; CHECK: tail call i8* @objc_retain(i8* %p) +; CHECK-NEXT: call void @use_pointer(i8* %p) +; CHECK: tail call i8* @objc_autorelease(i8* %p) +; CHECK-NEXT: ret i8* %p +define i8* @test11(i8* %p) { + %1 = call i8* @objc_retain(i8* %p) + call void @use_pointer(i8* %p) + %2 = call i8* @objc_autorelease(i8* %p) + ret i8* %p +} + +; Don't spoil the RV optimization. + +; CHECK: define i8* @test12(i8* %p) +; CHECK: tail call i8* @objc_retain(i8* %p) +; CHECK: call void @use_pointer(i8* %p) +; CHECK: tail call i8* @objc_autoreleaseReturnValue(i8* %p) +; CHECK: ret i8* %p +define i8* @test12(i8* %p) { + %1 = call i8* @objc_retain(i8* %p) + call void @use_pointer(i8* %p) + %2 = call i8* @objc_autoreleaseReturnValue(i8* %p) + ret i8* %p +} + +; Don't zap the objc_retainAutoreleasedReturnValue. + +; CHECK: define i8* @test13( +; CHECK: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %p) +; CHECK: tail call i8* @objc_autorelease(i8* %p) +; CHECK: ret i8* %p +define i8* @test13() { + %p = call i8* @returner() + %1 = call i8* @objc_retainAutoreleasedReturnValue(i8* %p) + call void @callee() + %2 = call i8* @objc_autorelease(i8* %p) + ret i8* %p +} + +; Convert objc_retainAutoreleasedReturnValue to objc_retain if its +; argument is not a return value. + +; CHECK: define void @test14( +; CHECK-NEXT: tail call i8* @objc_retain(i8* %p) nounwind +; CHECK-NEXT: ret void +define void @test14(i8* %p) { + call i8* @objc_retainAutoreleasedReturnValue(i8* %p) + ret void +} + +; Don't convert objc_retainAutoreleasedReturnValue to objc_retain if its +; argument is a return value. + +; CHECK: define void @test15( +; CHECK-NEXT: %y = call i8* @returner() +; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) nounwind +; CHECK-NEXT: ret void +define void @test15() { + %y = call i8* @returner() + call i8* @objc_retainAutoreleasedReturnValue(i8* %y) + ret void +} + +; Convert objc_retain to objc_retainAutoreleasedReturnValue if its +; argument is a return value. + +; CHECK: define void @test16( +; CHECK-NEXT: %y = call i8* @returner() +; CHECK-NEXT: tail call i8* @objc_retainAutoreleasedReturnValue(i8* %y) nounwind +; CHECK-NEXT: ret void +define void @test16() { + %y = call i8* @returner() + call i8* @objc_retain(i8* %y) + ret void +} + +; Don't convert objc_retain to objc_retainAutoreleasedReturnValue if its +; argument is not a return value. + +; CHECK: define void @test17( +; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) nounwind +; CHECK-NEXT: ret void +define void @test17(i8* %y) { + call i8* @objc_retain(i8* %y) + ret void +} + +; Don't Convert objc_retain to objc_retainAutoreleasedReturnValue if it +; isn't next to the call providing its return value. + +; CHECK: define void @test18( +; CHECK-NEXT: %y = call i8* @returner() +; CHECK-NEXT: call void @callee() +; CHECK-NEXT: tail call i8* @objc_retain(i8* %y) nounwind +; CHECK-NEXT: ret void +define void @test18() { + %y = call i8* @returner() + call void @callee() + call i8* @objc_retain(i8* %y) + ret void +} + +; Delete autoreleaseRV+retainRV pairs. + +; CHECK: define i8* @test19(i8* %p) { +; CHECK-NEXT: ret i8* %p +define i8* @test19(i8* %p) { + call i8* @objc_autoreleaseReturnValue(i8* %p) + call i8* @objc_retainAutoreleasedReturnValue(i8* %p) + ret i8* %p +} + +; Like test19 but with plain autorelease. + +; CHECK: define i8* @test20(i8* %p) { +; CHECK-NEXT: call i8* @objc_autorelease(i8* %p) +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: ret i8* %p +define i8* @test20(i8* %p) { + call i8* @objc_autorelease(i8* %p) + call i8* @objc_retainAutoreleasedReturnValue(i8* %p) + ret i8* %p +} + +; Like test19 but with plain retain. + +; CHECK: define i8* @test21(i8* %p) { +; CHECK-NEXT: call i8* @objc_autoreleaseReturnValue(i8* %p) +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: ret i8* %p +define i8* @test21(i8* %p) { + call i8* @objc_autoreleaseReturnValue(i8* %p) + call i8* @objc_retain(i8* %p) + ret i8* %p +} + +; Like test19 but with plain retain and autorelease. + +; CHECK: define i8* @test22(i8* %p) { +; CHECK-NEXT: call i8* @objc_autorelease(i8* %p) +; CHECK-NEXT: call i8* @objc_retain(i8* %p) +; CHECK-NEXT: ret i8* %p +define i8* @test22(i8* %p) { + call i8* @objc_autorelease(i8* %p) + call i8* @objc_retain(i8* %p) + ret i8* %p +} + +; Convert autoreleaseRV to autorelease. + +; CHECK: define void @test23( +; CHECK: tail call i8* @objc_autorelease(i8* %p) nounwind +define void @test23(i8* %p) { + store i8 0, i8* %p + call i8* @objc_autoreleaseReturnValue(i8* %p) + ret void +} diff --git a/test/Transforms/ObjCARC/weak-contract.ll b/test/Transforms/ObjCARC/weak-contract.ll new file mode 100644 index 0000000..ca69c70 --- /dev/null +++ b/test/Transforms/ObjCARC/weak-contract.ll @@ -0,0 +1,14 @@ +; RUN: opt -objc-arc-contract -S < %s | FileCheck %s + +declare i8* @objc_initWeak(i8**, i8*) + +; Convert objc_initWeak(p, null) to *p = null. + +; CHECK: define i8* @test0(i8** %p) { +; CHECK-NEXT: store i8* null, i8** %p +; CHECK-NEXT: ret i8* null +; CHECK-NEXT: } +define i8* @test0(i8** %p) { + %t = call i8* @objc_initWeak(i8** %p, i8* null) + ret i8* %t +} diff --git a/test/Transforms/ObjCARC/weak-copies.ll b/test/Transforms/ObjCARC/weak-copies.ll new file mode 100644 index 0000000..e1a94bb --- /dev/null +++ b/test/Transforms/ObjCARC/weak-copies.ll @@ -0,0 +1,87 @@ +; RUN: opt -S -basicaa -objc-arc < %s | FileCheck %s + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin11.0.0" + +%0 = type { i64, i64, i8*, i8*, i8*, i8* } +%1 = type <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, i8* }> +%struct.__block_descriptor = type { i64, i64 } + +@_NSConcreteStackBlock = external global i8* +@.str = private unnamed_addr constant [6 x i8] c"v8@?0\00" +@"\01L_OBJC_CLASS_NAME_" = internal global [3 x i8] c"\01@\00", section "__TEXT,__objc_classname,cstring_literals", align 1 +@__block_descriptor_tmp = internal constant %0 { i64 0, i64 40, i8* bitcast (void (i8*, i8*)* @__copy_helper_block_ to i8*), i8* bitcast (void (i8*)* @__destroy_helper_block_ to i8*), i8* getelementptr inbounds ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0) } +@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__DATA, __objc_imageinfo, regular, no_dead_strip" +@llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @"\01L_OBJC_CLASS_NAME_", i32 0, i32 0), i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*)], section "llvm.metadata" + +; Eliminate unnecessary weak pointer copies. + +; CHECK: define void @foo() { +; CHECK-NEXT: entry: +; CHECK-NEXT: %call = call i8* @bar() +; CHECK-NEXT: call void @use(i8* %call) nounwind +; CHECK-NEXT: ret void +; CHECK-NEXT: } +define void @foo() { +entry: + %w = alloca i8*, align 8 + %x = alloca i8*, align 8 + %call = call i8* @bar() + %0 = call i8* @objc_initWeak(i8** %w, i8* %call) nounwind + %1 = call i8* @objc_loadWeak(i8** %w) nounwind + %2 = call i8* @objc_initWeak(i8** %x, i8* %1) nounwind + %3 = call i8* @objc_loadWeak(i8** %x) nounwind + call void @use(i8* %3) nounwind + call void @objc_destroyWeak(i8** %x) nounwind + call void @objc_destroyWeak(i8** %w) nounwind + ret void +} + +; Eliminate unnecessary weak pointer copies in a block initialization. + +; CHECK: define void @qux(i8* %me) nounwind { +; CHECK-NEXT: entry: +; CHECK-NEXT: %block = alloca %1, align 8 +; CHECK-NOT: alloca +; CHECK: } +define void @qux(i8* %me) nounwind { +entry: + %w = alloca i8*, align 8 + %block = alloca %1, align 8 + %0 = call i8* @objc_retain(i8* %me) nounwind + %1 = call i8* @objc_initWeak(i8** %w, i8* %0) nounwind + %block.isa = getelementptr inbounds %1* %block, i64 0, i32 0 + store i8* bitcast (i8** @_NSConcreteStackBlock to i8*), i8** %block.isa, align 8 + %block.flags = getelementptr inbounds %1* %block, i64 0, i32 1 + store i32 1107296256, i32* %block.flags, align 8 + %block.reserved = getelementptr inbounds %1* %block, i64 0, i32 2 + store i32 0, i32* %block.reserved, align 4 + %block.invoke = getelementptr inbounds %1* %block, i64 0, i32 3 + store i8* bitcast (void (i8*)* @__qux_block_invoke_0 to i8*), i8** %block.invoke, align 8 + %block.descriptor = getelementptr inbounds %1* %block, i64 0, i32 4 + store %struct.__block_descriptor* bitcast (%0* @__block_descriptor_tmp to %struct.__block_descriptor*), %struct.__block_descriptor** %block.descriptor, align 8 + %block.captured = getelementptr inbounds %1* %block, i64 0, i32 5 + %2 = call i8* @objc_loadWeak(i8** %w) nounwind + %3 = call i8* @objc_initWeak(i8** %block.captured, i8* %2) nounwind + %4 = bitcast %1* %block to void ()* + call void @use_block(void ()* %4) nounwind + call void @objc_destroyWeak(i8** %block.captured) nounwind + call void @objc_destroyWeak(i8** %w) nounwind + call void @objc_release(i8* %0) nounwind, !clang.imprecise_release !0 + ret void +} + +declare i8* @objc_retain(i8*) +declare void @use_block(void ()*) nounwind +declare void @__qux_block_invoke_0(i8* %.block_descriptor) nounwind +declare void @__copy_helper_block_(i8*, i8*) nounwind +declare void @objc_copyWeak(i8**, i8**) +declare void @__destroy_helper_block_(i8*) nounwind +declare void @objc_release(i8*) +declare i8* @bar() +declare i8* @objc_initWeak(i8**, i8*) +declare i8* @objc_loadWeak(i8**) +declare void @use(i8*) nounwind +declare void @objc_destroyWeak(i8**) + +!0 = metadata !{} diff --git a/test/Transforms/ObjCARC/weak.ll b/test/Transforms/ObjCARC/weak.ll new file mode 100644 index 0000000..85a290c --- /dev/null +++ b/test/Transforms/ObjCARC/weak.ll @@ -0,0 +1,57 @@ +; RUN: opt -objc-arc -S < %s | FileCheck %s + +declare i8* @objc_initWeak(i8**, i8*) +declare i8* @objc_storeWeak(i8**, i8*) +declare i8* @objc_loadWeak(i8**) +declare void @objc_destroyWeak(i8**) +declare i8* @objc_loadWeakRetained(i8**) +declare void @objc_moveWeak(i8**, i8**) +declare void @objc_copyWeak(i8**, i8**) + +; If the pointer-to-weak-pointer is null, it's undefined behavior. + +; CHECK: define void @test0( +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: store i8* undef, i8** null +; CHECK: ret void +define void @test0(i8* %p, i8** %q) { +entry: + call i8* @objc_storeWeak(i8** null, i8* %p) + call i8* @objc_storeWeak(i8** undef, i8* %p) + call i8* @objc_loadWeakRetained(i8** null) + call i8* @objc_loadWeakRetained(i8** undef) + call i8* @objc_loadWeak(i8** null) + call i8* @objc_loadWeak(i8** undef) + call i8* @objc_initWeak(i8** null, i8* %p) + call i8* @objc_initWeak(i8** undef, i8* %p) + call void @objc_destroyWeak(i8** null) + call void @objc_destroyWeak(i8** undef) + + call void @objc_copyWeak(i8** null, i8** %q) + call void @objc_copyWeak(i8** undef, i8** %q) + call void @objc_copyWeak(i8** %q, i8** null) + call void @objc_copyWeak(i8** %q, i8** undef) + + call void @objc_moveWeak(i8** null, i8** %q) + call void @objc_moveWeak(i8** undef, i8** %q) + call void @objc_moveWeak(i8** %q, i8** null) + call void @objc_moveWeak(i8** %q, i8** undef) + + ret void +} diff --git a/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll b/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll deleted file mode 100644 index 33e0cfa..0000000 --- a/test/Transforms/PruneEH/2008-09-05-CGUpdate.ll +++ /dev/null @@ -1,1445 +0,0 @@ -; RUN: opt < %s -prune-eh -inline -print-callgraph \ -; RUN: -disable-output |& \ -; RUN: grep {calls.*ce3806g__fxio__put__put_int64__4.1339} | count 2 - %struct.FRAME.ce3806g = type { %struct.string___XUB, %struct.string___XUB, %struct.string___XUB, %struct.string___XUB } - %struct.FRAME.ce3806g__fxio__put__4 = type { i32, i32, i32, %struct.system__file_control_block__pstring*, i32, i32, i8 } - %struct.RETURN = type { i8, i32 } - %struct.ada__streams__root_stream_type = type { %struct.ada__tags__dispatch_table* } - %struct.ada__tags__dispatch_table = type { [1 x i32] } - %struct.ada__tags__select_specific_data = type { i32, %struct.ada__tags__select_specific_data_element } - %struct.ada__tags__select_specific_data_element = type { i32, i8 } - %struct.ada__tags__type_specific_data = type { i32, i32, [2147483647 x i8]*, [2147483647 x i8]*, %struct.ada__tags__dispatch_table*, i8, i32, i32, i32, i32, [2 x %struct.ada__tags__dispatch_table*] } - %struct.ada__text_io__text_afcb = type { %struct.system__file_control_block__afcb, i32, i32, i32, i32, i32, %struct.ada__text_io__text_afcb*, i8, i8 } - %struct.exception = type { i8, i8, i32, i8*, i8*, i32, i8* } - %struct.long_long_float___PAD = type { x86_fp80, [1 x i32] } - %struct.string___XUB = type { i32, i32 } - %struct.system__file_control_block__afcb = type { %struct.ada__streams__root_stream_type, i32, %struct.system__file_control_block__pstring, %struct.system__file_control_block__pstring, i8, i8, i8, i8, i8, i8, i8, %struct.system__file_control_block__afcb*, %struct.system__file_control_block__afcb* } - %struct.system__file_control_block__pstring = type { i8*, %struct.string___XUB* } - %struct.system__finalization_implementation__limited_record_controller = type { %struct.system__finalization_root__root_controlled, %struct.system__finalization_root__root_controlled* } - %struct.system__finalization_implementation__record_controller = type { %struct.system__finalization_implementation__limited_record_controller, i32 } - %struct.system__finalization_root__empty_root_controlled = type { %struct.ada__tags__dispatch_table* } - %struct.system__finalization_root__root_controlled = type { %struct.ada__streams__root_stream_type, %struct.system__finalization_root__root_controlled*, %struct.system__finalization_root__root_controlled* } - %struct.system__secondary_stack__mark_id = type { i32, i32 } - %struct.system__standard_library__exception_data = type { i8, i8, i32, i32, %struct.system__standard_library__exception_data*, i32, void ()* } -@.str = internal constant [12 x i8] c"system.ads\00\00" ; <[12 x i8]*> [#uses=1] -@.str1 = internal constant [14 x i8] c"a-tifiio.adb\00\00" ; <[14 x i8]*> [#uses=1] -@system__soft_links__abort_undefer = external global void ()* ; <void ()**> [#uses=6] -@.str2 = internal constant [47 x i8] c"a-tifiio.adb:327 instantiated at ce3806g.adb:52" ; <[47 x i8]*> [#uses=1] -@C.354.2200 = internal constant %struct.string___XUB { i32 1, i32 47 } ; <%struct.string___XUB*> [#uses=1] -@ada__io_exceptions__data_error = external global %struct.exception ; <%struct.exception*> [#uses=1] -@constraint_error = external global %struct.exception ; <%struct.exception*> [#uses=2] -@__gnat_all_others_value = external constant i32 ; <i32*> [#uses=21] -@.str3 = internal constant [10 x i8] c"0123456789" ; <[10 x i8]*> [#uses=2] -@ada__text_io__current_out = external global %struct.ada__text_io__text_afcb* ; <%struct.ada__text_io__text_afcb**> [#uses=1] -@.str4 = internal constant [126 x i8] c"CHECK THAT FIXED_IO PUT OPERATES ON FILES OF MODE OUT_FILE AND IF NO FILE IS SPECIFIED THE CURRENT DEFAULT OUTPUT FILE IS USED" ; <[126 x i8]*> [#uses=1] -@C.131.1559 = internal constant %struct.string___XUB { i32 1, i32 126 } ; <%struct.string___XUB*> [#uses=1] -@.str5 = internal constant [7 x i8] c"CE3806G" ; <[7 x i8]*> [#uses=1] -@C.132.1562 = internal constant %struct.string___XUB { i32 1, i32 7 } ; <%struct.string___XUB*> [#uses=1] -@incompleteF.1176.b = internal global i1 false ; <i1*> [#uses=2] -@incomplete.1177 = internal global %struct.exception { i8 0, i8 65, i32 23, i8* getelementptr ([23 x i8]* @incompleteE.1174, i32 0, i32 0), i8* null, i32 0, i8* null } ; <%struct.exception*> [#uses=15] -@incompleteE.1174 = internal global [23 x i8] c"CE3806G.B_1.INCOMPLETE\00" ; <[23 x i8]*> [#uses=1] -@.str6 = internal constant [0 x i8] zeroinitializer ; <[0 x i8]*> [#uses=1] -@C.136.1568 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@C.137.1571 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@.str7 = internal constant [50 x i8] c"USE_ERROR RAISED ON TEXT CREATE WITH OUT_FILE MODE" ; <[50 x i8]*> [#uses=1] -@C.139.1577 = internal constant %struct.string___XUB { i32 1, i32 50 } ; <%struct.string___XUB*> [#uses=1] -@.str8 = internal constant [14 x i8] c"ce3806g.adb:65" ; <[14 x i8]*> [#uses=1] -@C.140.1580 = internal constant %struct.string___XUB { i32 1, i32 14 } ; <%struct.string___XUB*> [#uses=1] -@.str9 = internal constant [51 x i8] c"NAME_ERROR RAISED ON TEXT CREATE WITH OUT_FILE MODE" ; <[51 x i8]*> [#uses=1] -@C.143.1585 = internal constant %struct.string___XUB { i32 1, i32 51 } ; <%struct.string___XUB*> [#uses=1] -@.str10 = internal constant [14 x i8] c"ce3806g.adb:69" ; <[14 x i8]*> [#uses=1] -@C.144.1588 = internal constant %struct.string___XUB { i32 1, i32 14 } ; <%struct.string___XUB*> [#uses=1] -@C.146.1592 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@C.147.1595 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@C.153.1609 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@C.154.1612 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@.str12 = internal constant [47 x i8] c"USE_ERROR RAISED ON TEXT OPEN WITH IN_FILE MODE" ; <[47 x i8]*> [#uses=1] -@C.156.1618 = internal constant %struct.string___XUB { i32 1, i32 47 } ; <%struct.string___XUB*> [#uses=1] -@.str13 = internal constant [14 x i8] c"ce3806g.adb:88" ; <[14 x i8]*> [#uses=1] -@C.157.1621 = internal constant %struct.string___XUB { i32 1, i32 14 } ; <%struct.string___XUB*> [#uses=1] -@C.159.1627 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@C.160.1630 = internal constant %struct.string___XUB { i32 1, i32 0 } ; <%struct.string___XUB*> [#uses=1] -@.str14 = internal constant [33 x i8] c"VALUE INCORRECT - FIXED FROM FILE" ; <[33 x i8]*> [#uses=1] -@C.162.1637 = internal constant %struct.string___XUB { i32 1, i32 33 } ; <%struct.string___XUB*> [#uses=1] -@.str15 = internal constant [36 x i8] c"VALUE INCORRECT - FIXED FROM DEFAULT" ; <[36 x i8]*> [#uses=1] -@C.164.1642 = internal constant %struct.string___XUB { i32 1, i32 36 } ; <%struct.string___XUB*> [#uses=1] -@ada__io_exceptions__use_error = external global %struct.exception ; <%struct.exception*> [#uses=4] -@ada__io_exceptions__name_error = external global %struct.exception ; <%struct.exception*> [#uses=2] - -define void @_ada_ce3806g() { -entry: - %0 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3] - %1 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3] - %2 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3] - %3 = alloca %struct.system__file_control_block__pstring, align 8 ; <%struct.system__file_control_block__pstring*> [#uses=3] - %FRAME.356 = alloca %struct.FRAME.ce3806g ; <%struct.FRAME.ce3806g*> [#uses=20] - call void @report__test( i8* getelementptr ([7 x i8]* @.str5, i32 0, i32 0), %struct.string___XUB* @C.132.1562, i8* getelementptr ([126 x i8]* @.str4, i32 0, i32 0), %struct.string___XUB* @C.131.1559 ) - %4 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3 ; <%struct.string___XUB*> [#uses=1] - call void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %4 ) - %.b = load i1* @incompleteF.1176.b ; <i1> [#uses=1] - br i1 %.b, label %bb11, label %bb - -bb: ; preds = %entry - invoke void @system__exception_table__register_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*) ) - to label %invcont unwind label %lpad - -invcont: ; preds = %bb - store i1 true, i1* @incompleteF.1176.b - br label %bb11 - -bb11: ; preds = %entry, %invcont - %5 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2 ; <%struct.string___XUB*> [#uses=1] - invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %5 ) - to label %invcont12 unwind label %lpad228 - -invcont12: ; preds = %bb11 - invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %3, i32 1, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.137.1571 ) - to label %invcont17 unwind label %lpad232 - -invcont17: ; preds = %invcont12 - %elt18 = getelementptr %struct.system__file_control_block__pstring* %3, i32 0, i32 0 ; <i8**> [#uses=1] - %val19 = load i8** %elt18, align 8 ; <i8*> [#uses=1] - %elt20 = getelementptr %struct.system__file_control_block__pstring* %3, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1] - %val21 = load %struct.string___XUB** %elt20 ; <%struct.string___XUB*> [#uses=1] - %6 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__create( %struct.ada__text_io__text_afcb* null, i8 2, i8* %val19, %struct.string___XUB* %val21, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.136.1568 ) - to label %invcont26 unwind label %lpad232 ; <%struct.ada__text_io__text_afcb*> [#uses=2] - -invcont26: ; preds = %invcont17 - %7 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 0 ; <i32*> [#uses=1] - %8 = load i32* %7, align 8 ; <i32> [#uses=1] - %9 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 1 ; <i32*> [#uses=1] - %10 = load i32* %9, align 4 ; <i32> [#uses=1] - invoke void @system__secondary_stack__ss_release( i32 %8, i32 %10 ) - to label %bb73 unwind label %lpad228 - -bb32: ; preds = %lpad232 - call void @__gnat_begin_handler( i8* %eh_ptr233 ) nounwind - %11 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1] - invoke void %11( ) - to label %invcont33 unwind label %lpad240 - -invcont33: ; preds = %bb32 - invoke void @report__not_applicable( i8* getelementptr ([50 x i8]* @.str7, i32 0, i32 0), %struct.string___XUB* @C.139.1577 ) - to label %invcont38 unwind label %lpad240 - -invcont38: ; preds = %invcont33 - invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str8, i32 0, i32 0), %struct.string___XUB* @C.140.1580 ) noreturn - to label %invcont43 unwind label %lpad240 - -invcont43: ; preds = %invcont38 - unreachable - -bb47: ; preds = %ppad291 - call void @__gnat_begin_handler( i8* %eh_ptr233 ) nounwind - %12 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1] - invoke void %12( ) - to label %invcont49 unwind label %lpad248 - -invcont49: ; preds = %bb47 - invoke void @report__not_applicable( i8* getelementptr ([51 x i8]* @.str9, i32 0, i32 0), %struct.string___XUB* @C.143.1585 ) - to label %invcont54 unwind label %lpad248 - -invcont54: ; preds = %invcont49 - invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str10, i32 0, i32 0), %struct.string___XUB* @C.144.1588 ) noreturn - to label %invcont59 unwind label %lpad248 - -invcont59: ; preds = %invcont54 - unreachable - -bb73: ; preds = %invcont26 - invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %2, i32 2, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.147.1595 ) - to label %invcont78 unwind label %lpad228 - -invcont78: ; preds = %bb73 - %elt79 = getelementptr %struct.system__file_control_block__pstring* %2, i32 0, i32 0 ; <i8**> [#uses=1] - %val80 = load i8** %elt79, align 8 ; <i8*> [#uses=1] - %elt81 = getelementptr %struct.system__file_control_block__pstring* %2, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1] - %val82 = load %struct.string___XUB** %elt81 ; <%struct.string___XUB*> [#uses=1] - %13 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__create( %struct.ada__text_io__text_afcb* null, i8 2, i8* %val80, %struct.string___XUB* %val82, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.146.1592 ) - to label %invcont87 unwind label %lpad228 ; <%struct.ada__text_io__text_afcb*> [#uses=2] - -invcont87: ; preds = %invcont78 - invoke void @ada__text_io__set_output( %struct.ada__text_io__text_afcb* %13 ) - to label %invcont88 unwind label %lpad228 - -invcont88: ; preds = %invcont87 - %14 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1 ; <%struct.string___XUB*> [#uses=1] - invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %14 ) - to label %invcont89 unwind label %lpad228 - -invcont89: ; preds = %invcont88 - invoke fastcc void @ce3806g__fxio__put.1149( %struct.ada__text_io__text_afcb* %6 ) - to label %bb94 unwind label %lpad252 - -bb94: ; preds = %invcont89 - invoke fastcc void @ce3806g__fxio__put__2.1155( ) - to label %invcont95 unwind label %lpad252 - -invcont95: ; preds = %bb94 - %15 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__close( %struct.ada__text_io__text_afcb* %6 ) - to label %invcont96 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=1] - -invcont96: ; preds = %invcont95 - %16 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0 ; <%struct.string___XUB*> [#uses=1] - invoke void @system__secondary_stack__ss_mark( %struct.string___XUB* noalias sret %16 ) - to label %invcont97 unwind label %lpad252 - -invcont97: ; preds = %invcont96 - invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %1, i32 1, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.154.1612 ) - to label %invcont102 unwind label %lpad256 - -invcont102: ; preds = %invcont97 - %elt103 = getelementptr %struct.system__file_control_block__pstring* %1, i32 0, i32 0 ; <i8**> [#uses=1] - %val104 = load i8** %elt103, align 8 ; <i8*> [#uses=1] - %elt105 = getelementptr %struct.system__file_control_block__pstring* %1, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1] - %val106 = load %struct.string___XUB** %elt105 ; <%struct.string___XUB*> [#uses=1] - %17 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__open( %struct.ada__text_io__text_afcb* %15, i8 0, i8* %val104, %struct.string___XUB* %val106, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.153.1609 ) - to label %invcont111 unwind label %lpad256 ; <%struct.ada__text_io__text_afcb*> [#uses=2] - -invcont111: ; preds = %invcont102 - %18 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 0 ; <i32*> [#uses=1] - %19 = load i32* %18, align 8 ; <i32> [#uses=1] - %20 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 1 ; <i32*> [#uses=1] - %21 = load i32* %20, align 4 ; <i32> [#uses=1] - invoke void @system__secondary_stack__ss_release( i32 %19, i32 %21 ) - to label %bb143 unwind label %lpad252 - -bb117: ; preds = %lpad256 - call void @__gnat_begin_handler( i8* %eh_ptr257 ) nounwind - %22 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1] - invoke void %22( ) - to label %invcont119 unwind label %lpad264 - -invcont119: ; preds = %bb117 - invoke void @report__not_applicable( i8* getelementptr ([47 x i8]* @.str12, i32 0, i32 0), %struct.string___XUB* @C.156.1618 ) - to label %invcont124 unwind label %lpad264 - -invcont124: ; preds = %invcont119 - invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @incomplete.1177 to %struct.system__standard_library__exception_data*), i8* getelementptr ([14 x i8]* @.str13, i32 0, i32 0), %struct.string___XUB* @C.157.1621 ) noreturn - to label %invcont129 unwind label %lpad264 - -invcont129: ; preds = %invcont124 - unreachable - -bb143: ; preds = %invcont111 - %23 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__standard_output( ) - to label %invcont144 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=1] - -invcont144: ; preds = %bb143 - invoke void @ada__text_io__set_output( %struct.ada__text_io__text_afcb* %23 ) - to label %invcont145 unwind label %lpad252 - -invcont145: ; preds = %invcont144 - %24 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__close( %struct.ada__text_io__text_afcb* %13 ) - to label %invcont146 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=1] - -invcont146: ; preds = %invcont145 - invoke void @report__legal_file_name( %struct.system__file_control_block__pstring* noalias sret %0, i32 2, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.160.1630 ) - to label %invcont151 unwind label %lpad252 - -invcont151: ; preds = %invcont146 - %elt152 = getelementptr %struct.system__file_control_block__pstring* %0, i32 0, i32 0 ; <i8**> [#uses=1] - %val153 = load i8** %elt152, align 8 ; <i8*> [#uses=1] - %elt154 = getelementptr %struct.system__file_control_block__pstring* %0, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1] - %val155 = load %struct.string___XUB** %elt154 ; <%struct.string___XUB*> [#uses=1] - %25 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__open( %struct.ada__text_io__text_afcb* %24, i8 0, i8* %val153, %struct.string___XUB* %val155, i8* getelementptr ([0 x i8]* @.str6, i32 0, i32 0), %struct.string___XUB* @C.159.1627 ) - to label %invcont160 unwind label %lpad252 ; <%struct.ada__text_io__text_afcb*> [#uses=2] - -invcont160: ; preds = %invcont151 - %26 = invoke fastcc i8 @ce3806g__fxio__get.1137( %struct.ada__text_io__text_afcb* %17 ) signext - to label %invcont161 unwind label %lpad252 ; <i8> [#uses=1] - -invcont161: ; preds = %invcont160 - %27 = icmp eq i8 %26, -3 ; <i1> [#uses=1] - br i1 %27, label %bb169, label %bb163 - -bb163: ; preds = %invcont161 - invoke void @report__failed( i8* getelementptr ([33 x i8]* @.str14, i32 0, i32 0), %struct.string___XUB* @C.162.1637 ) - to label %bb169 unwind label %lpad252 - -bb169: ; preds = %invcont161, %bb163 - %28 = invoke fastcc i8 @ce3806g__fxio__get.1137( %struct.ada__text_io__text_afcb* %25 ) signext - to label %invcont170 unwind label %lpad252 ; <i8> [#uses=1] - -invcont170: ; preds = %bb169 - %29 = icmp eq i8 %28, -1 ; <i1> [#uses=1] - br i1 %29, label %bb187, label %bb172 - -bb172: ; preds = %invcont170 - invoke void @report__failed( i8* getelementptr ([36 x i8]* @.str15, i32 0, i32 0), %struct.string___XUB* @C.164.1642 ) - to label %bb187 unwind label %lpad252 - -bb187: ; preds = %invcont170, %bb172 - %30 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 0 ; <i32*> [#uses=1] - %31 = load i32* %30, align 8 ; <i32> [#uses=1] - %32 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 1 ; <i32*> [#uses=1] - %33 = load i32* %32, align 4 ; <i32> [#uses=1] - invoke void @system__secondary_stack__ss_release( i32 %31, i32 %33 ) - to label %bb193 unwind label %lpad228 - -bb193: ; preds = %bb187 - %34 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__delete( %struct.ada__text_io__text_afcb* %17 ) - to label %invcont194 unwind label %lpad268 ; <%struct.ada__text_io__text_afcb*> [#uses=0] - -invcont194: ; preds = %bb193 - %35 = invoke %struct.ada__text_io__text_afcb* @ada__text_io__delete( %struct.ada__text_io__text_afcb* %25 ) - to label %bb221 unwind label %lpad268 ; <%struct.ada__text_io__text_afcb*> [#uses=0] - -bb196: ; preds = %lpad268 - call void @__gnat_begin_handler( i8* %eh_ptr269 ) nounwind - %36 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1] - invoke void %36( ) - to label %bb203 unwind label %lpad276 - -bb203: ; preds = %bb196 - invoke void @__gnat_end_handler( i8* %eh_ptr269 ) - to label %bb221 unwind label %lpad272 - -bb205: ; preds = %ppad304 - call void @__gnat_begin_handler( i8* %eh_exception.1 ) nounwind - %37 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1] - invoke void %37( ) - to label %bb212 unwind label %lpad284 - -bb212: ; preds = %bb205 - invoke void @__gnat_end_handler( i8* %eh_exception.1 ) - to label %bb221 unwind label %lpad280 - -bb221: ; preds = %invcont194, %bb212, %bb203 - %38 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 0 ; <i32*> [#uses=1] - %39 = load i32* %38, align 8 ; <i32> [#uses=1] - %40 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 1 ; <i32*> [#uses=1] - %41 = load i32* %40, align 4 ; <i32> [#uses=1] - call void @system__secondary_stack__ss_release( i32 %39, i32 %41 ) - call void @report__result( ) - ret void - -lpad: ; preds = %bb - %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select227 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - br label %ppad - -lpad228: ; preds = %bb187, %ppad294, %invcont88, %invcont87, %invcont78, %bb73, %ppad288, %invcont26, %bb11 - %eh_ptr229 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select231 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr229, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - br label %ppad304 - -lpad232: ; preds = %invcont17, %invcont12 - %eh_ptr233 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=6] - %eh_select235 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr233, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @ada__io_exceptions__name_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=3] - %eh_typeid = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) ) ; <i32> [#uses=1] - %42 = icmp eq i32 %eh_select235, %eh_typeid ; <i1> [#uses=1] - br i1 %42, label %bb32, label %ppad291 - -lpad236: ; preds = %lpad240 - %eh_ptr237 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select239 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr237, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - br label %ppad288 - -lpad240: ; preds = %invcont38, %invcont33, %bb32 - %eh_ptr241 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select243 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr241, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - invoke void @__gnat_end_handler( i8* %eh_ptr233 ) - to label %ppad288 unwind label %lpad236 - -lpad244: ; preds = %lpad248 - %eh_ptr245 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select247 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr245, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - br label %ppad288 - -lpad248: ; preds = %invcont54, %invcont49, %bb47 - %eh_ptr249 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select251 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr249, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - invoke void @__gnat_end_handler( i8* %eh_ptr233 ) - to label %ppad288 unwind label %lpad244 - -lpad252: ; preds = %bb94, %invcont89, %invcont160, %bb169, %bb172, %bb163, %invcont151, %invcont146, %invcont145, %invcont144, %bb143, %ppad295, %invcont111, %invcont96, %invcont95 - %eh_ptr253 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select255 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr253, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - br label %ppad294 - -lpad256: ; preds = %invcont102, %invcont97 - %eh_ptr257 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=4] - %eh_select259 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr257, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=2] - %eh_typeid297 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) ) ; <i32> [#uses=1] - %43 = icmp eq i32 %eh_select259, %eh_typeid297 ; <i1> [#uses=1] - br i1 %43, label %bb117, label %ppad295 - -lpad260: ; preds = %lpad264 - %eh_ptr261 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select263 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr261, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - br label %ppad295 - -lpad264: ; preds = %invcont124, %invcont119, %bb117 - %eh_ptr265 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select267 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr265, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - invoke void @__gnat_end_handler( i8* %eh_ptr257 ) - to label %ppad295 unwind label %lpad260 - -lpad268: ; preds = %invcont194, %bb193 - %eh_ptr269 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=5] - %eh_select271 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr269, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @ada__io_exceptions__use_error, %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=2] - %eh_typeid301 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__use_error, i32 0, i32 0) ) ; <i32> [#uses=1] - %44 = icmp eq i32 %eh_select271, %eh_typeid301 ; <i1> [#uses=1] - br i1 %44, label %bb196, label %ppad304 - -lpad272: ; preds = %bb203, %lpad276 - %eh_ptr273 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select275 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr273, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - br label %ppad304 - -lpad276: ; preds = %bb196 - %eh_ptr277 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select279 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr277, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @incomplete.1177, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - invoke void @__gnat_end_handler( i8* %eh_ptr269 ) - to label %ppad304 unwind label %lpad272 - -lpad280: ; preds = %bb212, %lpad284 - %eh_ptr281 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select283 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr281, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - br label %ppad - -lpad284: ; preds = %bb205 - %eh_ptr285 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select287 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr285, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - invoke void @__gnat_end_handler( i8* %eh_exception.1 ) - to label %ppad unwind label %lpad280 - -ppad: ; preds = %lpad284, %ppad304, %lpad280, %lpad - %eh_exception.2 = phi i8* [ %eh_exception.1, %ppad304 ], [ %eh_ptr281, %lpad280 ], [ %eh_ptr, %lpad ], [ %eh_ptr285, %lpad284 ] ; <i8*> [#uses=1] - %45 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 0 ; <i32*> [#uses=1] - %46 = load i32* %45, align 8 ; <i32> [#uses=1] - %47 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 3, i32 1 ; <i32*> [#uses=1] - %48 = load i32* %47, align 4 ; <i32> [#uses=1] - call void @system__secondary_stack__ss_release( i32 %46, i32 %48 ) - %49 = call i32 (...)* @_Unwind_Resume( i8* %eh_exception.2 ) ; <i32> [#uses=0] - unreachable - -ppad288: ; preds = %lpad248, %lpad240, %ppad291, %lpad244, %lpad236 - %eh_exception.0 = phi i8* [ %eh_ptr233, %ppad291 ], [ %eh_ptr245, %lpad244 ], [ %eh_ptr237, %lpad236 ], [ %eh_ptr241, %lpad240 ], [ %eh_ptr249, %lpad248 ] ; <i8*> [#uses=1] - %eh_selector.0 = phi i32 [ %eh_select235, %ppad291 ], [ %eh_select247, %lpad244 ], [ %eh_select239, %lpad236 ], [ %eh_select243, %lpad240 ], [ %eh_select251, %lpad248 ] ; <i32> [#uses=1] - %50 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 0 ; <i32*> [#uses=1] - %51 = load i32* %50, align 8 ; <i32> [#uses=1] - %52 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 2, i32 1 ; <i32*> [#uses=1] - %53 = load i32* %52, align 4 ; <i32> [#uses=1] - invoke void @system__secondary_stack__ss_release( i32 %51, i32 %53 ) - to label %ppad304 unwind label %lpad228 - -ppad291: ; preds = %lpad232 - %eh_typeid292 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @ada__io_exceptions__name_error, i32 0, i32 0) ) ; <i32> [#uses=1] - %54 = icmp eq i32 %eh_select235, %eh_typeid292 ; <i1> [#uses=1] - br i1 %54, label %bb47, label %ppad288 - -ppad294: ; preds = %ppad295, %lpad252 - %eh_exception.4 = phi i8* [ %eh_ptr253, %lpad252 ], [ %eh_exception.3, %ppad295 ] ; <i8*> [#uses=1] - %eh_selector.4 = phi i32 [ %eh_select255, %lpad252 ], [ %eh_selector.3, %ppad295 ] ; <i32> [#uses=1] - %55 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 0 ; <i32*> [#uses=1] - %56 = load i32* %55, align 8 ; <i32> [#uses=1] - %57 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 1, i32 1 ; <i32*> [#uses=1] - %58 = load i32* %57, align 4 ; <i32> [#uses=1] - invoke void @system__secondary_stack__ss_release( i32 %56, i32 %58 ) - to label %ppad304 unwind label %lpad228 - -ppad295: ; preds = %lpad264, %lpad256, %lpad260 - %eh_exception.3 = phi i8* [ %eh_ptr257, %lpad256 ], [ %eh_ptr261, %lpad260 ], [ %eh_ptr265, %lpad264 ] ; <i8*> [#uses=1] - %eh_selector.3 = phi i32 [ %eh_select259, %lpad256 ], [ %eh_select263, %lpad260 ], [ %eh_select267, %lpad264 ] ; <i32> [#uses=1] - %59 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 0 ; <i32*> [#uses=1] - %60 = load i32* %59, align 8 ; <i32> [#uses=1] - %61 = getelementptr %struct.FRAME.ce3806g* %FRAME.356, i32 0, i32 0, i32 1 ; <i32*> [#uses=1] - %62 = load i32* %61, align 4 ; <i32> [#uses=1] - invoke void @system__secondary_stack__ss_release( i32 %60, i32 %62 ) - to label %ppad294 unwind label %lpad252 - -ppad304: ; preds = %lpad276, %ppad294, %ppad288, %lpad268, %lpad272, %lpad228 - %eh_exception.1 = phi i8* [ %eh_ptr229, %lpad228 ], [ %eh_ptr269, %lpad268 ], [ %eh_ptr273, %lpad272 ], [ %eh_exception.0, %ppad288 ], [ %eh_exception.4, %ppad294 ], [ %eh_ptr277, %lpad276 ] ; <i8*> [#uses=4] - %eh_selector.1 = phi i32 [ %eh_select231, %lpad228 ], [ %eh_select271, %lpad268 ], [ %eh_select275, %lpad272 ], [ %eh_selector.0, %ppad288 ], [ %eh_selector.4, %ppad294 ], [ %eh_select279, %lpad276 ] ; <i32> [#uses=1] - %eh_typeid305 = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @incomplete.1177, i32 0, i32 0) ) ; <i32> [#uses=1] - %63 = icmp eq i32 %eh_selector.1, %eh_typeid305 ; <i1> [#uses=1] - br i1 %63, label %bb205, label %ppad -} - -define internal fastcc i8 @ce3806g__fxio__get.1137(%struct.ada__text_io__text_afcb* %file) signext { -entry: - %0 = invoke x86_fp80 @ada__text_io__float_aux__get( %struct.ada__text_io__text_afcb* %file, i32 0 ) - to label %invcont unwind label %lpad ; <x86_fp80> [#uses=5] - -invcont: ; preds = %entry - %1 = fcmp ult x86_fp80 %0, 0xKFFFEFFFFFFFFFFFFFFFF ; <i1> [#uses=1] - %2 = fcmp ugt x86_fp80 %0, 0xK7FFEFFFFFFFFFFFFFFFF ; <i1> [#uses=1] - %or.cond = or i1 %1, %2 ; <i1> [#uses=1] - br i1 %or.cond, label %bb2, label %bb4 - -bb2: ; preds = %invcont - invoke void @__gnat_rcheck_12( i8* getelementptr ([12 x i8]* @.str, i32 0, i32 0), i32 1 ) noreturn - to label %invcont3 unwind label %lpad - -invcont3: ; preds = %bb2 - unreachable - -bb4: ; preds = %invcont - %3 = fmul x86_fp80 %0, 0xK40008000000000000000 ; <x86_fp80> [#uses=1] - %4 = fcmp ult x86_fp80 %3, 0xKC0068000000000000000 ; <i1> [#uses=1] - br i1 %4, label %bb8, label %bb6 - -bb6: ; preds = %bb4 - %5 = fmul x86_fp80 %0, 0xK40008000000000000000 ; <x86_fp80> [#uses=1] - %6 = fcmp ugt x86_fp80 %5, 0xK4005FE00000000000000 ; <i1> [#uses=1] - br i1 %6, label %bb8, label %bb10 - -bb8: ; preds = %bb4, %bb6 - invoke void @__gnat_rcheck_10( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn - to label %invcont9 unwind label %lpad - -invcont9: ; preds = %bb8 - unreachable - -bb10: ; preds = %bb6 - %7 = fmul x86_fp80 %0, 0xK40008000000000000000 ; <x86_fp80> [#uses=3] - %8 = fcmp ult x86_fp80 %7, 0xK00000000000000000000 ; <i1> [#uses=1] - br i1 %8, label %bb13, label %bb12 - -bb12: ; preds = %bb10 - %9 = fadd x86_fp80 %7, 0xK3FFDFFFFFFFFFFFFFFFF ; <x86_fp80> [#uses=1] - br label %bb14 - -bb13: ; preds = %bb10 - %10 = fsub x86_fp80 %7, 0xK3FFDFFFFFFFFFFFFFFFF ; <x86_fp80> [#uses=1] - br label %bb14 - -bb14: ; preds = %bb13, %bb12 - %iftmp.339.0.in = phi x86_fp80 [ %10, %bb13 ], [ %9, %bb12 ] ; <x86_fp80> [#uses=1] - %iftmp.339.0 = fptosi x86_fp80 %iftmp.339.0.in to i8 ; <i8> [#uses=3] - %11 = add i8 %iftmp.339.0, 20 ; <i8> [#uses=1] - %12 = icmp ugt i8 %11, 40 ; <i1> [#uses=1] - br i1 %12, label %bb16, label %bb18 - -bb16: ; preds = %bb14 - invoke void @__gnat_rcheck_12( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn - to label %invcont17 unwind label %lpad - -invcont17: ; preds = %bb16 - unreachable - -bb18: ; preds = %bb14 - %13 = add i8 %iftmp.339.0, 20 ; <i8> [#uses=1] - %14 = icmp ugt i8 %13, 40 ; <i1> [#uses=1] - br i1 %14, label %bb20, label %bb22 - -bb20: ; preds = %bb18 - invoke void @__gnat_rcheck_12( i8* getelementptr ([14 x i8]* @.str1, i32 0, i32 0), i32 324 ) noreturn - to label %invcont21 unwind label %lpad - -invcont21: ; preds = %bb20 - unreachable - -bb22: ; preds = %bb18 - ret i8 %iftmp.339.0 - -bb23: ; preds = %lpad - call void @__gnat_begin_handler( i8* %eh_ptr ) nounwind - %15 = load void ()** @system__soft_links__abort_undefer, align 4 ; <void ()*> [#uses=1] - invoke void %15( ) - to label %invcont24 unwind label %lpad33 - -invcont24: ; preds = %bb23 - invoke void @__gnat_raise_exception( %struct.system__standard_library__exception_data* bitcast (%struct.exception* @ada__io_exceptions__data_error to %struct.system__standard_library__exception_data*), i8* getelementptr ([47 x i8]* @.str2, i32 0, i32 0), %struct.string___XUB* @C.354.2200 ) noreturn - to label %invcont27 unwind label %lpad33 - -invcont27: ; preds = %invcont24 - unreachable - -lpad: ; preds = %bb20, %bb16, %bb8, %bb2, %entry - %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=4] - %eh_select32 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), %struct.exception* @constraint_error, i32* @__gnat_all_others_value ) ; <i32> [#uses=1] - %eh_typeid = call i32 @llvm.eh.typeid.for.i32( i8* getelementptr (%struct.exception* @constraint_error, i32 0, i32 0) ) ; <i32> [#uses=1] - %16 = icmp eq i32 %eh_select32, %eh_typeid ; <i1> [#uses=1] - br i1 %16, label %bb23, label %Unwind - -lpad33: ; preds = %invcont24, %bb23 - %eh_ptr34 = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select36 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr34, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - call void @__gnat_end_handler( i8* %eh_ptr ) - br label %Unwind - -Unwind: ; preds = %lpad, %lpad33 - %eh_exception.0 = phi i8* [ %eh_ptr, %lpad ], [ %eh_ptr34, %lpad33 ] ; <i8*> [#uses=1] - %17 = call i32 (...)* @_Unwind_Resume( i8* %eh_exception.0 ) ; <i32> [#uses=0] - unreachable -} - -define internal fastcc void @ce3806g__fxio__put.1149(%struct.ada__text_io__text_afcb* %file) { -entry: - %A.301 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3] - %A.292 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3] - %0 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1] - %1 = alloca [12 x i8] ; <[12 x i8]*> [#uses=1] - %.sub = getelementptr [12 x i8]* %1, i32 0, i32 0 ; <i8*> [#uses=2] - %2 = getelementptr %struct.string___XUB* %A.292, i32 0, i32 0 ; <i32*> [#uses=1] - store i32 1, i32* %2, align 8 - %3 = getelementptr %struct.string___XUB* %A.292, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 12, i32* %3, align 4 - %4 = invoke fastcc i32 @ce3806g__fxio__put__4.1215( i8* %.sub, %struct.string___XUB* %A.292, i8 signext -3 ) - to label %invcont unwind label %lpad ; <i32> [#uses=1] - -invcont: ; preds = %entry - %5 = getelementptr %struct.string___XUB* %A.301, i32 0, i32 0 ; <i32*> [#uses=1] - store i32 1, i32* %5, align 8 - %6 = getelementptr %struct.string___XUB* %A.301, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 %4, i32* %6, align 4 - invoke void @ada__text_io__generic_aux__put_item( %struct.ada__text_io__text_afcb* %file, i8* %.sub, %struct.string___XUB* %A.301 ) - to label %bb60 unwind label %lpad - -bb60: ; preds = %invcont - ret void - -lpad: ; preds = %entry, %invcont - %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select62 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - call void @llvm.stackrestore( i8* %0 ) - %7 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32> [#uses=0] - unreachable -} - -define internal fastcc void @ce3806g__fxio__put__2.1155() { -entry: - %A.266 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3] - %A.257 = alloca %struct.string___XUB ; <%struct.string___XUB*> [#uses=3] - %0 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1] - %1 = alloca [12 x i8] ; <[12 x i8]*> [#uses=1] - %.sub = getelementptr [12 x i8]* %1, i32 0, i32 0 ; <i8*> [#uses=2] - %2 = getelementptr %struct.string___XUB* %A.257, i32 0, i32 0 ; <i32*> [#uses=1] - store i32 1, i32* %2, align 8 - %3 = getelementptr %struct.string___XUB* %A.257, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 12, i32* %3, align 4 - %4 = invoke fastcc i32 @ce3806g__fxio__put__4.1215( i8* %.sub, %struct.string___XUB* %A.257, i8 signext -1 ) - to label %invcont unwind label %lpad ; <i32> [#uses=1] - -invcont: ; preds = %entry - %5 = getelementptr %struct.string___XUB* %A.266, i32 0, i32 0 ; <i32*> [#uses=1] - store i32 1, i32* %5, align 8 - %6 = getelementptr %struct.string___XUB* %A.266, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 %4, i32* %6, align 4 - %7 = load %struct.ada__text_io__text_afcb** @ada__text_io__current_out, align 4 ; <%struct.ada__text_io__text_afcb*> [#uses=1] - invoke void @ada__text_io__generic_aux__put_item( %struct.ada__text_io__text_afcb* %7, i8* %.sub, %struct.string___XUB* %A.266 ) - to label %bb60 unwind label %lpad - -bb60: ; preds = %invcont - ret void - -lpad: ; preds = %entry, %invcont - %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select62 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - call void @llvm.stackrestore( i8* %0 ) - %8 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32> [#uses=0] - unreachable -} - -define internal fastcc i32 @ce3806g__fxio__put__4.1215(i8* %to.0, %struct.string___XUB* %to.1, i8 signext %item) { -entry: - %P0 = load i32 * @__gnat_all_others_value, align 4 ; <i32*> [#uses=1] - %P = alloca i32, i32 %P0 ; <i32*> [#uses=1] - call void @ext( i32* %P ) - %to_addr = alloca %struct.system__file_control_block__pstring ; <%struct.system__file_control_block__pstring*> [#uses=4] - %FRAME.358 = alloca %struct.FRAME.ce3806g__fxio__put__4 ; <%struct.FRAME.ce3806g__fxio__put__4*> [#uses=65] - %0 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 0 ; <i8**> [#uses=1] - store i8* %to.0, i8** %0, align 8 - %1 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1] - store %struct.string___XUB* %to.1, %struct.string___XUB** %1 - %2 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - store %struct.system__file_control_block__pstring* %to_addr, %struct.system__file_control_block__pstring** %2, align 4 - %3 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0 ; <i32*> [#uses=1] - store i32 3, i32* %3, align 8 - %4 = getelementptr %struct.system__file_control_block__pstring* %to_addr, i32 0, i32 1 ; <%struct.string___XUB**> [#uses=1] - %5 = load %struct.string___XUB** %4, align 4 ; <%struct.string___XUB*> [#uses=1] - %6 = getelementptr %struct.string___XUB* %5, i32 0, i32 0 ; <i32*> [#uses=1] - %7 = load i32* %6, align 4 ; <i32> [#uses=1] - %8 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1] - store i32 %7, i32* %8, align 8 - %9 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1] - %10 = load i32* %9, align 8 ; <i32> [#uses=1] - %11 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - store i32 %10, i32* %11, align 8 - %item.lobit = lshr i8 %item, 7 ; <i8> [#uses=1] - %12 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6 ; <i8*> [#uses=1] - store i8 %item.lobit, i8* %12, align 8 - %13 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1] - %14 = load i32* %13, align 8 ; <i32> [#uses=1] - %15 = add i32 %14, -1 ; <i32> [#uses=1] - %16 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %15, i32* %16, align 4 - %17 = sext i8 %item to i64 ; <i64> [#uses=1] - %18 = call i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 1 ) readnone ; <i64> [#uses=1] - %19 = sub i64 0, %18 ; <i64> [#uses=1] - %20 = call i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 0 ) readnone ; <i64> [#uses=1] - %21 = mul i64 %20, -2 ; <i64> [#uses=1] - call fastcc void @ce3806g__fxio__put__put_scaled__4.1346( %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i64 %17, i64 %19, i64 %21, i32 0, i32 -1 ) - %22 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %23 = load i32* %22, align 4 ; <i32> [#uses=1] - %24 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1] - %25 = load i32* %24, align 8 ; <i32> [#uses=1] - %26 = icmp slt i32 %23, %25 ; <i1> [#uses=1] - br i1 %26, label %bb71, label %bb72 - -bb71: ; preds = %entry - %27 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 0, i32* %27, align 4 - br label %bb72 - -bb72: ; preds = %entry, %bb102, %bb71 - %28 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - %29 = load i32* %28, align 4 ; <i32> [#uses=1] - %30 = icmp slt i32 %29, -1 ; <i1> [#uses=1] - %31 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %32 = load i32* %31, align 4 ; <i32> [#uses=2] - br i1 %30, label %bb103, label %bb74 - -bb74: ; preds = %bb72 - %33 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 2 ; <i32*> [#uses=1] - %34 = load i32* %33, align 8 ; <i32> [#uses=1] - %35 = add i32 %34, -1 ; <i32> [#uses=1] - %36 = icmp eq i32 %32, %35 ; <i1> [#uses=1] - %37 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - %38 = load i32* %37, align 4 ; <i32> [#uses=2] - br i1 %36, label %bb76, label %bb98 - -bb76: ; preds = %bb74 - %39 = icmp slt i32 %38, 1 ; <i1> [#uses=1] - br i1 %39, label %bb80, label %bb102 - -bb80: ; preds = %bb76 - %40 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - %41 = load i32* %40, align 4 ; <i32> [#uses=2] - %42 = icmp sgt i32 %41, -1 ; <i1> [#uses=1] - %.op = add i32 %41, 2 ; <i32> [#uses=1] - %43 = select i1 %42, i32 %.op, i32 2 ; <i32> [#uses=1] - %44 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6 ; <i8*> [#uses=1] - %45 = load i8* %44, align 8 ; <i8> [#uses=1] - %46 = zext i8 %45 to i32 ; <i32> [#uses=1] - %47 = add i32 %43, %46 ; <i32> [#uses=2] - %48 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0 ; <i32*> [#uses=1] - %49 = load i32* %48, align 8 ; <i32> [#uses=1] - %50 = icmp sgt i32 %47, %49 ; <i1> [#uses=1] - br i1 %50, label %bb88, label %bb85 - -bb85: ; preds = %bb80, %bb87 - %j.0 = phi i32 [ %68, %bb87 ], [ %47, %bb80 ] ; <i32> [#uses=2] - %51 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %52 = load i32* %51, align 4 ; <i32> [#uses=1] - %53 = add i32 %52, 1 ; <i32> [#uses=1] - %54 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %53, i32* %54, align 4 - %55 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %56 = load i32* %55, align 8 ; <i32> [#uses=1] - %57 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %58 = load %struct.system__file_control_block__pstring** %57, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %59 = getelementptr %struct.system__file_control_block__pstring* %58, i32 0, i32 0 ; <i8**> [#uses=1] - %60 = load i8** %59, align 4 ; <i8*> [#uses=1] - %61 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %62 = load i32* %61, align 4 ; <i32> [#uses=1] - %63 = sub i32 %62, %56 ; <i32> [#uses=1] - %64 = getelementptr i8* %60, i32 %63 ; <i8*> [#uses=1] - store i8 32, i8* %64, align 1 - %65 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 0 ; <i32*> [#uses=1] - %66 = load i32* %65, align 8 ; <i32> [#uses=1] - %67 = icmp eq i32 %66, %j.0 ; <i1> [#uses=1] - br i1 %67, label %bb88, label %bb87 - -bb87: ; preds = %bb85 - %68 = add i32 %j.0, 1 ; <i32> [#uses=1] - br label %bb85 - -bb88: ; preds = %bb80, %bb85 - %69 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 6 ; <i8*> [#uses=1] - %70 = load i8* %69, align 8 ; <i8> [#uses=1] - %toBool89 = icmp eq i8 %70, 0 ; <i1> [#uses=1] - br i1 %toBool89, label %bb91, label %bb90 - -bb90: ; preds = %bb88 - %71 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %72 = load i32* %71, align 4 ; <i32> [#uses=1] - %73 = add i32 %72, 1 ; <i32> [#uses=1] - %74 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %73, i32* %74, align 4 - %75 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %76 = load i32* %75, align 8 ; <i32> [#uses=1] - %77 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %78 = load %struct.system__file_control_block__pstring** %77, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %79 = getelementptr %struct.system__file_control_block__pstring* %78, i32 0, i32 0 ; <i8**> [#uses=1] - %80 = load i8** %79, align 4 ; <i8*> [#uses=1] - %81 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %82 = load i32* %81, align 4 ; <i32> [#uses=1] - %83 = sub i32 %82, %76 ; <i32> [#uses=1] - %84 = getelementptr i8* %80, i32 %83 ; <i8*> [#uses=1] - store i8 45, i8* %84, align 1 - br label %bb91 - -bb91: ; preds = %bb88, %bb90 - %85 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - %86 = load i32* %85, align 4 ; <i32> [#uses=1] - %87 = icmp slt i32 %86, 0 ; <i1> [#uses=1] - br i1 %87, label %bb93, label %bb97 - -bb93: ; preds = %bb91 - %88 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %89 = load i32* %88, align 4 ; <i32> [#uses=1] - %90 = add i32 %89, 1 ; <i32> [#uses=1] - %91 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %90, i32* %91, align 4 - %92 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %93 = load i32* %92, align 8 ; <i32> [#uses=1] - %94 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %95 = load %struct.system__file_control_block__pstring** %94, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %96 = getelementptr %struct.system__file_control_block__pstring* %95, i32 0, i32 0 ; <i8**> [#uses=1] - %97 = load i8** %96, align 4 ; <i8*> [#uses=1] - %98 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %99 = load i32* %98, align 4 ; <i32> [#uses=1] - %100 = sub i32 %99, %93 ; <i32> [#uses=1] - %101 = getelementptr i8* %97, i32 %100 ; <i8*> [#uses=1] - store i8 48, i8* %101, align 1 - %102 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %103 = load i32* %102, align 4 ; <i32> [#uses=1] - %104 = add i32 %103, 1 ; <i32> [#uses=1] - %105 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %104, i32* %105, align 4 - %106 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %107 = load i32* %106, align 8 ; <i32> [#uses=1] - %108 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %109 = load %struct.system__file_control_block__pstring** %108, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %110 = getelementptr %struct.system__file_control_block__pstring* %109, i32 0, i32 0 ; <i8**> [#uses=1] - %111 = load i8** %110, align 4 ; <i8*> [#uses=1] - %112 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %113 = load i32* %112, align 4 ; <i32> [#uses=1] - %114 = sub i32 %113, %107 ; <i32> [#uses=1] - %115 = getelementptr i8* %111, i32 %114 ; <i8*> [#uses=1] - store i8 46, i8* %115, align 1 - %116 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - %117 = load i32* %116, align 4 ; <i32> [#uses=1] - br label %bb94 - -bb94: ; preds = %bb96, %bb93 - %j8.0 = phi i32 [ %117, %bb93 ], [ %133, %bb96 ] ; <i32> [#uses=2] - %118 = icmp sgt i32 %j8.0, -2 ; <i1> [#uses=1] - br i1 %118, label %bb97, label %bb96 - -bb96: ; preds = %bb94 - %119 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %120 = load i32* %119, align 4 ; <i32> [#uses=1] - %121 = add i32 %120, 1 ; <i32> [#uses=1] - %122 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %121, i32* %122, align 4 - %123 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %124 = load i32* %123, align 8 ; <i32> [#uses=1] - %125 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %126 = load %struct.system__file_control_block__pstring** %125, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %127 = getelementptr %struct.system__file_control_block__pstring* %126, i32 0, i32 0 ; <i8**> [#uses=1] - %128 = load i8** %127, align 4 ; <i8*> [#uses=1] - %129 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %130 = load i32* %129, align 4 ; <i32> [#uses=1] - %131 = sub i32 %130, %124 ; <i32> [#uses=1] - %132 = getelementptr i8* %128, i32 %131 ; <i8*> [#uses=1] - store i8 48, i8* %132, align 1 - %133 = add i32 %j8.0, 1 ; <i32> [#uses=1] - br label %bb94 - -bb97: ; preds = %bb91, %bb94 - %134 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %135 = load i32* %134, align 4 ; <i32> [#uses=1] - %136 = add i32 %135, 1 ; <i32> [#uses=1] - %137 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %136, i32* %137, align 4 - %138 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %139 = load i32* %138, align 8 ; <i32> [#uses=1] - %140 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %141 = load %struct.system__file_control_block__pstring** %140, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %142 = getelementptr %struct.system__file_control_block__pstring* %141, i32 0, i32 0 ; <i8**> [#uses=1] - %143 = load i8** %142, align 4 ; <i8*> [#uses=1] - %144 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %145 = load i32* %144, align 4 ; <i32> [#uses=1] - %146 = sub i32 %145, %139 ; <i32> [#uses=1] - %147 = getelementptr i8* %143, i32 %146 ; <i8*> [#uses=1] - store i8 48, i8* %147, align 1 - br label %bb102 - -bb98: ; preds = %bb74 - %148 = icmp eq i32 %38, -1 ; <i1> [#uses=1] - br i1 %148, label %bb100, label %bb101 - -bb100: ; preds = %bb98 - %149 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %150 = load i32* %149, align 4 ; <i32> [#uses=1] - %151 = add i32 %150, 1 ; <i32> [#uses=1] - %152 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %151, i32* %152, align 4 - %153 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %154 = load i32* %153, align 8 ; <i32> [#uses=1] - %155 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %156 = load %struct.system__file_control_block__pstring** %155, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %157 = getelementptr %struct.system__file_control_block__pstring* %156, i32 0, i32 0 ; <i8**> [#uses=1] - %158 = load i8** %157, align 4 ; <i8*> [#uses=1] - %159 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %160 = load i32* %159, align 4 ; <i32> [#uses=1] - %161 = sub i32 %160, %154 ; <i32> [#uses=1] - %162 = getelementptr i8* %158, i32 %161 ; <i8*> [#uses=1] - store i8 46, i8* %162, align 1 - br label %bb101 - -bb101: ; preds = %bb98, %bb100 - %163 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %164 = load i32* %163, align 4 ; <i32> [#uses=1] - %165 = add i32 %164, 1 ; <i32> [#uses=1] - %166 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %165, i32* %166, align 4 - %167 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 4 ; <i32*> [#uses=1] - %168 = load i32* %167, align 8 ; <i32> [#uses=1] - %169 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %170 = load %struct.system__file_control_block__pstring** %169, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %171 = getelementptr %struct.system__file_control_block__pstring* %170, i32 0, i32 0 ; <i8**> [#uses=1] - %172 = load i8** %171, align 4 ; <i8*> [#uses=1] - %173 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 5 ; <i32*> [#uses=1] - %174 = load i32* %173, align 4 ; <i32> [#uses=1] - %175 = sub i32 %174, %168 ; <i32> [#uses=1] - %176 = getelementptr i8* %172, i32 %175 ; <i8*> [#uses=1] - store i8 48, i8* %176, align 1 - br label %bb102 - -bb102: ; preds = %bb76, %bb101, %bb97 - %177 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - %178 = load i32* %177, align 4 ; <i32> [#uses=1] - %179 = add i32 %178, -1 ; <i32> [#uses=1] - %180 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %FRAME.358, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 %179, i32* %180, align 4 - br label %bb72 - -bb103: ; preds = %bb72 - ret i32 %32 -} - -declare x86_fp80 @ada__text_io__float_aux__get(%struct.ada__text_io__text_afcb*, i32) - -declare void @__gnat_rcheck_12(i8*, i32) noreturn - -declare void @__gnat_rcheck_10(i8*, i32) noreturn - -declare i8* @llvm.eh.exception() nounwind - -declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) nounwind - -declare i32 @llvm.eh.typeid.for.i32(i8*) nounwind - -declare void @__gnat_begin_handler(i8*) nounwind - -declare void @__gnat_raise_exception(%struct.system__standard_library__exception_data*, i8*, %struct.string___XUB*) noreturn - -declare void @__gnat_end_handler(i8*) - -declare i32 @__gnat_eh_personality(...) - -declare i32 @_Unwind_Resume(...) - -define internal fastcc void @ce3806g__fxio__put__put_int64__4.1339(%struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i64 %x, i32 %scale) { -entry: - %0 = icmp eq i64 %x, 0 ; <i1> [#uses=1] - br i1 %0, label %return, label %bb - -bb: ; preds = %entry - %1 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 %scale, i32* %1, align 4 - %2 = add i64 %x, 9 ; <i64> [#uses=1] - %3 = icmp ugt i64 %2, 18 ; <i1> [#uses=1] - br i1 %3, label %bb18, label %bb19 - -bb18: ; preds = %bb - %4 = add i32 %scale, 1 ; <i32> [#uses=1] - %5 = sdiv i64 %x, 10 ; <i64> [#uses=1] - call fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i64 %5, i32 %4 ) - br label %bb19 - -bb19: ; preds = %bb, %bb18 - %6 = srem i64 %x, 10 ; <i64> [#uses=3] - %neg = sub i64 0, %6 ; <i64> [#uses=1] - %abscond = icmp sgt i64 %6, -1 ; <i1> [#uses=1] - %abs = select i1 %abscond, i64 %6, i64 %neg ; <i64> [#uses=3] - %7 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %8 = load i32* %7, align 4 ; <i32> [#uses=1] - %9 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 2 ; <i32*> [#uses=1] - %10 = load i32* %9, align 4 ; <i32> [#uses=1] - %11 = add i32 %10, -1 ; <i32> [#uses=1] - %12 = icmp eq i32 %8, %11 ; <i1> [#uses=1] - br i1 %12, label %bb23, label %bb44 - -bb23: ; preds = %bb19 - %13 = icmp ne i64 %abs, 0 ; <i1> [#uses=1] - %14 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - %15 = load i32* %14, align 4 ; <i32> [#uses=1] - %16 = icmp slt i32 %15, 1 ; <i1> [#uses=1] - %17 = or i1 %13, %16 ; <i1> [#uses=1] - br i1 %17, label %bb27, label %bb48 - -bb27: ; preds = %bb23 - %18 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - %19 = load i32* %18, align 4 ; <i32> [#uses=2] - %20 = icmp sgt i32 %19, -1 ; <i1> [#uses=1] - %.op = add i32 %19, 2 ; <i32> [#uses=1] - %21 = select i1 %20, i32 %.op, i32 2 ; <i32> [#uses=1] - %22 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 6 ; <i8*> [#uses=1] - %23 = load i8* %22, align 1 ; <i8> [#uses=1] - %24 = zext i8 %23 to i32 ; <i32> [#uses=1] - %25 = add i32 %21, %24 ; <i32> [#uses=2] - %26 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 0 ; <i32*> [#uses=1] - %27 = load i32* %26, align 4 ; <i32> [#uses=1] - %28 = icmp sgt i32 %25, %27 ; <i1> [#uses=1] - br i1 %28, label %bb34, label %bb31 - -bb31: ; preds = %bb27, %bb33 - %j.0 = phi i32 [ %46, %bb33 ], [ %25, %bb27 ] ; <i32> [#uses=2] - %29 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %30 = load i32* %29, align 4 ; <i32> [#uses=1] - %31 = add i32 %30, 1 ; <i32> [#uses=1] - %32 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %31, i32* %32, align 4 - %33 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %34 = load i32* %33, align 4 ; <i32> [#uses=1] - %35 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %36 = load %struct.system__file_control_block__pstring** %35, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %37 = getelementptr %struct.system__file_control_block__pstring* %36, i32 0, i32 0 ; <i8**> [#uses=1] - %38 = load i8** %37, align 4 ; <i8*> [#uses=1] - %39 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %40 = load i32* %39, align 4 ; <i32> [#uses=1] - %41 = sub i32 %40, %34 ; <i32> [#uses=1] - %42 = getelementptr i8* %38, i32 %41 ; <i8*> [#uses=1] - store i8 32, i8* %42, align 1 - %43 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 0 ; <i32*> [#uses=1] - %44 = load i32* %43, align 4 ; <i32> [#uses=1] - %45 = icmp eq i32 %44, %j.0 ; <i1> [#uses=1] - br i1 %45, label %bb34, label %bb33 - -bb33: ; preds = %bb31 - %46 = add i32 %j.0, 1 ; <i32> [#uses=1] - br label %bb31 - -bb34: ; preds = %bb27, %bb31 - %47 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 6 ; <i8*> [#uses=1] - %48 = load i8* %47, align 1 ; <i8> [#uses=1] - %toBool35 = icmp eq i8 %48, 0 ; <i1> [#uses=1] - br i1 %toBool35, label %bb37, label %bb36 - -bb36: ; preds = %bb34 - %49 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %50 = load i32* %49, align 4 ; <i32> [#uses=1] - %51 = add i32 %50, 1 ; <i32> [#uses=1] - %52 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %51, i32* %52, align 4 - %53 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %54 = load i32* %53, align 4 ; <i32> [#uses=1] - %55 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %56 = load %struct.system__file_control_block__pstring** %55, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %57 = getelementptr %struct.system__file_control_block__pstring* %56, i32 0, i32 0 ; <i8**> [#uses=1] - %58 = load i8** %57, align 4 ; <i8*> [#uses=1] - %59 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %60 = load i32* %59, align 4 ; <i32> [#uses=1] - %61 = sub i32 %60, %54 ; <i32> [#uses=1] - %62 = getelementptr i8* %58, i32 %61 ; <i8*> [#uses=1] - store i8 45, i8* %62, align 1 - br label %bb37 - -bb37: ; preds = %bb34, %bb36 - %63 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - %64 = load i32* %63, align 4 ; <i32> [#uses=1] - %65 = icmp slt i32 %64, 0 ; <i1> [#uses=1] - br i1 %65, label %bb39, label %bb43 - -bb39: ; preds = %bb37 - %66 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %67 = load i32* %66, align 4 ; <i32> [#uses=1] - %68 = add i32 %67, 1 ; <i32> [#uses=1] - %69 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %68, i32* %69, align 4 - %70 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %71 = load i32* %70, align 4 ; <i32> [#uses=1] - %72 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %73 = load %struct.system__file_control_block__pstring** %72, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %74 = getelementptr %struct.system__file_control_block__pstring* %73, i32 0, i32 0 ; <i8**> [#uses=1] - %75 = load i8** %74, align 4 ; <i8*> [#uses=1] - %76 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %77 = load i32* %76, align 4 ; <i32> [#uses=1] - %78 = sub i32 %77, %71 ; <i32> [#uses=1] - %79 = getelementptr i8* %75, i32 %78 ; <i8*> [#uses=1] - store i8 48, i8* %79, align 1 - %80 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %81 = load i32* %80, align 4 ; <i32> [#uses=1] - %82 = add i32 %81, 1 ; <i32> [#uses=1] - %83 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %82, i32* %83, align 4 - %84 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %85 = load i32* %84, align 4 ; <i32> [#uses=1] - %86 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %87 = load %struct.system__file_control_block__pstring** %86, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %88 = getelementptr %struct.system__file_control_block__pstring* %87, i32 0, i32 0 ; <i8**> [#uses=1] - %89 = load i8** %88, align 4 ; <i8*> [#uses=1] - %90 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %91 = load i32* %90, align 4 ; <i32> [#uses=1] - %92 = sub i32 %91, %85 ; <i32> [#uses=1] - %93 = getelementptr i8* %89, i32 %92 ; <i8*> [#uses=1] - store i8 46, i8* %93, align 1 - %94 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - %95 = load i32* %94, align 4 ; <i32> [#uses=1] - br label %bb40 - -bb40: ; preds = %bb42, %bb39 - %j15.0 = phi i32 [ %95, %bb39 ], [ %111, %bb42 ] ; <i32> [#uses=2] - %96 = icmp sgt i32 %j15.0, -2 ; <i1> [#uses=1] - br i1 %96, label %bb43, label %bb42 - -bb42: ; preds = %bb40 - %97 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %98 = load i32* %97, align 4 ; <i32> [#uses=1] - %99 = add i32 %98, 1 ; <i32> [#uses=1] - %100 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %99, i32* %100, align 4 - %101 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %102 = load i32* %101, align 4 ; <i32> [#uses=1] - %103 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %104 = load %struct.system__file_control_block__pstring** %103, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %105 = getelementptr %struct.system__file_control_block__pstring* %104, i32 0, i32 0 ; <i8**> [#uses=1] - %106 = load i8** %105, align 4 ; <i8*> [#uses=1] - %107 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %108 = load i32* %107, align 4 ; <i32> [#uses=1] - %109 = sub i32 %108, %102 ; <i32> [#uses=1] - %110 = getelementptr i8* %106, i32 %109 ; <i8*> [#uses=1] - store i8 48, i8* %110, align 1 - %111 = add i32 %j15.0, 1 ; <i32> [#uses=1] - br label %bb40 - -bb43: ; preds = %bb37, %bb40 - %112 = trunc i64 %abs to i32 ; <i32> [#uses=1] - %113 = getelementptr [10 x i8]* @.str3, i32 0, i32 %112 ; <i8*> [#uses=1] - %114 = load i8* %113, align 1 ; <i8> [#uses=1] - %115 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %116 = load i32* %115, align 4 ; <i32> [#uses=1] - %117 = add i32 %116, 1 ; <i32> [#uses=1] - %118 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %117, i32* %118, align 4 - %119 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %120 = load i32* %119, align 4 ; <i32> [#uses=1] - %121 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %122 = load %struct.system__file_control_block__pstring** %121, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %123 = getelementptr %struct.system__file_control_block__pstring* %122, i32 0, i32 0 ; <i8**> [#uses=1] - %124 = load i8** %123, align 4 ; <i8*> [#uses=1] - %125 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %126 = load i32* %125, align 4 ; <i32> [#uses=1] - %127 = sub i32 %126, %120 ; <i32> [#uses=1] - %128 = getelementptr i8* %124, i32 %127 ; <i8*> [#uses=1] - store i8 %114, i8* %128, align 1 - br label %bb48 - -bb44: ; preds = %bb19 - %129 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - %130 = load i32* %129, align 4 ; <i32> [#uses=1] - %131 = icmp eq i32 %130, -1 ; <i1> [#uses=1] - br i1 %131, label %bb46, label %bb47 - -bb46: ; preds = %bb44 - %132 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %133 = load i32* %132, align 4 ; <i32> [#uses=1] - %134 = add i32 %133, 1 ; <i32> [#uses=1] - %135 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %134, i32* %135, align 4 - %136 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %137 = load i32* %136, align 4 ; <i32> [#uses=1] - %138 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %139 = load %struct.system__file_control_block__pstring** %138, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %140 = getelementptr %struct.system__file_control_block__pstring* %139, i32 0, i32 0 ; <i8**> [#uses=1] - %141 = load i8** %140, align 4 ; <i8*> [#uses=1] - %142 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %143 = load i32* %142, align 4 ; <i32> [#uses=1] - %144 = sub i32 %143, %137 ; <i32> [#uses=1] - %145 = getelementptr i8* %141, i32 %144 ; <i8*> [#uses=1] - store i8 46, i8* %145, align 1 - br label %bb47 - -bb47: ; preds = %bb44, %bb46 - %146 = trunc i64 %abs to i32 ; <i32> [#uses=1] - %147 = getelementptr [10 x i8]* @.str3, i32 0, i32 %146 ; <i8*> [#uses=1] - %148 = load i8* %147, align 1 ; <i8> [#uses=1] - %149 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %150 = load i32* %149, align 4 ; <i32> [#uses=1] - %151 = add i32 %150, 1 ; <i32> [#uses=1] - %152 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - store i32 %151, i32* %152, align 4 - %153 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 4 ; <i32*> [#uses=1] - %154 = load i32* %153, align 4 ; <i32> [#uses=1] - %155 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 3 ; <%struct.system__file_control_block__pstring**> [#uses=1] - %156 = load %struct.system__file_control_block__pstring** %155, align 4 ; <%struct.system__file_control_block__pstring*> [#uses=1] - %157 = getelementptr %struct.system__file_control_block__pstring* %156, i32 0, i32 0 ; <i8**> [#uses=1] - %158 = load i8** %157, align 4 ; <i8*> [#uses=1] - %159 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 5 ; <i32*> [#uses=1] - %160 = load i32* %159, align 4 ; <i32> [#uses=1] - %161 = sub i32 %160, %154 ; <i32> [#uses=1] - %162 = getelementptr i8* %158, i32 %161 ; <i8*> [#uses=1] - store i8 %148, i8* %162, align 1 - br label %bb48 - -bb48: ; preds = %bb23, %bb47, %bb43 - %163 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - %164 = load i32* %163, align 4 ; <i32> [#uses=1] - %165 = add i32 %164, -1 ; <i32> [#uses=1] - %166 = getelementptr %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.361, i32 0, i32 1 ; <i32*> [#uses=1] - store i32 %165, i32* %166, align 4 - ret void - -return: ; preds = %entry - ret void -} - -define internal fastcc void @ce3806g__fxio__put__put_scaled__4.1346(%struct.FRAME.ce3806g__fxio__put__4* %CHAIN.365, i64 %x, i64 %y, i64 %z, i32 %a, i32 %e) { -entry: - %0 = alloca { i64, i64 } ; <{ i64, i64 }*> [#uses=3] - %1 = call i8* @llvm.stacksave( ) ; <i8*> [#uses=1] - %2 = add i32 %a, 17 ; <i32> [#uses=2] - %3 = sdiv i32 %2, 18 ; <i32> [#uses=3] - %4 = add i32 %3, 1 ; <i32> [#uses=7] - %5 = icmp sgt i32 %4, -1 ; <i1> [#uses=1] - %max53 = select i1 %5, i32 %4, i32 0 ; <i32> [#uses=1] - %6 = alloca i64, i32 %max53 ; <i64*> [#uses=21] - %7 = icmp sgt i32 %4, 0 ; <i1> [#uses=1] - br i1 %7, label %bb55, label %bb58 - -bb55: ; preds = %entry, %bb57 - %J60b.0 = phi i32 [ %11, %bb57 ], [ 1, %entry ] ; <i32> [#uses=3] - %8 = add i32 %J60b.0, -1 ; <i32> [#uses=1] - %9 = getelementptr i64* %6, i32 %8 ; <i64*> [#uses=1] - store i64 0, i64* %9, align 8 - %10 = icmp eq i32 %4, %J60b.0 ; <i1> [#uses=1] - br i1 %10, label %bb58, label %bb57 - -bb57: ; preds = %bb55 - %11 = add i32 %J60b.0, 1 ; <i32> [#uses=1] - br label %bb55 - -bb58: ; preds = %entry, %bb55 - %12 = icmp sgt i32 %4, 0 ; <i1> [#uses=1] - br i1 %12, label %bb61, label %bb91 - -bb61: ; preds = %bb58, %bb90 - %j2.0 = phi i32 [ %88, %bb90 ], [ 1, %bb58 ] ; <i32> [#uses=11] - %aa.0 = phi i32 [ %86, %bb90 ], [ %a, %bb58 ] ; <i32> [#uses=6] - %yy.0 = phi i64 [ %84, %bb90 ], [ %y, %bb58 ] ; <i64> [#uses=3] - %xx.0 = phi i64 [ %21, %bb90 ], [ %x, %bb58 ] ; <i64> [#uses=2] - %13 = icmp eq i64 %xx.0, 0 ; <i1> [#uses=1] - br i1 %13, label %bb91, label %bb63 - -bb63: ; preds = %bb61 - %14 = icmp eq i32 %aa.0, 0 ; <i1> [#uses=1] - %15 = zext i1 %14 to i8 ; <i8> [#uses=1] - invoke void @system__arith_64__scaled_divide( { i64, i64 }* noalias sret %0, i64 %xx.0, i64 %yy.0, i64 %z, i8 %15 ) - to label %invcont unwind label %lpad - -invcont: ; preds = %bb63 - %16 = getelementptr { i64, i64 }* %0, i32 0, i32 0 ; <i64*> [#uses=1] - %17 = load i64* %16, align 8 ; <i64> [#uses=1] - %18 = add i32 %j2.0, -1 ; <i32> [#uses=1] - %19 = getelementptr i64* %6, i32 %18 ; <i64*> [#uses=1] - store i64 %17, i64* %19, align 8 - %20 = getelementptr { i64, i64 }* %0, i32 0, i32 1 ; <i64*> [#uses=1] - %21 = load i64* %20, align 8 ; <i64> [#uses=1] - %22 = add i32 %j2.0, -1 ; <i32> [#uses=1] - %23 = getelementptr i64* %6, i32 %22 ; <i64*> [#uses=1] - %24 = load i64* %23, align 8 ; <i64> [#uses=1] - %25 = icmp eq i64 %24, %yy.0 ; <i1> [#uses=1] - %26 = add i32 %j2.0, -1 ; <i32> [#uses=1] - %27 = getelementptr i64* %6, i32 %26 ; <i64*> [#uses=1] - %28 = load i64* %27, align 8 ; <i64> [#uses=1] - %29 = sub i64 0, %28 ; <i64> [#uses=1] - %30 = icmp eq i64 %yy.0, %29 ; <i1> [#uses=1] - %31 = or i1 %25, %30 ; <i1> [#uses=1] - %32 = icmp sgt i32 %j2.0, 1 ; <i1> [#uses=1] - %or.cond = and i1 %31, %32 ; <i1> [#uses=1] - br i1 %or.cond, label %bb69, label %bb83 - -bb69: ; preds = %invcont - %33 = add i32 %j2.0, -1 ; <i32> [#uses=1] - %34 = getelementptr i64* %6, i32 %33 ; <i64*> [#uses=1] - %35 = load i64* %34, align 8 ; <i64> [#uses=1] - %36 = icmp slt i64 %35, 0 ; <i1> [#uses=1] - %37 = add i32 %j2.0, -2 ; <i32> [#uses=1] - %38 = getelementptr i64* %6, i32 %37 ; <i64*> [#uses=1] - %39 = load i64* %38, align 8 ; <i64> [#uses=2] - br i1 %36, label %bb71, label %bb72 - -bb71: ; preds = %bb69 - %40 = add i64 %39, 1 ; <i64> [#uses=1] - %41 = add i32 %j2.0, -2 ; <i32> [#uses=1] - %42 = getelementptr i64* %6, i32 %41 ; <i64*> [#uses=1] - store i64 %40, i64* %42, align 8 - br label %bb73 - -bb72: ; preds = %bb69 - %43 = add i64 %39, -1 ; <i64> [#uses=1] - %44 = add i32 %j2.0, -2 ; <i32> [#uses=1] - %45 = getelementptr i64* %6, i32 %44 ; <i64*> [#uses=1] - store i64 %43, i64* %45, align 8 - br label %bb73 - -bb73: ; preds = %bb72, %bb71 - %46 = add i32 %j2.0, -1 ; <i32> [#uses=1] - %47 = getelementptr i64* %6, i32 %46 ; <i64*> [#uses=1] - store i64 0, i64* %47, align 8 - br label %bb74 - -bb74: ; preds = %bb82, %bb73 - %j1.0 = phi i32 [ %4, %bb73 ], [ %81, %bb82 ] ; <i32> [#uses=12] - %48 = icmp slt i32 %j1.0, 2 ; <i1> [#uses=1] - br i1 %48, label %bb83, label %bb76 - -bb76: ; preds = %bb74 - %49 = add i32 %j1.0, -1 ; <i32> [#uses=1] - %50 = getelementptr i64* %6, i32 %49 ; <i64*> [#uses=1] - %51 = load i64* %50, align 8 ; <i64> [#uses=1] - %52 = icmp sgt i64 %51, 999999999999999999 ; <i1> [#uses=1] - br i1 %52, label %bb78, label %bb79 - -bb78: ; preds = %bb76 - %53 = add i32 %j1.0, -2 ; <i32> [#uses=1] - %54 = getelementptr i64* %6, i32 %53 ; <i64*> [#uses=1] - %55 = load i64* %54, align 8 ; <i64> [#uses=1] - %56 = add i64 %55, 1 ; <i64> [#uses=1] - %57 = add i32 %j1.0, -2 ; <i32> [#uses=1] - %58 = getelementptr i64* %6, i32 %57 ; <i64*> [#uses=1] - store i64 %56, i64* %58, align 8 - %59 = add i32 %j1.0, -1 ; <i32> [#uses=1] - %60 = getelementptr i64* %6, i32 %59 ; <i64*> [#uses=1] - %61 = load i64* %60, align 8 ; <i64> [#uses=1] - %62 = add i64 %61, -1000000000000000000 ; <i64> [#uses=1] - %63 = add i32 %j1.0, -1 ; <i32> [#uses=1] - %64 = getelementptr i64* %6, i32 %63 ; <i64*> [#uses=1] - store i64 %62, i64* %64, align 8 - br label %bb82 - -bb79: ; preds = %bb76 - %65 = add i32 %j1.0, -1 ; <i32> [#uses=1] - %66 = getelementptr i64* %6, i32 %65 ; <i64*> [#uses=1] - %67 = load i64* %66, align 8 ; <i64> [#uses=1] - %68 = icmp slt i64 %67, -999999999999999999 ; <i1> [#uses=1] - br i1 %68, label %bb81, label %bb82 - -bb81: ; preds = %bb79 - %69 = add i32 %j1.0, -2 ; <i32> [#uses=1] - %70 = getelementptr i64* %6, i32 %69 ; <i64*> [#uses=1] - %71 = load i64* %70, align 8 ; <i64> [#uses=1] - %72 = add i64 %71, -1 ; <i64> [#uses=1] - %73 = add i32 %j1.0, -2 ; <i32> [#uses=1] - %74 = getelementptr i64* %6, i32 %73 ; <i64*> [#uses=1] - store i64 %72, i64* %74, align 8 - %75 = add i32 %j1.0, -1 ; <i32> [#uses=1] - %76 = getelementptr i64* %6, i32 %75 ; <i64*> [#uses=1] - %77 = load i64* %76, align 8 ; <i64> [#uses=1] - %78 = add i64 %77, 1000000000000000000 ; <i64> [#uses=1] - %79 = add i32 %j1.0, -1 ; <i32> [#uses=1] - %80 = getelementptr i64* %6, i32 %79 ; <i64*> [#uses=1] - store i64 %78, i64* %80, align 8 - br label %bb82 - -bb82: ; preds = %bb79, %bb81, %bb78 - %81 = add i32 %j1.0, -1 ; <i32> [#uses=1] - br label %bb74 - -bb83: ; preds = %invcont, %bb74 - %82 = icmp slt i32 %aa.0, 19 ; <i1> [#uses=1] - %min = select i1 %82, i32 %aa.0, i32 18 ; <i32> [#uses=1] - %83 = invoke i64 @system__exn_lli__exn_long_long_integer( i64 10, i32 %min ) readnone - to label %invcont86 unwind label %lpad ; <i64> [#uses=1] - -invcont86: ; preds = %bb83 - %84 = sub i64 0, %83 ; <i64> [#uses=1] - %85 = icmp slt i32 %aa.0, 19 ; <i1> [#uses=1] - %min87 = select i1 %85, i32 %aa.0, i32 18 ; <i32> [#uses=1] - %86 = sub i32 %aa.0, %min87 ; <i32> [#uses=1] - %87 = icmp eq i32 %4, %j2.0 ; <i1> [#uses=1] - br i1 %87, label %bb91, label %bb90 - -bb90: ; preds = %invcont86 - %88 = add i32 %j2.0, 1 ; <i32> [#uses=1] - br label %bb61 - -bb91: ; preds = %bb58, %bb61, %invcont86 - %89 = icmp slt i32 %2, 18 ; <i1> [#uses=1] - br i1 %89, label %bb98, label %bb94 - -bb94: ; preds = %bb91, %bb97 - %j.0 = phi i32 [ %97, %bb97 ], [ 1, %bb91 ] ; <i32> [#uses=4] - %90 = mul i32 %j.0, 18 ; <i32> [#uses=1] - %91 = add i32 %90, -18 ; <i32> [#uses=1] - %92 = sub i32 %e, %91 ; <i32> [#uses=1] - %93 = add i32 %j.0, -1 ; <i32> [#uses=1] - %94 = getelementptr i64* %6, i32 %93 ; <i64*> [#uses=1] - %95 = load i64* %94, align 8 ; <i64> [#uses=1] - invoke fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.365, i64 %95, i32 %92 ) - to label %invcont95 unwind label %lpad - -invcont95: ; preds = %bb94 - %96 = icmp eq i32 %3, %j.0 ; <i1> [#uses=1] - br i1 %96, label %bb98, label %bb97 - -bb97: ; preds = %invcont95 - %97 = add i32 %j.0, 1 ; <i32> [#uses=1] - br label %bb94 - -bb98: ; preds = %bb91, %invcont95 - %98 = sub i32 %e, %a ; <i32> [#uses=1] - %99 = getelementptr i64* %6, i32 %3 ; <i64*> [#uses=1] - %100 = load i64* %99, align 8 ; <i64> [#uses=1] - invoke fastcc void @ce3806g__fxio__put__put_int64__4.1339( %struct.FRAME.ce3806g__fxio__put__4* %CHAIN.365, i64 %100, i32 %98 ) - to label %bb101 unwind label %lpad - -bb101: ; preds = %bb98 - ret void - -lpad: ; preds = %bb98, %bb94, %bb83, %bb63 - %eh_ptr = call i8* @llvm.eh.exception( ) ; <i8*> [#uses=2] - %eh_select103 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32* @__gnat_all_others_value ) ; <i32> [#uses=0] - call void @llvm.stackrestore( i8* %1 ) - %101 = call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; <i32> [#uses=0] - unreachable -} - -declare i8* @llvm.stacksave() nounwind - -declare void @system__arith_64__scaled_divide({ i64, i64 }* noalias sret, i64, i64, i64, i8) - -declare i64 @system__exn_lli__exn_long_long_integer(i64, i32) readnone - -declare void @llvm.stackrestore(i8*) nounwind - -declare i32 @system__img_real__set_image_real(x86_fp80, i8*, %struct.string___XUB*, i32, i32, i32, i32) - -declare void @ada__text_io__generic_aux__put_item(%struct.ada__text_io__text_afcb*, i8*, %struct.string___XUB*) - -declare void @report__test(i8*, %struct.string___XUB*, i8*, %struct.string___XUB*) - -declare void @system__secondary_stack__ss_mark(%struct.string___XUB* noalias sret) - -declare void @system__exception_table__register_exception(%struct.system__standard_library__exception_data*) - -declare void @report__legal_file_name(%struct.system__file_control_block__pstring* noalias sret, i32, i8*, %struct.string___XUB*) - -declare %struct.ada__text_io__text_afcb* @ada__text_io__create(%struct.ada__text_io__text_afcb*, i8, i8*, %struct.string___XUB*, i8*, %struct.string___XUB*) - -declare void @system__secondary_stack__ss_release(i32, i32) - -declare void @report__not_applicable(i8*, %struct.string___XUB*) - -declare void @ada__text_io__set_output(%struct.ada__text_io__text_afcb*) - -declare %struct.ada__text_io__text_afcb* @ada__text_io__close(%struct.ada__text_io__text_afcb*) - -declare %struct.ada__text_io__text_afcb* @ada__text_io__open(%struct.ada__text_io__text_afcb*, i8, i8*, %struct.string___XUB*, i8*, %struct.string___XUB*) - -declare %struct.ada__text_io__text_afcb* @ada__text_io__standard_output() - -declare void @report__failed(i8*, %struct.string___XUB*) - -declare void @ext(i32*) - -declare %struct.ada__text_io__text_afcb* @ada__text_io__delete(%struct.ada__text_io__text_afcb*) - -declare void @report__result() diff --git a/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll b/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll index e6c76b3..003fbb1 100644 --- a/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll +++ b/test/Transforms/Reassociate/2011-01-26-UseAfterFree.ll @@ -3,8 +3,6 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" target triple = "i386-gnu-linux" -%ada__tags__T15s = type void () - define void @exp_averages_intraday__deviation() { entry: %0 = load i32* undef, align 4 diff --git a/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll b/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll deleted file mode 100644 index bb0cf04..0000000 --- a/test/Transforms/SCCP/2002-05-02-EdgeFailure.ll +++ /dev/null @@ -1,26 +0,0 @@ -; edgefailure - This function illustrates how SCCP is not doing it's job. This -; function should be optimized almost completely away: the loop should be -; analyzed to detect that the body executes exactly once, and thus the branch -; can be eliminated and code becomes trivially dead. This is distilled from a -; real benchmark (mst from Olden benchmark, MakeGraph function). When SCCP is -; fixed, this should be eliminated by a single SCCP application. -; -; RUN: opt < %s -sccp -S | not grep loop - -define i32* @test() { -bb1: - %A = malloc i32 ; <i32*> [#uses=2] - br label %bb2 -bb2: ; preds = %bb2, %bb1 - ;; Always 0 - %i = phi i32 [ %i2, %bb2 ], [ 0, %bb1 ] ; <i32> [#uses=2] - ;; Always 1 - %i2 = add i32 %i, 1 ; <i32> [#uses=2] - store i32 %i, i32* %A - ;; Always false - %loop = icmp sle i32 %i2, 0 ; <i1> [#uses=1] - br i1 %loop, label %bb2, label %bb3 -bb3: ; preds = %bb2 - ret i32* %A -} - diff --git a/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll b/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll index 1b26ca9..a40455c 100644 --- a/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll +++ b/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll @@ -5,7 +5,7 @@ declare {i32, i32} @bar(i32 %A) define i32 @foo() { %X = call {i32, i32} @bar(i32 17) - %Y = getresult {i32, i32} %X, 0 + %Y = extractvalue {i32, i32} %X, 0 %Z = add i32 %Y, %Y ret i32 %Z } diff --git a/test/Transforms/SCCP/ipsccp-basic.ll b/test/Transforms/SCCP/ipsccp-basic.ll index a3c7637..b9e3f42 100644 --- a/test/Transforms/SCCP/ipsccp-basic.ll +++ b/test/Transforms/SCCP/ipsccp-basic.ll @@ -126,7 +126,7 @@ B: ; CHECK: define i64 @test5b() ; CHECK: A: -; CHECK-NEXT: %c = call i64 @test5c(%0 %a) +; CHECK-NEXT: %c = call i64 @test5c({ i64, i64 } %a) ; CHECK-NEXT: ret i64 5 define internal i64 @test5c({i64,i64} %a) { @@ -153,7 +153,7 @@ define i64 @test6b() { %T = type {i32,i32} -define internal {i32, i32} @test7a(i32 %A) { +define internal %T @test7a(i32 %A) { %X = add i32 1, %A %mrv0 = insertvalue %T undef, i32 %X, 0 %mrv1 = insertvalue %T %mrv0, i32 %A, 1 @@ -164,8 +164,8 @@ define internal {i32, i32} @test7a(i32 %A) { } define i32 @test7b() { - %X = call {i32, i32} @test7a(i32 17) - %Y = extractvalue {i32, i32} %X, 0 + %X = call %T @test7a(i32 17) + %Y = extractvalue %T %X, 0 %Z = add i32 %Y, %Y ret i32 %Z ; CHECK: define i32 @test7b diff --git a/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll b/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll index 24e6a31..d754987 100644 --- a/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll +++ b/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll @@ -6,10 +6,10 @@ declare i32 @.callback_1(i8*) declare void @.iter_2(i32 (i8*)*, i8*) define i32 @main() { - %d = alloca { [80 x i8], i32, i32 } ; <{ [80 x i8], i32, i32 }*> [#uses=2] - %tmp.0 = getelementptr { [80 x i8], i32, i32 }* %d, i64 0, i32 2 ; <i32*> [#uses=1] + %d = alloca %T ; <{ [80 x i8], i32, i32 }*> [#uses=2] + %tmp.0 = getelementptr %T* %d, i64 0, i32 2 ; <i32*> [#uses=1] store i32 0, i32* %tmp.0 - %tmp.1 = getelementptr { [80 x i8], i32, i32 }* %d, i64 0, i32 0, i64 0 ; <i8*> [#uses=1] + %tmp.1 = getelementptr %T* %d, i64 0, i32 0, i64 0 ; <i8*> [#uses=1] call void @.iter_2( i32 (i8*)* @.callback_1, i8* %tmp.1 ) ret i32 0 } diff --git a/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll b/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll deleted file mode 100644 index e67b610..0000000 --- a/test/Transforms/ScalarRepl/2007-05-24-LargeAggregate.ll +++ /dev/null @@ -1,27 +0,0 @@ -; RUN: opt < %s -scalarrepl -S | grep {alloca.*client_t} -; PR1446 -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" -target triple = "i686-pc-linux-gnu" - - %struct.clientSnapshot_t = type { i32, [32 x i8], %struct.playerState_t, i32, i32, i32, i32, i32 } - %struct.client_t = type { i32, [1024 x i8], [64 x [1024 x i8]], i32, i32, i32, i32, i32, i32, %struct.usercmd_t, i32, i32, [1024 x i8], %struct.sharedEntity_t*, [32 x i8], [64 x i8], i32, i32, i32, i32, i32, i32, [8 x i8*], [8 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, [32 x %struct.clientSnapshot_t], i32, i32, i32, i32, i32, %struct.netchan_t, %struct.netchan_buffer_t*, %struct.netchan_buffer_t**, i32, [1025 x i32] } - %struct.entityShared_t = type { %struct.entityState_t, i32, i32, i32, i32, i32, [3 x float], [3 x float], i32, [3 x float], [3 x float], [3 x float], [3 x float], i32 } - %struct.entityState_t = type { i32, i32, i32, %struct.trajectory_t, %struct.trajectory_t, i32, i32, [3 x float], [3 x float], [3 x float], [3 x float], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } - %struct.msg_t = type { i32, i32, i32, i8*, i32, i32, i32, i32 } - %struct.netadr_t = type { i32, [4 x i8], [10 x i8], i16 } - %struct.netchan_buffer_t = type { %struct.msg_t, [16384 x i8], %struct.netchan_buffer_t* } - %struct.netchan_t = type { i32, i32, %struct.netadr_t, i32, i32, i32, i32, i32, [16384 x i8], i32, i32, i32, [16384 x i8] } - %struct.playerState_t = type { i32, i32, i32, i32, i32, [3 x float], [3 x float], i32, i32, i32, [3 x i32], i32, i32, i32, i32, i32, i32, [3 x float], i32, i32, [2 x i32], [2 x i32], i32, i32, i32, i32, i32, i32, [3 x float], i32, i32, i32, i32, i32, [16 x i32], [16 x i32], [16 x i32], [16 x i32], i32, i32, i32, i32, i32, i32, i32 } - %struct.sharedEntity_t = type { %struct.entityState_t, %struct.entityShared_t } - %struct.trajectory_t = type { i32, i32, i32, [3 x float], [3 x float] } - %struct.usercmd_t = type { i32, [3 x i32], i32, i8, i8, i8, i8 } - -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - -define void @SV_DirectConnect(i64 %from.0.0, i64 %from.0.1, i32 %from.1) { -entry: - %temp = alloca %struct.client_t, align 16 ; <%struct.client_t*> [#uses=1] - %temp586 = bitcast %struct.client_t* %temp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* null, i8* %temp586, i32 121596, i32 0 ) - unreachable -} diff --git a/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll b/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll index f1b8b80..cf96c4c 100644 --- a/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll +++ b/test/Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll @@ -3,21 +3,22 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "i686-apple-darwin8" - %struct.LongestMember = type { i8, i32 } - %struct.MyString = type { i32 } - %struct.UnionType = type { %struct.LongestMember } + +%struct.LongestMember = type { i8, i32 } +%struct.MyString = type { i32 } +%struct.UnionType = type { %struct.LongestMember } define void @_Z4testP9UnionTypePS0_(%struct.UnionType* %p, %struct.UnionType** %pointerToUnion) { entry: - %tmp = alloca %struct.UnionType, align 8 ; <%struct.UnionType*> [#uses=2] - %tmp2 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp13 = getelementptr %struct.UnionType* %p, i32 0, i32 0, i32 0 ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp2, i8* %tmp13, i32 8, i32 0 ) - %tmp5 = load %struct.UnionType** %pointerToUnion ; <%struct.UnionType*> [#uses=1] - %tmp56 = getelementptr %struct.UnionType* %tmp5, i32 0, i32 0, i32 0 ; <i8*> [#uses=1] - %tmp7 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %tmp56, i8* %tmp7, i32 8, i32 0 ) - ret void + %tmp = alloca %struct.UnionType, align 8 + %tmp2 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 + %tmp13 = getelementptr %struct.UnionType* %p, i32 0, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp2, i8* %tmp13, i32 8, i32 0, i1 false) + %tmp5 = load %struct.UnionType** %pointerToUnion + %tmp56 = getelementptr %struct.UnionType* %tmp5, i32 0, i32 0, i32 0 + %tmp7 = getelementptr %struct.UnionType* %tmp, i32 0, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp56, i8* %tmp7, i32 8, i32 0, i1 false) + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll b/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll index 81b6746..48abffe 100644 --- a/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll +++ b/test/Transforms/ScalarRepl/2007-11-03-bigendian_apint.ll @@ -2,7 +2,7 @@ %struct.S = type { i16 } -define i1 @f(i16 signext %b) zeroext { +define zeroext i1 @f(i16 signext %b) { entry: %b_addr = alloca i16 ; <i16*> [#uses=2] %retval = alloca i32 ; <i32*> [#uses=2] diff --git a/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll b/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll index b704727..71ba601 100644 --- a/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll +++ b/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll @@ -4,14 +4,14 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" -define void @memtest1(i8* %dst, i8* %src) nounwind { +define void @memtest1(i8* %dst, i8* %src) nounwind { entry: - %temp = alloca [200 x i8] ; <[100 x i8]*> [#uses=2] - %temp1 = bitcast [200 x i8]* %temp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %temp1, i8* %src, i32 200, i32 1 ) - %temp3 = bitcast [200 x i8]* %temp to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %dst, i8* %temp3, i32 200, i32 1 ) - ret void + %temp = alloca [200 x i8] + %temp1 = bitcast [200 x i8]* %temp to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %temp1, i8* %src, i32 200, i32 1, i1 false) + %temp3 = bitcast [200 x i8]* %temp to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %temp3, i32 200, i32 1, i1 false) + ret void } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll b/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll index 1df01c1..7cccb19 100644 --- a/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll +++ b/test/Transforms/ScalarRepl/2008-08-22-out-of-range-array-promote.ll @@ -2,21 +2,22 @@ ; PR2423 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin8" - %struct.x = type { [1 x i32], i32, i32 } + +%struct.x = type { [1 x i32], i32, i32 } define i32 @b() nounwind { entry: - %s = alloca %struct.x ; <%struct.x*> [#uses=2] - %r = alloca %struct.x ; <%struct.x*> [#uses=2] - call i32 @a( %struct.x* %s ) nounwind ; <i32>:0 [#uses=0] - %r1 = bitcast %struct.x* %r to i8* ; <i8*> [#uses=1] - %s2 = bitcast %struct.x* %s to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %r1, i8* %s2, i32 12, i32 8 ) - getelementptr %struct.x* %r, i32 0, i32 0, i32 1 ; <i32*>:1 [#uses=1] - load i32* %1, align 4 ; <i32>:2 [#uses=1] - ret i32 %2 + %s = alloca %struct.x + %r = alloca %struct.x + %0 = call i32 @a(%struct.x* %s) nounwind + %r1 = bitcast %struct.x* %r to i8* + %s2 = bitcast %struct.x* %s to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %r1, i8* %s2, i32 12, i32 8, i1 false) + %1 = getelementptr %struct.x* %r, i32 0, i32 0, i32 1 + %2 = load i32* %1, align 4 + ret i32 %2 } declare i32 @a(%struct.x*) -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll b/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll index e32e683..e7a58f1 100644 --- a/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll +++ b/test/Transforms/ScalarRepl/2008-09-22-vector-gep.ll @@ -18,8 +18,8 @@ entry: ; because the type of the first element in %struct.two is i8. %tmpS = getelementptr %struct.two* %S, i32 0, i32 0, i32 0 %tmpD = bitcast %struct.two* %D to i8* - call void @llvm.memmove.i32(i8* %tmpD, i8* %tmpS, i32 4, i32 1) + call void @llvm.memmove.p0i8.p0i8.i32(i8* %tmpD, i8* %tmpS, i32 4, i32 1, i1 false) ret void } -declare void @llvm.memmove.i32(i8*, i8*, i32, i32) nounwind +declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
\ No newline at end of file diff --git a/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll b/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll index 526457b..3218d59 100644 --- a/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll +++ b/test/Transforms/ScalarRepl/2009-03-04-MemCpyAlign.ll @@ -12,9 +12,8 @@ entry: %0 = getelementptr %struct.st* %s, i32 0, i32 0 ; <i16*> [#uses=1] store i16 1, i16* %0, align 4 %s1 = bitcast %struct.st* %s to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32(i8* %p, i8* %s1, i32 2, i32 1) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %p, i8* %s1, i32 2, i32 1, i1 false) ret void } -declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind - +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll b/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll index 50e7f9a..d71bcb9 100644 --- a/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll +++ b/test/Transforms/ScalarRepl/2009-03-05-Aggre2Scalar-dbg.ll @@ -1,11 +1,11 @@ ; RUN: opt < %s -scalarrepl -disable-output -stats |& grep "Number of aggregates converted to scalar" target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" target triple = "i386-apple-darwin9.6" - type { } ; type %0 - type { i8*, i32, i32, i16, i16, %2, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %2, %3*, i32, [3 x i8], [1 x i8], %2, i32, i64 } ; type %1 - type { i8*, i32 } ; type %2 - type opaque ; type %3 - type { i32 } ; type %4 + %0 = type { } ; type %0 + %1 = type { i8*, i32, i32, i16, i16, %2, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %2, %3*, i32, [3 x i8], [1 x i8], %2, i32, i64 } ; type %1 + %2 = type { i8*, i32 } ; type %2 + %3 = type opaque ; type %3 + %4 = type { i32 } ; type %4 %llvm.dbg.anchor.type = type { i32, i32 } %llvm.dbg.basictype.type = type { i32, %0*, i8*, %0*, i32, i64, i64, i64, i32, i32 } %llvm.dbg.compile_unit.type = type { i32, %0*, i32, i8*, i8*, i8*, i1, i1, i8*, i32 } diff --git a/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll b/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll index 31d9bae..1993e4f 100644 --- a/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll +++ b/test/Transforms/ScalarRepl/2009-12-11-NeonTypes.ll @@ -13,54 +13,54 @@ define void @test(<8 x i16> %tmp.0, %struct.int16x8x2_t* %dst) nounwind { ; CHECK: @test ; CHECK-NOT: alloca ; CHECK: "alloca point" +; CHECK: store <8 x i16> +; CHECK: store <8 x i16> + entry: - %tmp_addr = alloca %struct.int16x8_t ; <%struct.int16x8_t*> [#uses=3] - %dst_addr = alloca %struct.int16x8x2_t* ; <%struct.int16x8x2_t**> [#uses=2] - %__rv = alloca %union..0anon ; <%union..0anon*> [#uses=2] - %__bx = alloca %struct.int16x8_t ; <%struct.int16x8_t*> [#uses=2] - %__ax = alloca %struct.int16x8_t ; <%struct.int16x8_t*> [#uses=2] - %tmp2 = alloca %struct.int16x8x2_t ; <%struct.int16x8x2_t*> [#uses=2] - %0 = alloca %struct.int16x8x2_t ; <%struct.int16x8x2_t*> [#uses=2] - %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0] - %1 = getelementptr inbounds %struct.int16x8_t* %tmp_addr, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] + %tmp_addr = alloca %struct.int16x8_t + %dst_addr = alloca %struct.int16x8x2_t* + %__rv = alloca %union..0anon + %__bx = alloca %struct.int16x8_t + %__ax = alloca %struct.int16x8_t + %tmp2 = alloca %struct.int16x8x2_t + %0 = alloca %struct.int16x8x2_t + %"alloca point" = bitcast i32 0 to i32 + %1 = getelementptr inbounds %struct.int16x8_t* %tmp_addr, i32 0, i32 0 store <8 x i16> %tmp.0, <8 x i16>* %1 store %struct.int16x8x2_t* %dst, %struct.int16x8x2_t** %dst_addr - %2 = getelementptr inbounds %struct.int16x8_t* %__ax, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] - %3 = getelementptr inbounds %struct.int16x8_t* %tmp_addr, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] - %4 = load <8 x i16>* %3, align 16 ; <<8 x i16>> [#uses=1] + %2 = getelementptr inbounds %struct.int16x8_t* %__ax, i32 0, i32 0 + %3 = getelementptr inbounds %struct.int16x8_t* %tmp_addr, i32 0, i32 0 + %4 = load <8 x i16>* %3, align 16 store <8 x i16> %4, <8 x i16>* %2, align 16 - %5 = getelementptr inbounds %struct.int16x8_t* %__bx, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] - %6 = getelementptr inbounds %struct.int16x8_t* %tmp_addr, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] - %7 = load <8 x i16>* %6, align 16 ; <<8 x i16>> [#uses=1] + %5 = getelementptr inbounds %struct.int16x8_t* %__bx, i32 0, i32 0 + %6 = getelementptr inbounds %struct.int16x8_t* %tmp_addr, i32 0, i32 0 + %7 = load <8 x i16>* %6, align 16 store <8 x i16> %7, <8 x i16>* %5, align 16 - %8 = getelementptr inbounds %struct.int16x8_t* %__ax, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] - %9 = load <8 x i16>* %8, align 16 ; <<8 x i16>> [#uses=2] - %10 = getelementptr inbounds %struct.int16x8_t* %__bx, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] - %11 = load <8 x i16>* %10, align 16 ; <<8 x i16>> [#uses=2] - %12 = getelementptr inbounds %union..0anon* %__rv, i32 0, i32 0 ; <%struct.int16x8x2_t*> [#uses=1] - %13 = bitcast %struct.int16x8x2_t* %12 to %struct.__neon_int16x8x2_t* ; <%struct.__neon_int16x8x2_t*> [#uses=2] - %14 = shufflevector <8 x i16> %9, <8 x i16> %11, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14> ; <<8 x i16>> [#uses=1] - %15 = getelementptr inbounds %struct.__neon_int16x8x2_t* %13, i32 0, i32 0 ; <<8 x i16>*> [#uses=1] + %8 = getelementptr inbounds %struct.int16x8_t* %__ax, i32 0, i32 0 + %9 = load <8 x i16>* %8, align 16 + %10 = getelementptr inbounds %struct.int16x8_t* %__bx, i32 0, i32 0 + %11 = load <8 x i16>* %10, align 16 + %12 = getelementptr inbounds %union..0anon* %__rv, i32 0, i32 0 + %13 = bitcast %struct.int16x8x2_t* %12 to %struct.__neon_int16x8x2_t* + %14 = shufflevector <8 x i16> %9, <8 x i16> %11, <8 x i32> <i32 0, i32 8, i32 2, i32 10, i32 4, i32 12, i32 6, i32 14> + %15 = getelementptr inbounds %struct.__neon_int16x8x2_t* %13, i32 0, i32 0 store <8 x i16> %14, <8 x i16>* %15 - %16 = shufflevector <8 x i16> %9, <8 x i16> %11, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15> ; <<8 x i16>> [#uses=1] - %17 = getelementptr inbounds %struct.__neon_int16x8x2_t* %13, i32 0, i32 1 ; <<8 x i16>*> [#uses=1] + %16 = shufflevector <8 x i16> %9, <8 x i16> %11, <8 x i32> <i32 1, i32 9, i32 3, i32 11, i32 5, i32 13, i32 7, i32 15> + %17 = getelementptr inbounds %struct.__neon_int16x8x2_t* %13, i32 0, i32 1 store <8 x i16> %16, <8 x i16>* %17 - %18 = getelementptr inbounds %union..0anon* %__rv, i32 0, i32 0 ; <%struct.int16x8x2_t*> [#uses=1] - %19 = bitcast %struct.int16x8x2_t* %0 to i8* ; <i8*> [#uses=1] - %20 = bitcast %struct.int16x8x2_t* %18 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32(i8* %19, i8* %20, i32 32, i32 16) - %tmp21 = bitcast %struct.int16x8x2_t* %tmp2 to i8* ; <i8*> [#uses=1] - %21 = bitcast %struct.int16x8x2_t* %0 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32(i8* %tmp21, i8* %21, i32 32, i32 16) - %22 = load %struct.int16x8x2_t** %dst_addr, align 4 ; <%struct.int16x8x2_t*> [#uses=1] - %23 = bitcast %struct.int16x8x2_t* %22 to i8* ; <i8*> [#uses=1] - %tmp22 = bitcast %struct.int16x8x2_t* %tmp2 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32(i8* %23, i8* %tmp22, i32 32, i32 16) + %18 = getelementptr inbounds %union..0anon* %__rv, i32 0, i32 0 + %19 = bitcast %struct.int16x8x2_t* %0 to i8* + %20 = bitcast %struct.int16x8x2_t* %18 to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %19, i8* %20, i32 32, i32 16, i1 false) + %tmp21 = bitcast %struct.int16x8x2_t* %tmp2 to i8* + %21 = bitcast %struct.int16x8x2_t* %0 to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp21, i8* %21, i32 32, i32 16, i1 false) + %22 = load %struct.int16x8x2_t** %dst_addr, align 4 + %23 = bitcast %struct.int16x8x2_t* %22 to i8* + %tmp22 = bitcast %struct.int16x8x2_t* %tmp2 to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %23, i8* %tmp22, i32 32, i32 16, i1 false) br label %return -; CHECK: store <8 x i16> -; CHECK: store <8 x i16> - return: ; preds = %entry ret void } @@ -69,21 +69,22 @@ return: ; preds = %entry %struct._NSRange = type { i64 } define void @test_memcpy_self() nounwind { -; CHECK: @test_memcpy_self -; CHECK-NOT: alloca -; CHECK: br i1 entry: - %range = alloca %struct._NSRange ; <%struct._NSRange*> [#uses=2] + %range = alloca %struct._NSRange br i1 undef, label %cond.true, label %cond.false cond.true: ; preds = %entry - %tmp3 = bitcast %struct._NSRange* %range to i8* ; <i8*> [#uses=1] - %tmp4 = bitcast %struct._NSRange* %range to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32(i8* %tmp3, i8* %tmp4, i32 8, i32 8) + %tmp3 = bitcast %struct._NSRange* %range to i8* + %tmp4 = bitcast %struct._NSRange* %range to i8* + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %tmp3, i8* %tmp4, i32 8, i32 8, i1 false) ret void cond.false: ; preds = %entry ret void + +; CHECK: @test_memcpy_self +; CHECK-NOT: alloca +; CHECK: br i1 } -declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll b/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll index 3aee399..52df6d5 100644 --- a/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll +++ b/test/Transforms/ScalarRepl/2010-01-18-SelfCopy.ll @@ -3,7 +3,7 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" -%struct.test = type { [3 x double ] } +%struct.test = type { [3 x double] } define void @test_memcpy_self() nounwind { ; CHECK: @test_memcpy_self @@ -11,8 +11,8 @@ define void @test_memcpy_self() nounwind { ; CHECK: ret void %1 = alloca %struct.test %2 = bitcast %struct.test* %1 to i8* - call void @llvm.memcpy.i32(i8* %2, i8* %2, i32 24, i32 4) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %2, i8* %2, i32 24, i32 4, i1 false) ret void } -declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll b/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll index 32e67fb..98fa1c6 100644 --- a/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll +++ b/test/Transforms/ScalarRepl/2011-06-08-VectorExtractValue.ll @@ -10,7 +10,8 @@ target triple = "x86_64-apple-macosx10.7.0" ; CHECK: main ; CHECK-NOT: alloca -; CHECK: extractelement <2 x float> zeroinitializer +; CHECK: %[[A:[a-z0-9]*]] = and i128 +; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32 define void @main() uwtable ssp { entry: @@ -27,7 +28,8 @@ entry: ; CHECK: test1 ; CHECK-NOT: alloca -; CHECK: extractelement <2 x float> zeroinitializer +; CHECK: %[[A:[a-z0-9]*]] = and i128 +; CHECK: %[[B:[a-z0-9]*]] = trunc i128 %[[A]] to i32 define void @test1() uwtable ssp { entry: diff --git a/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll b/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll new file mode 100644 index 0000000..f8530d6 --- /dev/null +++ b/test/Transforms/ScalarRepl/2011-06-17-VectorPartialMemset.ll @@ -0,0 +1,37 @@ +; RUN: opt < %s -scalarrepl -S | FileCheck %s +target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32" +target triple = "thumbv7-apple-darwin10" + +; CHECK: f +; CHECK-NOT: alloca +; CHECK: %[[A:[a-z0-9]*]] = and i128 undef, -16777216 +; CHECK: %[[B:[a-z0-9]*]] = bitcast i128 %[[A]] to <4 x float> +; CHECK: %[[C:[a-z0-9]*]] = extractelement <4 x float> %[[B]], i32 0 +; CHECK: ret float %[[C]] + +define float @f() nounwind ssp { +entry: + %a = alloca <4 x float>, align 16 + %p = bitcast <4 x float>* %a to i8* + call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 3, i32 16, i1 false) + %vec = load <4 x float>* %a, align 8 + %val = extractelement <4 x float> %vec, i32 0 + ret float %val +} + +; CHECK: g +; CHECK-NOT: alloca +; CHECK: and i128 + +define void @g() nounwind ssp { +entry: + %a = alloca { <4 x float> }, align 16 + %p = bitcast { <4 x float> }* %a to i8* + call void @llvm.memset.p0i8.i32(i8* %p, i8 0, i32 16, i32 16, i1 false) + %q = bitcast { <4 x float> }* %a to [2 x <2 x float>]* + %arrayidx = getelementptr inbounds [2 x <2 x float>]* %q, i32 0, i32 0 + store <2 x float> undef, <2 x float>* %arrayidx, align 8 + ret void +} + +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/badarray.ll b/test/Transforms/ScalarRepl/badarray.ll index 3ec3c01..768fec6 100644 --- a/test/Transforms/ScalarRepl/badarray.ll +++ b/test/Transforms/ScalarRepl/badarray.ll @@ -48,10 +48,10 @@ entry: %callret = call %padded *@test3f() ; <i32> [#uses=2] %callretcast = bitcast %padded* %callret to i8* ; <i8*> [#uses=1] %var_11 = bitcast %padded* %var_1 to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32(i8* %callretcast, i8* %var_11, i32 8, i32 4) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %callretcast, i8* %var_11, i32 8, i32 4, i1 false) ret void } -declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind declare %padded* @test3f() diff --git a/test/Transforms/ScalarRepl/copy-aggregate.ll b/test/Transforms/ScalarRepl/copy-aggregate.ll index 997da4b..51ba810 100644 --- a/test/Transforms/ScalarRepl/copy-aggregate.ll +++ b/test/Transforms/ScalarRepl/copy-aggregate.ll @@ -68,16 +68,15 @@ define i128 @test4(float %a, float %b) nounwind { ;; If the elements of a struct or array alloca contain padding, SROA can still ;; split up the alloca as long as there is no padding between the elements. %padded = type { i16, i8 } -%arr = type [4 x %padded] -define void @test5(%arr* %p, %arr* %q) { +define void @test5([4 x %padded]* %p, [4 x %padded]* %q) { entry: ; CHECK: test5 ; CHECK-NOT: i128 - %var = alloca %arr, align 4 - %vari8 = bitcast %arr* %var to i8* - %pi8 = bitcast %arr* %p to i8* + %var = alloca [4 x %padded], align 4 + %vari8 = bitcast [4 x %padded]* %var to i8* + %pi8 = bitcast [4 x %padded]* %p to i8* call void @llvm.memcpy.p0i8.p0i8.i32(i8* %vari8, i8* %pi8, i32 16, i32 4, i1 false) - %qi8 = bitcast %arr* %q to i8* + %qi8 = bitcast [4 x %padded]* %q to i8* call void @llvm.memcpy.p0i8.p0i8.i32(i8* %qi8, i8* %vari8, i32 16, i32 4, i1 false) ret void } diff --git a/test/Transforms/ScalarRepl/crash.ll b/test/Transforms/ScalarRepl/crash.ll index 7b62f09..cd4dc32 100644 --- a/test/Transforms/ScalarRepl/crash.ll +++ b/test/Transforms/ScalarRepl/crash.ll @@ -143,7 +143,6 @@ entry: %struct.anon = type { %struct.aal_spanarray_t } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) define fastcc void @test7() { entry: @@ -158,7 +157,7 @@ cond_next114.i: ; preds = %cond_true cond_next: ; preds = %cond_true %SB19 = bitcast %struct.aal_spanbucket_t* %SB to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %SB19, i8* null, i32 12, i32 0 ) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %SB19, i8* null, i32 12, i32 0, i1 false) br i1 false, label %cond_next34, label %cond_next79 cond_next34: ; preds = %cond_next @@ -189,14 +188,14 @@ entry: ; rdar://6808691 - ZeroLengthMemSet - type <{ i32, i16, i8, i8, i64, i64, i16, [0 x i16] }> + %0 = type <{ i32, i16, i8, i8, i64, i64, i16, [0 x i16] }> define i32 @test9() { entry: %.compoundliteral = alloca %0 %tmp228 = getelementptr %0* %.compoundliteral, i32 0, i32 7 %tmp229 = bitcast [0 x i16]* %tmp228 to i8* - call void @llvm.memset.i64(i8* %tmp229, i8 0, i64 0, i32 2) + call void @llvm.memset.p0i8.i64(i8* %tmp229, i8 0, i64 0, i32 2, i1 false) unreachable } @@ -245,10 +244,12 @@ entry: ; VLAs. define void @test12() { bb4.i: - %0 = malloc [0 x %struct.Item] ; <[0 x %struct.Item]*> [#uses=1] + %malloccall = tail call i8* @malloc(i32 0) + %0 = bitcast i8* %malloccall to [0 x %struct.Item]* %.sub.i.c.i = getelementptr [0 x %struct.Item]* %0, i32 0, i32 0 ; <%struct.Item*> [#uses=0] unreachable } +declare noalias i8* @malloc(i32) ; PR8680 define void @test13() nounwind { @@ -258,3 +259,6 @@ entry: call void %0() nounwind ret void } + +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind +declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind diff --git a/test/Transforms/ScalarRepl/memcpy-from-global.ll b/test/Transforms/ScalarRepl/memcpy-from-global.ll index 5b25864..59475ad 100644 --- a/test/Transforms/ScalarRepl/memcpy-from-global.ll +++ b/test/Transforms/ScalarRepl/memcpy-from-global.ll @@ -93,4 +93,18 @@ define void @test4() { ret void } +declare void @llvm.lifetime.start(i64, i8*) +define void @test5() { + %A = alloca %T + %a = bitcast %T* %A to i8* + call void @llvm.lifetime.start(i64 -1, i8* %a) + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %a, i8* bitcast (%T* @G to i8*), i64 124, i32 4, i1 false) + call void @baz(i8* byval %a) +; CHECK: @test5 +; CHECK-NEXT: %a = bitcast %T* @G to i8* +; CHECK-NEXT: call void @baz(i8* byval %a) + ret void +} + + declare void @baz(i8* byval) diff --git a/test/Transforms/ScalarRepl/memset-aggregate.ll b/test/Transforms/ScalarRepl/memset-aggregate.ll index 5aeefcd..42e7a0f 100644 --- a/test/Transforms/ScalarRepl/memset-aggregate.ll +++ b/test/Transforms/ScalarRepl/memset-aggregate.ll @@ -14,31 +14,29 @@ entry: %L = alloca %struct.foo, align 8 ; <%struct.foo*> [#uses=2] %L2 = bitcast %struct.foo* %L to i8* ; <i8*> [#uses=1] %tmp13 = bitcast %struct.foo* %P to i8* ; <i8*> [#uses=1] - call void @llvm.memcpy.i32( i8* %L2, i8* %tmp13, i32 8, i32 4 ) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %L2, i8* %tmp13, i32 8, i32 4, i1 false) %tmp4 = getelementptr %struct.foo* %L, i32 0, i32 0 ; <i32*> [#uses=1] %tmp5 = load i32* %tmp4 ; <i32> [#uses=1] ret i32 %tmp5 } -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) define i32 @test2() { entry: %L = alloca [4 x %struct.foo], align 16 ; <[4 x %struct.foo]*> [#uses=2] %L12 = bitcast [4 x %struct.foo]* %L to i8* ; <i8*> [#uses=1] - call void @llvm.memset.i32( i8* %L12, i8 0, i32 32, i32 16 ) + call void @llvm.memset.p0i8.i32(i8* %L12, i8 0, i32 32, i32 16, i1 false) %tmp4 = getelementptr [4 x %struct.foo]* %L, i32 0, i32 0, i32 0 ; <i32*> [#uses=1] %tmp5 = load i32* %tmp4 ; <i32> [#uses=1] ret i32 %tmp5 } -declare void @llvm.memset.i32(i8*, i8, i32, i32) define i32 @test3() { entry: %B = alloca %struct.bar, align 16 ; <%struct.bar*> [#uses=4] %B1 = bitcast %struct.bar* %B to i8* ; <i8*> [#uses=1] - call void @llvm.memset.i32( i8* %B1, i8 1, i32 24, i32 16 ) + call void @llvm.memset.p0i8.i32(i8* %B1, i8 1, i32 24, i32 16, i1 false) %tmp3 = getelementptr %struct.bar* %B, i32 0, i32 0, i32 0 ; <i32*> [#uses=1] store i32 1, i32* %tmp3 %tmp4 = getelementptr %struct.bar* %B, i32 0, i32 2 ; <double*> [#uses=1] @@ -58,9 +56,12 @@ entry: store i32 1, i32* %0, align 8 %1 = getelementptr %struct.f* %A, i32 0, i32 1 ; <i32*> [#uses=1] %2 = bitcast i32* %1 to i8* ; <i8*> [#uses=1] - call void @llvm.memset.i32(i8* %2, i8 2, i32 12, i32 4) + call void @llvm.memset.p0i8.i32(i8* %2, i8 2, i32 12, i32 4, i1 false) %3 = getelementptr %struct.f* %A, i32 0, i32 2 ; <i32*> [#uses=1] %4 = load i32* %3, align 8 ; <i32> [#uses=1] %retval12 = trunc i32 %4 to i16 ; <i16> [#uses=1] ret i16 %retval12 } +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind + +declare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1) nounwind
\ No newline at end of file diff --git a/test/Transforms/ScalarRepl/phi-select.ll b/test/Transforms/ScalarRepl/phi-select.ll index fa3972d..ffe0b1d 100644 --- a/test/Transforms/ScalarRepl/phi-select.ll +++ b/test/Transforms/ScalarRepl/phi-select.ll @@ -65,9 +65,9 @@ entry: %A = alloca %PairTy ; CHECK: @test4 ; CHECK: %A = alloca %PairTy - %B = getelementptr {i32, i32}* %A, i32 0, i32 0 + %B = getelementptr %PairTy* %A, i32 0, i32 0 store i32 1, i32* %B - %C = getelementptr {i32, i32}* %A, i32 0, i32 1 + %C = getelementptr %PairTy* %A, i32 0, i32 1 store i32 2, i32* %B %X = select i1 %c, i32* %B, i32* %C diff --git a/test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll b/test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll deleted file mode 100644 index 477c9c9..0000000 --- a/test/Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll +++ /dev/null @@ -1,75 +0,0 @@ -; RUN: opt < %s -simplifycfg -disable-output -; END. - - %arraytype.1.Char = type { i32, [0 x i8] } - %arraytype.4.Signed = type { i32, [0 x i32] } - %functiontype.23 = type %structtype.Task* (%structtype.Task*, %structtype.Packet*, %structtype.FailedRun*) - %functiontype.27 = type %structtype.object* () - %functiontype.28 = type i1 (%structtype.object*, %structtype.object_vtable*) - %functiontype.39 = type i32 (%structtype.listiter*) - %opaquetype.RuntimeTypeInfo = type i8* (i8*) - %structtype.AssertionError_vtable = type { %structtype.FailedRun_vtable } - %structtype.DeviceTask = type { %structtype.Task } - %structtype.FailedRun = type { %structtype.object } - %structtype.FailedRun_vtable = type { %structtype.object_vtable } - %structtype.Packet = type { %structtype.object, %structtype.list.1*, i32, i32, i32, %structtype.Packet* } - %structtype.Task = type { %structtype.TaskState, %structtype.FailedRun*, i32, %structtype.Packet*, %structtype.Task*, i32 } - %structtype.TaskState = type { %structtype.object, i1, i1, i1 } - %structtype.list.1 = type { %arraytype.4.Signed* } - %structtype.listiter = type { %structtype.list.1*, i32 } - %structtype.object = type { %structtype.object_vtable* } - %structtype.object_vtable = type { %structtype.object_vtable*, %opaquetype.RuntimeTypeInfo*, %arraytype.1.Char*, %functiontype.27* } -@structinstance.59 = external global %structtype.AssertionError_vtable ; <%structtype.AssertionError_vtable*> [#uses=0] - -declare fastcc i1 @ll_isinstance__objectPtr_object_vtablePtr() - -declare fastcc void @ll_listnext__listiterPtr() - -define fastcc void @WorkTask.fn() { -block0: - br label %block1 -block1: ; preds = %block0 - %v2542 = call fastcc i1 @ll_isinstance__objectPtr_object_vtablePtr( ) ; <i1> [#uses=1] - br i1 %v2542, label %block4, label %block2 -block2: ; preds = %block1 - br label %block3 -block3: ; preds = %block2 - unwind -block4: ; preds = %block1 - br label %block5 -block5: ; preds = %block4 - %v2565 = icmp eq %structtype.Packet* null, null ; <i1> [#uses=1] - br i1 %v2565, label %block15, label %block6 -block6: ; preds = %block5 - %self_2575 = phi %structtype.DeviceTask* [ null, %block5 ] ; <%structtype.DeviceTask*> [#uses=1] - br i1 false, label %block14, label %block7 -block7: ; preds = %block14, %block6 - %self_2635 = phi %structtype.DeviceTask* [ %self_2575, %block6 ], [ null, %block14 ] ; <%structtype.DeviceTask*> [#uses=1] - %tmp.124 = getelementptr %structtype.Packet* null, i32 0, i32 2 ; <i32*> [#uses=0] - br label %block8 -block8: ; preds = %block10, %block7 - %self_2672 = phi %structtype.DeviceTask* [ %self_2635, %block7 ], [ null, %block10 ] ; <%structtype.DeviceTask*> [#uses=0] - invoke fastcc void @ll_listnext__listiterPtr( ) - to label %block9 unwind label %block8_exception_handling -block8_exception_handling: ; preds = %block8 - br i1 false, label %block8_exception_found_branchto_block12, label %block8_not_exception_structinstance.10 -block8_not_exception_structinstance.10: ; preds = %block8_exception_handling - unwind -block8_exception_found_branchto_block12: ; preds = %block8_exception_handling - br label %block12 -block9: ; preds = %block8 - br i1 false, label %block11, label %block10 -block10: ; preds = %block11, %block9 - br label %block8 -block11: ; preds = %block9 - br label %block10 -block12: ; preds = %block8_exception_found_branchto_block12 - br label %block13 -block13: ; preds = %block15, %block12 - ret void -block14: ; preds = %block6 - br label %block7 -block15: ; preds = %block5 - %v2586 = phi %structtype.DeviceTask* [ null, %block5 ] ; <%structtype.DeviceTask*> [#uses=0] - br label %block13 -} diff --git a/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll b/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll deleted file mode 100644 index 8e05a3c..0000000 --- a/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll +++ /dev/null @@ -1,43 +0,0 @@ -; RUN: opt < %s -simplifycfg -disable-output -; rdar://5882392 -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-apple-darwin9" - %struct.Py_complex = type { double, double } - -define %struct.Py_complex @_Py_c_pow(double %a.0, double %a.1, double %b.0, double %b.1) nounwind { -entry: - %tmp7 = fcmp une double %b.0, 0.000000e+00 ; <i1> [#uses=1] - %tmp11 = fcmp une double %b.1, 0.000000e+00 ; <i1> [#uses=1] - %bothcond = or i1 %tmp7, %tmp11 ; <i1> [#uses=1] - br i1 %bothcond, label %bb15, label %bb53 - -bb15: ; preds = %entry - %tmp18 = fcmp une double %a.0, 0.000000e+00 ; <i1> [#uses=1] - %tmp24 = fcmp une double %a.1, 0.000000e+00 ; <i1> [#uses=1] - %bothcond1 = or i1 %tmp18, %tmp24 ; <i1> [#uses=1] - br i1 %bothcond1, label %bb29, label %bb27 - -bb27: ; preds = %bb15 - %tmp28 = call i32* @__error( ) nounwind ; <i32*> [#uses=1] - store i32 33, i32* %tmp28, align 4 - ret double undef, double undef - -bb29: ; preds = %bb15 - %tmp36 = fcmp une double %b.1, 0.000000e+00 ; <i1> [#uses=1] - br i1 %tmp36, label %bb39, label %bb47 - -bb39: ; preds = %bb29 - br label %bb47 - -bb47: ; preds = %bb39, %bb29 - ret double undef, double undef - -bb53: ; preds = %entry - ret double undef, double undef -} - -declare i32* @__error() - -declare double @pow(double, double) nounwind readonly - -declare double @cos(double) nounwind readonly diff --git a/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll b/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll deleted file mode 100644 index 9c15efc..0000000 --- a/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll +++ /dev/null @@ -1,30 +0,0 @@ -; RUN: opt < %s -simplifycfg -disable-output -; PR2256 -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128" -target triple = "x86_64-pc-mingw32" - -define { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval %Z, i1 %cond) nounwind { -bb: ; preds = %entry - br i1 %cond, label %bb48, label %bb40 - -bb40: ; preds = %bb - store i32 34, i32* null, align 4 - br label %bb196 - -bb48: ; preds = %bb.bb48_crit_edge, %entry.bb48_crit_edge - %tmp53 = icmp eq i32 0, 1280 ; <i1> [#uses=1] - br i1 %tmp53, label %bb56, label %bb174 - -bb56: ; preds = %bb48 - %iftmp.0.0 = select i1 false, x86_fp80 0xK3FFFC90FDAA22168C235, x86_fp80 0xKBFFFC90FDAA22168C235 ; <x86_fp80> [#uses=0] - br label %bb196 - - -bb174: ; preds = %bb144, %bb114 - %tmp191 = fmul x86_fp80 0xK00000000000000000000, 0xK3FFE8000000000000000 ; <x86_fp80> [#uses=1] - br label %bb196 - -bb196: ; preds = %bb174, %bb56, %bb40 - %Res.1.0 = phi x86_fp80 [ 0xK7FFF8000000000000000, %bb40 ], [ %tmp191, %bb174 ], [ 0xK00000000000000000000, %bb56 ] ; <x86_fp80> [#uses=1] - ret x86_fp80 0xK00000000000000000000, x86_fp80 %Res.1.0 -} diff --git a/test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll b/test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll deleted file mode 100644 index db56fdb..0000000 --- a/test/Transforms/SimplifyCFG/2009-03-05-Speculative-Hoist-Dbg.ll +++ /dev/null @@ -1,108 +0,0 @@ -; RUN: opt < %s -simplifycfg -S | grep select - %llvm.dbg.anchor.type = type { i32, i32 } - %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* } - -@llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" - -@.str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1] -@.str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1] -@.str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1] -@llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] - -declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind - -external global <{ i8 }> ; <<{ i8 }>*>:0 [#uses=0] -@__dso_handle = external global i8* ; <i8**> [#uses=0] -@_ZSt3cin = external global { i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } } ; <{ i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] -@_ZSt4cout = external global { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } } ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] -external constant [2 x i8] ; <[2 x i8]*>:1 [#uses=1] -@llvm.global_ctors = external global [1 x { i32, void ()* }] ; <[1 x { i32, void ()* }]*> [#uses=0] - -define i32 @main(i32, i8**) { -; <label>:2 - %3 = alloca [4096 x i8], align 1 ; <[4096 x i8]*> [#uses=1] - %4 = call { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNKSt9basic_iosIcSt11char_traitsIcEE5rdbufEv({ { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* }* getelementptr ({ i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt3cin, i32 0, i32 2)) ; <{ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*> [#uses=1] - %5 = getelementptr [4096 x i8]* %3, i32 0, i32 0 ; <i8*> [#uses=1] - %6 = call { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNSt15basic_streambufIcSt11char_traitsIcEE9pubsetbufEPci({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* %4, i8* %5, i32 4096) ; <{ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*> [#uses=0] - %7 = call { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNKSt9basic_iosIcSt11char_traitsIcEE5rdbufEv({ { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* }* getelementptr ({ i32 (...)**, i32, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, \3 }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt3cin, i32 0, i32 2)) ; <{ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*> [#uses=1] - br label %25 - -; <label>:8 ; preds = %25 - %9 = trunc i32 %26 to i8 ; <i8> [#uses=4] - %10 = add i32 %.02, 1 ; <i32> [#uses=3] - %11 = icmp eq i8 %9, 10 ; <i1> [#uses=1] - br i1 %11, label %12, label %14 - -; <label>:12 ; preds = %8 - %13 = add i32 %.1, 1 ; <i32> [#uses=1] - br label %14 - -; <label>:14 ; preds = %12, %8 - %.0 = phi i32 [ %.1, %8 ], [ %13, %12 ] ; <i32> [#uses=3] - %15 = icmp eq i8 %9, 32 ; <i1> [#uses=1] - br i1 %15, label %20, label %16 - -; <label>:16 ; preds = %14 - %17 = icmp eq i8 %9, 10 ; <i1> [#uses=1] - br i1 %17, label %20, label %18 - -; <label>:18 ; preds = %16 - %19 = icmp eq i8 %9, 9 ; <i1> [#uses=1] - br i1 %19, label %20, label %21 - -; <label>:20 ; preds = %18, %16, %14 - br label %25 - -; <label>:21 ; preds = %18 - %22 = icmp eq i32 %.03, 0 ; <i1> [#uses=1] - br i1 %22, label %23, label %25 - -; <label>:23 ; preds = %21 - call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) - %24 = add i32 %.01, 1 ; <i32> [#uses=1] - br label %25 - -; <label>:25 ; preds = %23, %21, %20, %2 - %.03 = phi i32 [ 0, %2 ], [ %.03, %21 ], [ 1, %23 ], [ 0, %20 ] ; <i32> [#uses=2] - %.02 = phi i32 [ 0, %2 ], [ %10, %21 ], [ %10, %23 ], [ %10, %20 ] ; <i32> [#uses=2] - %.01 = phi i32 [ 0, %2 ], [ %.01, %21 ], [ %24, %23 ], [ %.01, %20 ] ; <i32> [#uses=4] - %.1 = phi i32 [ 0, %2 ], [ %.0, %21 ], [ %.0, %23 ], [ %.0, %20 ] ; <i32> [#uses=3] - %26 = call i32 @_ZNSt15basic_streambufIcSt11char_traitsIcEE6sbumpcEv({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* %7) ; <i32> [#uses=2] - %27 = icmp eq i32 %26, -1 ; <i1> [#uses=1] - br i1 %27, label %28, label %8 - -; <label>:28 ; preds = %25 - %29 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt4cout, i32 %.1) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] - %30 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %29, i8* getelementptr ([2 x i8]* @1, i32 0, i32 0)) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] - %31 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %30, i32 %.01) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] - %32 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %31, i8* getelementptr ([2 x i8]* @1, i32 0, i32 0)) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] - %33 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %32, i32 %.02) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=1] - %34 = call { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEPFRSoS_E({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* %33, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* ({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*)* @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_) ; <{ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*> [#uses=0] - ret i32 0 -} - -declare void @""() section "__TEXT,__StaticInit,regular,pure_instructions" - -declare fastcc void @""() section "__TEXT,__StaticInit,regular,pure_instructions" - -declare void @_ZNSt8ios_base4InitC1Ev(<{ i8 }>*) - -declare i32 @__cxa_atexit(void (i8*)*, i8*, i8*) nounwind - -declare void @""(i8*) - -declare void @_ZNSt8ios_base4InitD1Ev(<{ i8 }>*) - -declare { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNKSt9basic_iosIcSt11char_traitsIcEE5rdbufEv({ { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* }*) - -declare { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }* @_ZNSt15basic_streambufIcSt11char_traitsIcEE9pubsetbufEPci({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, i8*, i32) - -declare i32 @_ZNSt15basic_streambufIcSt11char_traitsIcEE6sbumpcEv({ i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*) - -declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEi({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i32) - -declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, i8*) - -declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZNSolsEPFRSoS_E({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*, { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* ({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*)*) - -declare { i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }* @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_({ i32 (...)**, { { i32 (...)**, i32, i32, i32, i32, i32, { \2, void (i32, \6*, i32)*, i32, i32 }*, { i8*, i32 }, [8 x { i8*, i32 }], i32, { i8*, i32 }*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }, \3*, i8, i8, { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, { { i32, { i32 (...)**, i32 }**, i32, { i32 (...)**, i32 }**, i8** }* } }*, { { i32 (...)**, i32 }, i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 }*, { { i32 (...)**, i32 } }*, { { i32 (...)**, i32 } }* } }*) diff --git a/test/Transforms/SimplifyCFG/ForwardSwitchConditionToPHI.ll b/test/Transforms/SimplifyCFG/ForwardSwitchConditionToPHI.ll new file mode 100644 index 0000000..1b70c06 --- /dev/null +++ b/test/Transforms/SimplifyCFG/ForwardSwitchConditionToPHI.ll @@ -0,0 +1,36 @@ +; RUN: opt < %s -simplifycfg -S | \ +; RUN: not grep " switch" +; PR10131 + +; ModuleID = '<stdin>' +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32" +target triple = "i386-pc-linux-gnu" + +define i32 @t(i32 %m) nounwind readnone { +entry: + switch i32 %m, label %sw.bb4 [ + i32 0, label %sw.bb0 + i32 1, label %sw.bb1 + i32 2, label %sw.bb2 + i32 3, label %sw.bb3 + ] + +sw.bb0: ; preds = %entry + br label %return + +sw.bb1: ; preds = %entry + br label %return + +sw.bb2: ; preds = %entry + br label %return + +sw.bb3: ; preds = %entry + br label %return + +sw.bb4: ; preds = %entry + br label %return + +return: ; preds = %entry, %sw.bb4, %sw.bb3, %sw.bb2, %sw.bb1 + %retval.0 = phi i32 [ 4, %sw.bb4 ], [ 3, %sw.bb3 ], [ 2, %sw.bb2 ], [ 1, %sw.bb1 ], [ 0, %sw.bb0 ] + ret i32 %retval.0 +} diff --git a/test/Transforms/SimplifyCFG/lifetime.ll b/test/Transforms/SimplifyCFG/lifetime.ll new file mode 100644 index 0000000..b794221 --- /dev/null +++ b/test/Transforms/SimplifyCFG/lifetime.ll @@ -0,0 +1,29 @@ +; RUN: opt < %s -simplifycfg -S | FileCheck %s + +; Test that a lifetime intrinsic doesn't prevent us from simplifying this. + +; CHECK: foo +; CHECK: entry: +; CHECK-NOT: bb0: +; CHECK-NOT: bb1: +; CHECK: ret +define void @foo(i1 %x) { +entry: + %a = alloca i8 + call void @llvm.lifetime.start(i64 -1, i8* %a) nounwind + br i1 %x, label %bb0, label %bb1 + +bb0: + call void @llvm.lifetime.end(i64 -1, i8* %a) nounwind + br label %bb1 + +bb1: + call void @f() + ret void +} + +declare void @f() + +declare void @llvm.lifetime.start(i64, i8* nocapture) nounwind + +declare void @llvm.lifetime.end(i64, i8* nocapture) nounwind diff --git a/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll b/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll index 7d7391a..343e169 100644 --- a/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll +++ b/test/Transforms/SimplifyCFG/switch_switch_fold_dbginfo.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -simplifycfg -S | \ -; RUN: grep switch | count 1 +; RUN: not grep " switch" ; ModuleID = '<stdin>' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" diff --git a/test/Transforms/SimplifyLibCalls/MemCpy.ll b/test/Transforms/SimplifyLibCalls/MemCpy.ll index 39662b1..c711178 100644 --- a/test/Transforms/SimplifyLibCalls/MemCpy.ll +++ b/test/Transforms/SimplifyLibCalls/MemCpy.ll @@ -4,17 +4,16 @@ @hel = constant [4 x i8] c"hel\00" ; <[4 x i8]*> [#uses=1] @hello_u = constant [8 x i8] c"hello_u\00" ; <[8 x i8]*> [#uses=1] -declare void @llvm.memcpy.i32(i8*, i8*, i32, i32) - define i32 @main() { - %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 ; <i8*> [#uses=1] - %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 ; <i8*> [#uses=1] - %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 ; <i8*> [#uses=1] - %target = alloca [1024 x i8] ; <[1024 x i8]*> [#uses=1] - %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 ; <i8*> [#uses=3] - call void @llvm.memcpy.i32( i8* %target_p, i8* %h_p, i32 2, i32 2 ) - call void @llvm.memcpy.i32( i8* %target_p, i8* %hel_p, i32 4, i32 4 ) - call void @llvm.memcpy.i32( i8* %target_p, i8* %hello_u_p, i32 8, i32 8 ) - ret i32 0 + %h_p = getelementptr [2 x i8]* @h, i32 0, i32 0 + %hel_p = getelementptr [4 x i8]* @hel, i32 0, i32 0 + %hello_u_p = getelementptr [8 x i8]* @hello_u, i32 0, i32 0 + %target = alloca [1024 x i8] + %target_p = getelementptr [1024 x i8]* %target, i32 0, i32 0 + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %h_p, i32 2, i32 2, i1 false) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hel_p, i32 4, i32 4, i1 false) + call void @llvm.memcpy.p0i8.p0i8.i32(i8* %target_p, i8* %hello_u_p, i32 8, i32 8, i1 false) + ret i32 0 } +declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind diff --git a/test/Transforms/TailCallElim/inf-recursion.ll b/test/Transforms/TailCallElim/inf-recursion.ll index e4ac928..c427869 100644 --- a/test/Transforms/TailCallElim/inf-recursion.ll +++ b/test/Transforms/TailCallElim/inf-recursion.ll @@ -30,5 +30,4 @@ define float @fabsf(float %f) { ret float %t } -declare float @fabsf(float %f) declare x86_fp80 @fabsl(x86_fp80 %f) |