[llvm] [AggressiveInstCombine] Fix crash when folding consecutive loads into a type smaller than the combined load (PR #207229)

Kyungtak Woo via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 8 19:42:13 PDT 2026


================
@@ -1269,6 +1269,22 @@ static bool foldLoadsRecursive(Value *V, LoadOps &LOps, const DataLayout &DL,
   }
   LoadInst *LI2 = dyn_cast<LoadInst>(L2);
 
+  // Reject early if the combined size of the loads exceeds the target type
+  // size. This avoids attempting to emit an invalid ZExt (from wider to
+  // narrower type) when out-of-bounds shifts lead to matching too many loads.
+  if (LI2) {
----------------
kevinwkt wrote:

That works for me. Updated.

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


More information about the llvm-commits mailing list