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

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 01:43:31 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());
----------------
SLTozer wrote:

The llvm-test-suite that @OCHyams is referencing isn't the test suite within LLVM (the confusion is understandable of course!), but the [LLVM test suite repo](https://github.com/llvm/llvm-test-suite), which contains a variety of real program selected to test LLVM; it contains a decent spread of programs (so likely to stimulate more code in LLVM) and is faster to build than a stage 2 clang build; there are instructions on how to use it [here](https://llvm.org/docs/TestSuiteGuide.html).

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


More information about the llvm-commits mailing list