fca.ll 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ; RUN: opt < %s -sroa -S | FileCheck %s
  2. ; RUN: opt < %s -sroa -force-ssa-updater -S | FileCheck %s
  3. target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-n8:16:32:64"
  4. define { i32, i32 } @test0(i32 %x, i32 %y) {
  5. ; CHECK-LABEL: @test0(
  6. ; CHECK-NOT: alloca
  7. ; CHECK: insertvalue { i32, i32 }
  8. ; CHECK: insertvalue { i32, i32 }
  9. ; CHECK: ret { i32, i32 }
  10. entry:
  11. %a = alloca { i32, i32 }
  12. store { i32, i32 } undef, { i32, i32 }* %a
  13. %gep1 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %a, i32 0, i32 0
  14. store i32 %x, i32* %gep1
  15. %gep2 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %a, i32 0, i32 1
  16. store i32 %y, i32* %gep2
  17. %result = load { i32, i32 }, { i32, i32 }* %a
  18. ret { i32, i32 } %result
  19. }
  20. define { i32, i32 } @test1(i32 %x, i32 %y) {
  21. ; FIXME: This may be too conservative. Duncan argues that we are allowed to
  22. ; split the volatile load and store here but must produce volatile scalar loads
  23. ; and stores from them.
  24. ; CHECK-LABEL: @test1(
  25. ; CHECK: alloca
  26. ; CHECK: alloca
  27. ; CHECK: load volatile { i32, i32 }, { i32, i32 }*
  28. ; CHECK: store volatile { i32, i32 }
  29. ; CHECK: ret { i32, i32 }
  30. entry:
  31. %a = alloca { i32, i32 }
  32. %b = alloca { i32, i32 }
  33. %gep1 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %a, i32 0, i32 0
  34. store i32 %x, i32* %gep1
  35. %gep2 = getelementptr inbounds { i32, i32 }, { i32, i32 }* %a, i32 0, i32 1
  36. store i32 %y, i32* %gep2
  37. %result = load volatile { i32, i32 }, { i32, i32 }* %a
  38. store volatile { i32, i32 } %result, { i32, i32 }* %b
  39. ret { i32, i32 } %result
  40. }