[llvm] [AggressiveInstCombine] Allow load folding for root inst with multiple uses. (PR #176101)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 16 07:18:15 PST 2026


================
@@ -795,7 +799,7 @@ static bool foldConsecutiveLoads(Instruction &I, const DataLayout &DL,
     return false;
 
   LoadOps LOps;
-  if (!foldLoadsRecursive(&I, LOps, DL, AA) || !LOps.FoundRoot)
+  if (!foldLoadsRecursive(&I, LOps, DL, AA, true) || !LOps.FoundRoot)
----------------
nikic wrote:

```suggestion
  if (!foldLoadsRecursive(&I, LOps, DL, AA, /*IsRoot=*/true) || !LOps.FoundRoot)
```

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


More information about the llvm-commits mailing list