[llvm] [DebugInfo][JumpThreading] Fix missing debug location updates (PR #91581)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 06:10:42 PDT 2024


================
@@ -1278,9 +1278,12 @@ bool JumpThreadingPass::simplifyPartiallyRedundantLoad(LoadInst *LoadI) {
     // only happen in dead loops.
     if (AvailableVal == LoadI)
       AvailableVal = PoisonValue::get(LoadI->getType());
-    if (AvailableVal->getType() != LoadI->getType())
+    if (AvailableVal->getType() != LoadI->getType()) {
       AvailableVal = CastInst::CreateBitOrPointerCast(
           AvailableVal, LoadI->getType(), "", LoadI->getIterator());
+      if (Instruction *CI = dyn_cast<Instruction>(AvailableVal))
+        CI->setDebugLoc(LoadI->getDebugLoc());
----------------
OCHyams wrote:

re: generating a test for this part, if you stick an `assert(false)` in here and run the build target `check-llvm` do we get any test failures?

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


More information about the llvm-commits mailing list