[llvm] [AggressiveInstCombine] Ignore debug instructions when load combining (PR #70200)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 06:11:37 PDT 2023


================
@@ -701,12 +701,21 @@ static bool foldLoadsRecursive(Value *V, LoadOps &LOps, const DataLayout &DL,
       Loc = Loc.getWithNewSize(LOps.LoadSize);
   } else
     Loc = MemoryLocation::get(End);
+
+  // Ignore debug info (and other "AssumeLike" intrinsics) so that's not counted
+  // against MaxInstrsToScan. Otherwise debug info could affect codegen.
+  auto IsAssumeLikeIntr = [](const Instruction &I) {
+    if (auto *II = dyn_cast<IntrinsicInst>(&I))
+      return II->isAssumeLikeIntrinsic();
----------------
mikaelholmen wrote:

> Please check for DbgInfoIntrinsic only.

Sure, I can do that. The reason I went for isAssumeLike is that on a previous similar fix I made in SLPVectorizer, I initially just looked for Dbg intrinsics but then got comments I should look for isAssumeLike.

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


More information about the llvm-commits mailing list