blob: c3fe0c00e877259ac4bcaa5b21a28c5749ef06a5 [file] [log] [blame]
Chandler Carruth102fa922017-02-08 08:04:02 +00001; RUN: opt < %s -argpromotion -S | FileCheck %s
Chandler Carruthaddcda42017-02-09 23:46:27 +00002; RUN: opt < %s -passes=argpromotion -S | FileCheck %s
Chris Lattner70496c12004-11-13 23:28:39 +00003
Chandler Carruth044d1e02017-02-06 08:43:11 +00004; Don't promote around control flow.
Tanya Lattner5640bd12008-03-01 09:15:35 +00005define internal i32 @callee(i1 %C, i32* %P) {
Chandler Carruth044d1e02017-02-06 08:43:11 +00006; CHECK-LABEL: define internal i32 @callee(
7; CHECK: i1 %C, i32* %P)
8entry:
9 br i1 %C, label %T, label %F
Chris Lattner70496c12004-11-13 23:28:39 +000010
Chandler Carruth044d1e02017-02-06 08:43:11 +000011T:
12 ret i32 17
Tanya Lattner5640bd12008-03-01 09:15:35 +000013
Chandler Carruth044d1e02017-02-06 08:43:11 +000014F:
15 %X = load i32, i32* %P
16 ret i32 %X
Chris Lattner70496c12004-11-13 23:28:39 +000017}
18
Tanya Lattner5640bd12008-03-01 09:15:35 +000019define i32 @foo() {
Chandler Carruth044d1e02017-02-06 08:43:11 +000020; CHECK-LABEL: define i32 @foo(
21entry:
22; CHECK-NOT: load i32, i32* null
23 %X = call i32 @callee(i1 true, i32* null)
24; CHECK: call i32 @callee(i1 true, i32* null)
25 ret i32 %X
Chris Lattner70496c12004-11-13 23:28:39 +000026}
27