aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/IPConstantProp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/IPConstantProp')
-rw-r--r--test/Transforms/IPConstantProp/global.ll26
-rw-r--r--test/Transforms/IPConstantProp/return-argument.ll10
-rw-r--r--test/Transforms/IPConstantProp/return-constant.ll4
3 files changed, 39 insertions, 1 deletions
diff --git a/test/Transforms/IPConstantProp/global.ll b/test/Transforms/IPConstantProp/global.ll
new file mode 100644
index 0000000..6715293
--- /dev/null
+++ b/test/Transforms/IPConstantProp/global.ll
@@ -0,0 +1,26 @@
+; RUN: opt < %s -S -ipsccp | FileCheck %s
+
+@_ZL6test1g = internal global i32 42, align 4
+
+define void @_Z7test1f1v() nounwind {
+entry:
+ %tmp = load i32* @_ZL6test1g, align 4
+ %cmp = icmp eq i32 %tmp, 0
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ store i32 0, i32* @_ZL6test1g, align 4
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret void
+}
+
+; CHECK: @_Z7test1f2v()
+; CHECK: entry:
+; CHECK-NEXT: ret i32 42
+define i32 @_Z7test1f2v() nounwind {
+entry:
+ %tmp = load i32* @_ZL6test1g, align 4
+ ret i32 %tmp
+}
diff --git a/test/Transforms/IPConstantProp/return-argument.ll b/test/Transforms/IPConstantProp/return-argument.ll
index 6d6eb24..f4b7018 100644
--- a/test/Transforms/IPConstantProp/return-argument.ll
+++ b/test/Transforms/IPConstantProp/return-argument.ll
@@ -36,14 +36,22 @@ define void @caller(i1 %C) {
;; propagated per-caller).
%S1 = call { i32, i32 } @foo(i32 1, i32 2)
%X1 = extractvalue { i32, i32 } %S1, 0
- %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %RET
+ %S2 = invoke { i32, i32 } @foo(i32 3, i32 4) to label %OK unwind label %LPAD
+
OK:
%X2 = extractvalue { i32, i32 } %S2, 0
;; Do some stuff with the returned values which we can grep for
%Z = add i32 %X1, %X2
store i32 %Z, i32* %W
br label %RET
+
+LPAD:
+ %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ cleanup
+ br label %RET
+
RET:
ret void
}
+declare i32 @__gxx_personality_v0(...)
diff --git a/test/Transforms/IPConstantProp/return-constant.ll b/test/Transforms/IPConstantProp/return-constant.ll
index b255859..ff15df7 100644
--- a/test/Transforms/IPConstantProp/return-constant.ll
+++ b/test/Transforms/IPConstantProp/return-constant.ll
@@ -22,5 +22,9 @@ OK:
%Y = icmp ne i32 %X, 0 ; <i1> [#uses=1]
ret i1 %Y
FAIL:
+ %exn = landingpad {i8*, i32} personality i32 (...)* @__gxx_personality_v0
+ cleanup
ret i1 false
}
+
+declare i32 @__gxx_personality_v0(...)