summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SCCP
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/SCCP')
-rw-r--r--llvm/test/Transforms/SCCP/ipsccp-predicated.ll68
1 files changed, 68 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SCCP/ipsccp-predicated.ll b/llvm/test/Transforms/SCCP/ipsccp-predicated.ll
new file mode 100644
index 00000000000..531fbba8f70
--- /dev/null
+++ b/llvm/test/Transforms/SCCP/ipsccp-predicated.ll
@@ -0,0 +1,68 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -ipsccp -S | FileCheck %s
+
+define i32 @test1(i32 %v) {
+; CHECK-LABEL: @test1(
+; CHECK-NEXT: Entry:
+; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[V:%.*]], 10
+; CHECK-NEXT: br i1 [[TOBOOL1]], label [[T:%.*]], label [[F:%.*]]
+; CHECK: T:
+; CHECK-NEXT: [[R:%.*]] = call i32 @callee(i32 20)
+; CHECK-NEXT: ret i32 [[R]]
+; CHECK: F:
+; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i32 [[V]])
+; CHECK-NEXT: ret i32 [[X]]
+;
+Entry:
+ %tobool1 = icmp eq i32 %v, 10
+ br i1 %tobool1, label %T, label %F
+
+T:
+ %a = add i32 %v, 10
+ %r = call i32 @callee(i32 %a)
+ ret i32 %r
+
+F:
+ %x = call i32 @callee(i32 %v)
+ ret i32 %x
+}
+
+
+define internal i32 @test2(i32 %v, i32 %c) {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT: Entry:
+; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[V:%.*]], 99
+; CHECK-NEXT: br i1 [[TOBOOL1]], label [[T:%.*]], label [[F:%.*]]
+; CHECK: T:
+; CHECK-NEXT: [[R:%.*]] = call i32 @callee(i32 109)
+; CHECK-NEXT: ret i32 [[R]]
+; CHECK: F:
+; CHECK-NEXT: [[X:%.*]] = call i32 @callee(i32 [[V]])
+; CHECK-NEXT: ret i32 [[X]]
+;
+Entry:
+ %tobool1 = icmp eq i32 %v, %c
+ br i1 %tobool1, label %T, label %F
+
+T:
+ %a = add i32 %v, 10
+ %r = call i32 @callee(i32 %a)
+ ret i32 %r
+
+F:
+ %x = call i32 @callee(i32 %v)
+ ret i32 %x
+}
+
+define i32 @caller_test2(i32 %v) {
+; CHECK-LABEL: @caller_test2(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[R:%.*]] = call i32 @test2(i32 [[V:%.*]], i32 99)
+; CHECK-NEXT: ret i32 [[R]]
+;
+entry:
+ %r = call i32 @test2(i32 %v, i32 99)
+ ret i32 %r
+}
+
+declare i32 @callee(i32)
OpenPOWER on IntegriCloud