alloca_test.ll 591 B

1234567891011121314151617181920212223
  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. ;
  4. ; RUN: opt -S -inline < %s | FileCheck %s
  5. define i32 @func(i32 %i) {
  6. %X = alloca i32 ; <i32*> [#uses=1]
  7. store i32 %i, i32* %X
  8. ret i32 %i
  9. }
  10. declare void @bar()
  11. define i32 @main(i32 %argc) {
  12. Entry:
  13. ; CHECK: Entry
  14. ; CHECK-NEXT: alloca
  15. call void @bar( )
  16. %X = call i32 @func( i32 7 ) ; <i32> [#uses=1]
  17. %Y = add i32 %X, %argc ; <i32> [#uses=1]
  18. ret i32 %Y
  19. }