[llvm] [LICM] Hoisting writeonly calls (PR #143799)

Tim Gymnich via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 01:47:26 PDT 2025


================
@@ -2354,6 +2315,75 @@ collectPromotionCandidates(MemorySSA *MSSA, AliasAnalysis *AA, Loop *L) {
   return Result;
 }
 
+// For a given store instruction or writeonly call instruction, this function
+// checks that there are no read or writes that conflict with the memory
+// access in the instruction
+static bool noConflictingReadWrites(Instruction *I, MemorySSA *MSSA,
+                                    AAResults *AA, Loop *CurLoop,
+                                    SinkAndHoistLICMFlags &Flags) {
+  assert(isa<CallInst>(*I) || isa<StoreInst>(*I));
+  // If there are more accesses than the Promotion cap, then give up as we're
+  // not walking a list that long.
+  if (Flags.tooManyMemoryAccesses()) {
+    return false;
+  }
----------------
tgymnich wrote:

```suggestion
  if (Flags.tooManyMemoryAccesses())
    return false;
```

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


More information about the llvm-commits mailing list