[llvm] [LLVM][LICM] Skip unrelated accesses when looking for hoist/sink conflicting instructions. (PR #195132)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 02:41:40 PDT 2026


================
@@ -2349,25 +2356,8 @@ static bool noConflictingReadWrites(Instruction *I, MemorySSA *MSSA,
           return false;
         }
         // Any call, while it may not be clobbering I, it may be a use.
-        if (auto *CI = dyn_cast<CallInst>(MD->getMemoryInst())) {
-          // Check if the call may read from the memory location written
-          // to by I. Check CI's attributes and arguments; the number of
-          // such checks performed is limited above by NoOfMemAccTooLarge.
-          if (auto *SI = dyn_cast<StoreInst>(I)) {
-            ModRefInfo MRI = BAA.getModRefInfo(CI, MemoryLocation::get(SI));
-            if (isModOrRefSet(MRI))
-              return false;
-          } else {
-            auto *SCI = cast<CallInst>(I);
-            // If the instruction we are wanting to hoist is also a call
-            // instruction then we need not check mod/ref info with itself
-            if (SCI == CI)
-              continue;
-            ModRefInfo MRI = BAA.getModRefInfo(CI, SCI);
-            if (isModOrRefSet(MRI))
-              return false;
-          }
-        }
+        if (isa<CallInst>(MD->getMemoryInst()))
+          return false;
----------------
nikic wrote:

I don't think this needs the instruction type distinction anymore? Can just always return false.

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


More information about the llvm-commits mailing list