[llvm] [RFC][InstCombine] Combine fence with target specific sync scope (PR #93939)

Sameer Sahasrabuddhe via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 2 22:28:37 PDT 2024


================
@@ -3525,10 +3525,8 @@ Instruction *InstCombinerImpl::visitFenceInst(FenceInst &FI) {
   // Returns true if FI1 is identical or stronger fence than FI2.
   auto isIdenticalOrStrongerFence = [](FenceInst *FI1, FenceInst *FI2) {
     auto FI1SyncScope = FI1->getSyncScopeID();
-    // Consider same scope, where scope is global or single-thread.
-    if (FI1SyncScope != FI2->getSyncScopeID() ||
-        (FI1SyncScope != SyncScope::System &&
-         FI1SyncScope != SyncScope::SingleThread))
+    // Consider same scope, including target specific syncscope.
+    if (FI1SyncScope != FI2->getSyncScopeID())
       return false;
----------------
ssahasra wrote:

I am confident that this is the right thing to do. Definitely works for AMDGPU, and can't see why it would be any different for any other backend.

https://github.com/llvm/llvm-project/pull/93939


More information about the llvm-commits mailing list