blob: 21701dd84be63178b6ef8cc76946a9356e03d107 [file] [log] [blame]
Matthijs Kooijman257da0a2008-06-05 08:48:32 +00001; This test lures sretpromotion into promoting the sret argument of foo, even
2; when the function is used as an argument to bar. It used to not check for
3; this, assuming that all users of foo were direct calls, resulting in an
4; assertion failure later on.
5
6; We're mainly testing for opt not to crash, but we'll check to see if the sret
7; attribute is still there for good measure.
8; RUN: llvm-as < %s | opt -sretpromotion | llvm-dis | grep sret
9
10%struct.S = type <{ i32, i32 }>
11
12define i32 @main() {
13entry:
14 %tmp = alloca %struct.S ; <%struct.S*> [#uses=1]
15 call void @bar( %struct.S* sret %tmp, void (%struct.S*, ...)* @foo )
16 ret i32 undef
17}
18
19declare void @bar(%struct.S* sret , void (%struct.S*, ...)*)
20
21define internal void @foo(%struct.S* sret %agg.result, ...) {
22entry:
23 ret void
24}