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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 20 06:26:24 PST 2021


spatel added a comment.

Can we reduce the test to something like this and add it to the file where this transform is tested more generally (llvm/test/Transforms/InstCombine/phi.ll?):

  define i32 @PR51435(i32* %ptr, i32* %atomic_ptr, i1 %c) {
  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
  }



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:663
   // for atomic operations.
-  if (FirstLI->isAtomic())
+  const bool isAtomic = FirstLI->isAtomic();
+  if (isAtomic)
----------------
To conform with current coding standards, this should be "IsAtomic". Fix the existing code as an NFC pre-commit?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D115113



More information about the llvm-commits mailing list