2017-02-08 16:04:02 +08:00
|
|
|
; RUN: opt < %s -argpromotion -S | FileCheck %s
|
2017-02-10 07:46:27 +08:00
|
|
|
; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
|
2004-11-14 07:28:39 +08:00
|
|
|
|
2017-02-06 16:43:11 +08:00
|
|
|
; Don't promote around control flow.
|
2008-03-01 17:15:35 +08:00
|
|
|
define internal i32 @callee(i1 %C, i32* %P) {
|
2017-02-06 16:43:11 +08:00
|
|
|
; CHECK-LABEL: define internal i32 @callee(
|
|
|
|
; CHECK: i1 %C, i32* %P)
|
|
|
|
entry:
|
|
|
|
br i1 %C, label %T, label %F
|
2004-11-14 07:28:39 +08:00
|
|
|
|
2017-02-06 16:43:11 +08:00
|
|
|
T:
|
|
|
|
ret i32 17
|
2008-03-01 17:15:35 +08:00
|
|
|
|
2017-02-06 16:43:11 +08:00
|
|
|
F:
|
|
|
|
%X = load i32, i32* %P
|
|
|
|
ret i32 %X
|
2004-11-14 07:28:39 +08:00
|
|
|
}
|
|
|
|
|
2008-03-01 17:15:35 +08:00
|
|
|
define i32 @foo() {
|
2017-02-06 16:43:11 +08:00
|
|
|
; CHECK-LABEL: define i32 @foo(
|
|
|
|
entry:
|
|
|
|
; CHECK-NOT: load i32, i32* null
|
|
|
|
%X = call i32 @callee(i1 true, i32* null)
|
|
|
|
; CHECK: call i32 @callee(i1 true, i32* null)
|
|
|
|
ret i32 %X
|
2004-11-14 07:28:39 +08:00
|
|
|
}
|
|
|
|
|