2008-07-02-array-indexing.ll 731 B

12345678910111213141516171819202122232425
  1. ; RUN: opt < %s -argpromotion -S > %t
  2. ; RUN: cat %t | grep "define.*@callee(.*i32\*"
  3. ; PR2498
  4. ; This test tries to convince argpromotion about promoting the load from %A + 2,
  5. ; because there is a load of %A in the entry block
  6. define internal i32 @callee(i1 %C, i32* %A) {
  7. entry:
  8. ; Unconditonally load the element at %A
  9. %A.0 = load i32, i32* %A
  10. br i1 %C, label %T, label %F
  11. T:
  12. ret i32 %A.0
  13. F:
  14. ; Load the element at offset two from %A. This should not be promoted!
  15. %A.2 = getelementptr i32, i32* %A, i32 2
  16. %R = load i32, i32* %A.2
  17. ret i32 %R
  18. }
  19. define i32 @foo() {
  20. %X = call i32 @callee(i1 false, i32* null) ; <i32> [#uses=1]
  21. ret i32 %X
  22. }