Fix PR6673: updating the callback should not clear the map.
[oota-llvm.git] / test / Transforms / SRETPromotion / 2008-06-04-function-pointer-passing.ll
1 ; 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: opt < %s -sretpromotion -S | grep sret
9
10 %struct.S = type <{ i32, i32 }>
11
12 define i32 @main() {
13 entry:
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
19 declare void @bar(%struct.S* sret , void (%struct.S*, ...)*)
20
21 define internal void @foo(%struct.S* sret  %agg.result, ...) {
22 entry:
23         ret void
24 }