diff options
author | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
commit | ebe69fe11e48d322045d5949c83283927a0d790b (patch) | |
tree | c92f1907a6b8006628a4b01615f38264d29834ea /test/Transforms/JumpThreading | |
parent | b7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff) | |
download | external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2 |
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'test/Transforms/JumpThreading')
-rw-r--r-- | test/Transforms/JumpThreading/conservative-lvi.ll | 58 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/phi-eq.ll | 2 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/pr22086.ll | 28 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/thread-loads.ll | 8 |
4 files changed, 91 insertions, 5 deletions
diff --git a/test/Transforms/JumpThreading/conservative-lvi.ll b/test/Transforms/JumpThreading/conservative-lvi.ll new file mode 100644 index 0000000..1ea8cdc --- /dev/null +++ b/test/Transforms/JumpThreading/conservative-lvi.ll @@ -0,0 +1,58 @@ +; RUN: opt -jump-threading -S %s | FileCheck %s + +; Check that we thread arg2neg -> checkpos -> end. +; +; LazyValueInfo would previously fail to analyze the value of %arg in arg2neg +; because its predecessing blocks (checkneg) hadn't been processed yet (PR21238) + +; CHECK-LABEL: @test_jump_threading +; CHECK: arg2neg: +; CHECK-NEXT: br i1 %arg1, label %end, label %checkpos.thread +; CHECK: checkpos.thread: +; CHECK-NEXT: br label %end + +define i32 @test_jump_threading(i1 %arg1, i32 %arg2) { +checkneg: + %cmp = icmp slt i32 %arg2, 0 + br i1 %cmp, label %arg2neg, label %checkpos + +arg2neg: + br i1 %arg1, label %end, label %checkpos + +checkpos: + %cmp2 = icmp sgt i32 %arg2, 0 + br i1 %cmp2, label %arg2pos, label %end + +arg2pos: + br label %end + +end: + %0 = phi i32 [ 1, %arg2neg ], [ 2, %checkpos ], [ 3, %arg2pos ] + ret i32 %0 +} + + +; arg2neg has an edge back to itself. If LazyValueInfo is not careful when +; visiting predecessors, it could get into an infinite loop. + +; CHECK-LABEL: test_infinite_loop + +define i32 @test_infinite_loop(i1 %arg1, i32 %arg2) { +checkneg: + %cmp = icmp slt i32 %arg2, 0 + br i1 %cmp, label %arg2neg, label %checkpos + +arg2neg: + br i1 %arg1, label %arg2neg, label %checkpos + +checkpos: + %cmp2 = icmp sgt i32 %arg2, 0 + br i1 %cmp2, label %arg2pos, label %end + +arg2pos: + br label %end + +end: + %0 = phi i32 [ 2, %checkpos ], [ 3, %arg2pos ] + ret i32 %0 +} diff --git a/test/Transforms/JumpThreading/phi-eq.ll b/test/Transforms/JumpThreading/phi-eq.ll index e05d5ee..3dd2c36 100644 --- a/test/Transforms/JumpThreading/phi-eq.ll +++ b/test/Transforms/JumpThreading/phi-eq.ll @@ -101,7 +101,7 @@ get_filter_list.exit6: ; preds = %sw.bb3.i4, %sw.bb2. %2 = load %struct._GList** %1, align 8 ; We should have jump-threading insert an additional load here for the value ; coming out of the first switch, which is picked up by a subsequent phi -; CHECK: {{%\.pr = load %[^%]* %0}} +; CHECK: %.pr = load %struct._GList** %0 ; CHECK-NEXT: br label %while.cond br label %while.cond diff --git a/test/Transforms/JumpThreading/pr22086.ll b/test/Transforms/JumpThreading/pr22086.ll new file mode 100644 index 0000000..35d9aa5 --- /dev/null +++ b/test/Transforms/JumpThreading/pr22086.ll @@ -0,0 +1,28 @@ +; RUN: opt -S -jump-threading < %s | FileCheck %s + + +; CHECK-LABEL: @f( +; CHECK-LABEL: entry: +; CHECK-NEXT: br label %[[loop:.*]] +; CHECK: [[loop]]: +; CHECK-NEXT: br label %[[loop]] + +define void @f() { +entry: + br label %for.cond1 + +if.end16: + %phi1 = phi i32 [ undef, %for.cond1 ] + %g.3 = phi i32 [ %g.1, %for.cond1 ] + %sext = shl i32 %g.3, 16 + %conv20 = ashr exact i32 %sext, 16 + %tobool21 = icmp eq i32 %phi1, 0 + br i1 %tobool21, label %lor.rhs, label %for.cond1 + +for.cond1: + %g.1 = phi i32 [ 0, %entry ], [ 0, %lor.rhs ], [ %g.3, %if.end16 ] + br i1 undef, label %lor.rhs, label %if.end16 + +lor.rhs: + br label %for.cond1 +} diff --git a/test/Transforms/JumpThreading/thread-loads.ll b/test/Transforms/JumpThreading/thread-loads.ll index b13b767..4351f99 100644 --- a/test/Transforms/JumpThreading/thread-loads.ll +++ b/test/Transforms/JumpThreading/thread-loads.ll @@ -106,7 +106,7 @@ return: ret i32 13 } -!0 = metadata !{metadata !3, metadata !3, i64 0} -!1 = metadata !{metadata !"omnipotent char", metadata !2} -!2 = metadata !{metadata !"Simple C/C++ TBAA", null} -!3 = metadata !{metadata !"int", metadata !1} +!0 = !{!3, !3, i64 0} +!1 = !{!"omnipotent char", !2} +!2 = !{!"Simple C/C++ TBAA", null} +!3 = !{!"int", !1} |