1; RUN: opt < %s -aa-pipeline=globals-aa -passes='require<globals-aa>,gvn' -S | FileCheck %s 2 3@X = internal global i32 4 4 5define i32 @test_cmpxchg(ptr %P) { 6; CHECK-LABEL: @test_cmpxchg 7; CHECK-NEXT: store i32 12, ptr @X 8; CHECK-NEXT: call void @modrefX_cmpxchg() 9; CHECK-NEXT: %V = load i32, ptr @X 10; CHECK-NEXT: ret i32 %V 11 store i32 12, ptr @X 12 call void @modrefX_cmpxchg() 13 %V = load i32, ptr @X 14 ret i32 %V 15} 16 17define void @modrefX_cmpxchg() { 18 %1 = cmpxchg ptr @X, i32 0, i32 -1 monotonic monotonic 19 ret void 20} 21 22define i32 @test_atomicrmw(ptr %P) { 23; CHECK-LABEL: @test_atomicrmw 24; CHECK-NEXT: store i32 12, ptr @X 25; CHECK-NEXT: call void @modrefXatomicrmw() 26; CHECK-NEXT: %V = load i32, ptr @X 27; CHECK-NEXT: ret i32 %V 28 store i32 12, ptr @X 29 call void @modrefXatomicrmw() 30 %V = load i32, ptr @X 31 ret i32 %V 32} 33 34define void @modrefXatomicrmw() { 35 %1 = atomicrmw add ptr @X, i32 1 acquire 36 ret void 37} 38