Matthijs Kooijman | 257da0a | 2008-06-05 08:48:32 +0000 | [diff] [blame] | 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. |
Dan Gohman | 3e054fe | 2009-09-08 22:34:10 +0000 | [diff] [blame] | 8 | ; RUN: opt %s -sretpromotion -S | grep sret |
Matthijs Kooijman | 257da0a | 2008-06-05 08:48:32 +0000 | [diff] [blame] | 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 | } |