[llvm] [GVN] Permit load PRE to happen in more cases (PR #79324)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 19 10:30:07 PST 2024


================
@@ -1143,34 +1143,100 @@ static void reportMayClobberedLoad(LoadInst *Load, MemDepResult DepInfo,
   ORE->emit(R);
 }
 
+static bool findDominatingValueInBlock(const MemoryLocation &Loc, Type *LoadTy,
+                                       Instruction *From,
+                                       BatchAAResults *BatchAA,
+                                       uint32_t &NumVisitedInsts,
+                                       Value *&FoundVal) {
+  for (auto *Inst = From; Inst != nullptr;
+       Inst = Inst->getPrevNonDebugInstruction()) {
+    // Stop the search if limit is reached.
+    if (++NumVisitedInsts > MaxNumVisitedInsts) {
+      return false;
+    }
+    if (isModSet(BatchAA->getModRefInfo(Inst, Loc))) {
+      return false;
+    }
----------------
paulwalker-arm wrote:

Unnecessary brackets.

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


More information about the llvm-commits mailing list