aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/IPConstantProp
diff options
context:
space:
mode:
authorMatthijs Kooijman <matthijs@stdin.nl>2008-06-17 12:02:52 +0000
committerMatthijs Kooijman <matthijs@stdin.nl>2008-06-17 12:02:52 +0000
commit906e423724f9f4409ff8725d0da8ecd09bec23cf (patch)
tree0d58e2bfd400dd1a3bf1c99a492af0044408549b /test/Transforms/IPConstantProp
parent74fc4d968617a1652666bed8aba5e35da86373ce (diff)
downloadexternal_llvm-906e423724f9f4409ff8725d0da8ecd09bec23cf.zip
external_llvm-906e423724f9f4409ff8725d0da8ecd09bec23cf.tar.gz
external_llvm-906e423724f9f4409ff8725d0da8ecd09bec23cf.tar.bz2
Learn IPConstProp to look at individual return values and propagate them
individually. Also learn IPConstProp how returning first class aggregates work, in addition to old style multiple return instructions. Modify the return-constants testscase to confirm this behaviour. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IPConstantProp')
-rw-r--r--test/Transforms/IPConstantProp/return-constants.ll39
1 files changed, 30 insertions, 9 deletions
diff --git a/test/Transforms/IPConstantProp/return-constants.ll b/test/Transforms/IPConstantProp/return-constants.ll
index 40567f8..7205c28 100644
--- a/test/Transforms/IPConstantProp/return-constants.ll
+++ b/test/Transforms/IPConstantProp/return-constants.ll
@@ -1,20 +1,41 @@
-; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis | grep {add i32 21, 21}
+; RUN: llvm-as < %s | opt -ipconstprop | llvm-dis > %t
+;; Check that the 21 constants got propagated properly
+; RUN: cat %t | grep {%M = add i32 21, 21}
+;; 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 %C) {
- br i1 %C, label %T, label %F
+define internal {i32, i32} @foo(i1 %Q) {
+ br i1 %Q, label %T, label %F
T: ; preds = %0
- ret i32 21, i32 21
+ ret i32 21, i32 22
F: ; preds = %0
- ret i32 21, i32 21
+ ret i32 21, i32 23
}
-define i32 @caller(i1 %C) {
- %X = call {i32, i32} @foo( i1 %C )
+define internal {i32, i32} @bar(i1 %Q) {
+ %A = insertvalue { i32, i32 } 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
+
+F: ; preds = %0
+ %C = insertvalue { i32, i32 } %A, i32 23, 1
+ ret { i32, i32 } %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 = add i32 %A, %B
- ret i32 %Y
+ %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
}