Chris Lattner | 03ef2fc | 2003-05-29 15:16:10 +0000 | [diff] [blame] | 1 | ; This test ensures that alloca instructions in the entry block for an inlined |
| 2 | ; function are moved to the top of the function they are inlined into. |
| 3 | ; |
Reid Spencer | d0e30dc | 2006-12-02 04:23:10 +0000 | [diff] [blame] | 4 | ; RUN: llvm-upgrade < %s | llvm-as | opt -inline | llvm-dis | %prcontext alloca 1 | grep Entry: |
Chris Lattner | 03ef2fc | 2003-05-29 15:16:10 +0000 | [diff] [blame] | 5 | |
| 6 | int %func(int %i) { |
| 7 | %X = alloca int |
Chris Lattner | 84890d2 | 2006-09-15 16:53:11 +0000 | [diff] [blame] | 8 | store int %i, int* %X |
Chris Lattner | 03ef2fc | 2003-05-29 15:16:10 +0000 | [diff] [blame] | 9 | ret int %i |
| 10 | } |
| 11 | |
| 12 | declare void %bar() |
| 13 | |
| 14 | int %main(int %argc) { |
| 15 | Entry: |
| 16 | call void %bar() |
| 17 | %X = call int %func(int 7) |
| 18 | %Y = add int %X, %argc |
| 19 | ret int %Y |
| 20 | } |