summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-06-19 17:23:29 +0000
committerSanjay Patel <spatel@rotateright.com>2019-06-19 17:23:29 +0000
commit3e03bf6921345afa1699fa3951a51a7ef3d22bff (patch)
treec4f83cb44906ff1eb2299db57f91bac919ecca64
parent34279db3556c74ee7b11a3b095cd700217320a61 (diff)
downloadbcm5719-llvm-3e03bf6921345afa1699fa3951a51a7ef3d22bff.tar.gz
bcm5719-llvm-3e03bf6921345afa1699fa3951a51a7ef3d22bff.zip
[InstSimplify] add a phi test with 1 incoming value; NFC
D63489 proposes to change this behavior, but there's no direct -instsimplify test to verify that the transform exists. llvm-svn: 363842
-rw-r--r--llvm/test/Transforms/InstSimplify/phi.ll34
1 files changed, 32 insertions, 2 deletions
diff --git a/llvm/test/Transforms/InstSimplify/phi.ll b/llvm/test/Transforms/InstSimplify/phi.ll
index b0040ffeb03..242b7ab87bf 100644
--- a/llvm/test/Transforms/InstSimplify/phi.ll
+++ b/llvm/test/Transforms/InstSimplify/phi.ll
@@ -1,10 +1,21 @@
-; NOTE: Assertions have been autogenerated by update_test_checks.py
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -instsimplify -S | FileCheck %s
; PR12189
define i1 @test1(i32 %x) {
; CHECK-LABEL: @test1(
-; CHECK: ret i1 %e
+; CHECK-NEXT: br i1 true, label [[A:%.*]], label [[B:%.*]]
+; CHECK: a:
+; CHECK-NEXT: [[AA:%.*]] = or i32 [[X:%.*]], 10
+; CHECK-NEXT: br label [[C:%.*]]
+; CHECK: b:
+; CHECK-NEXT: [[BB:%.*]] = or i32 [[X]], 10
+; CHECK-NEXT: br label [[C]]
+; CHECK: c:
+; CHECK-NEXT: [[CC:%.*]] = phi i32 [ [[BB]], [[B]] ], [ [[AA]], [[A]] ]
+; CHECK-NEXT: [[D:%.*]] = urem i32 [[CC]], 2
+; CHECK-NEXT: [[E:%.*]] = icmp eq i32 [[D]], 0
+; CHECK-NEXT: ret i1 [[E]]
;
br i1 true, label %a, label %b
@@ -22,3 +33,22 @@ c:
%e = icmp eq i32 %d, 0
ret i1 %e
}
+
+; D63489 - https://reviews.llvm.org/D63489
+; If this single-value phi form needs to be preserved to enable
+; further analysis, then -instsimplify should not be running?
+
+define i32 @lcssa-phi(i32 %x) {
+; CHECK-LABEL: @lcssa-phi(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[END:%.*]]
+; CHECK: end:
+; CHECK-NEXT: ret i32 [[X:%.*]]
+;
+entry:
+ br label %end
+
+end:
+ %counter.lcssa = phi i32 [ %x, %entry ]
+ ret i32 %counter.lcssa
+}
OpenPOWER on IntegriCloud