atomic-load-store.ll 668 B

123456789101112131415161718192021222324252627282930
  1. ; RUN: opt < %s -ipsccp -S | FileCheck %s
  2. ; This transformation is safe for atomic loads and stores; check that it works.
  3. @G = internal global i32 17
  4. @C = internal constant i32 222
  5. define i32 @test1() {
  6. %V = load atomic i32, i32* @G seq_cst, align 4
  7. %C = icmp eq i32 %V, 17
  8. br i1 %C, label %T, label %F
  9. T:
  10. store atomic i32 17, i32* @G seq_cst, align 4
  11. ret i32 %V
  12. F:
  13. store atomic i32 123, i32* @G seq_cst, align 4
  14. ret i32 0
  15. }
  16. ; CHECK-LABEL: define i32 @test1(
  17. ; CHECK-NOT: store
  18. ; CHECK: ret i32 17
  19. define i32 @test2() {
  20. %V = load atomic i32, i32* @C seq_cst, align 4
  21. ret i32 %V
  22. }
  23. ; CHECK-LABEL: define i32 @test2(
  24. ; CHECK-NOT: load
  25. ; CHECK: ret i32 222