[PATCH] D115113: [InstCombine] Do not combine atomic and non-atomic loads.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 30 06:59:42 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa2bb7313e62d: [InstCombine] Do not combine atomic and non-atomic loads (authored by rickyz, committed by spatel).

Changed prior to commit:
  https://reviews.llvm.org/D115113?vs=404335&id=404377#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115113/new/

https://reviews.llvm.org/D115113

Files:
  llvm/test/Transforms/InstCombine/phi.ll


Index: llvm/test/Transforms/InstCombine/phi.ll
===================================================================
--- llvm/test/Transforms/InstCombine/phi.ll
+++ llvm/test/Transforms/InstCombine/phi.ll
@@ -547,6 +547,31 @@
   ret i32 %res
 }
 
+; FIXME: Atomic and non-atomic loads should not be combined.
+define i32 @PR51435(i32* %ptr, i32* %atomic_ptr, i1 %c) {
+; CHECK-LABEL: @PR51435(
+; CHECK:       entry:
+; CHECK-NEXT:    br i1 %c, label %if, label %end
+; CHECK:       if:
+; CHECK-NEXT:    [[ATOMIC:%.*]] = load atomic i32, i32* %atomic_ptr acquire, align 4
+; CHECK-NEXT:    br label %end
+; CHECK:       end:
+; CHECK-NEXT:    [[COND_IN:%.*]] = phi i32* [ %ptr, %entry ], [ %atomic_ptr, %if ]
+; CHECK-NEXT:    [[COND:%.*]] = load i32, i32* [[COND_IN]], align 4
+; CHECK-NEXT:    ret i32 [[COND]]
+entry:
+  %x = load i32, i32* %ptr, align 4
+  br i1 %c, label %if, label %end
+
+if:
+  %y = load atomic i32, i32* %atomic_ptr acquire, align 4
+  br label %end
+
+end:
+  %cond = phi i32 [ %x, %entry ], [ %y, %if ]
+  ret i32 %cond
+}
+
 define i1 @test18(i1 %cond) {
 ; CHECK-LABEL: @test18(
 ; CHECK-NEXT:    br i1 [[COND:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115113.404377.patch
Type: text/x-patch
Size: 1186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220130/c1c878d2/attachment-0001.bin>


More information about the llvm-commits mailing list