2008-06-18 08:09:27 +00:00
|
|
|
; 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}
|
2008-03-11 22:24:29 +00:00
|
|
|
|
2008-06-18 08:09:27 +00:00
|
|
|
define internal {i32, i32} @foo(i1 %Q) {
|
|
|
|
br i1 %Q, label %T, label %F
|
2008-03-11 22:24:29 +00:00
|
|
|
|
|
|
|
T: ; preds = %0
|
2008-06-18 08:09:27 +00:00
|
|
|
ret i32 21, i32 22
|
2008-03-11 22:24:29 +00:00
|
|
|
|
|
|
|
F: ; preds = %0
|
2008-06-18 08:09:27 +00:00
|
|
|
ret i32 21, i32 23
|
2008-03-11 22:24:29 +00:00
|
|
|
}
|
|
|
|
|
2008-06-18 08:09:27 +00:00
|
|
|
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 )
|
2008-03-11 22:24:29 +00:00
|
|
|
%A = getresult {i32, i32} %X, 0
|
|
|
|
%B = getresult {i32, i32} %X, 1
|
2008-06-18 08:09:27 +00:00
|
|
|
%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
|
2008-03-11 22:24:29 +00:00
|
|
|
}
|
|
|
|
|