[PATCH] D100371: [debug-info] SCCP should preserve the debug location for an one-to-one instruction replacement

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 14 06:44:43 PDT 2021


djtodoro added a comment.

I think one more place can be improved (I am using https://llvm.org/docs/HowToUpdateDebugInfo.html#test-original-debug-info-preservation-in-optimizations):

  diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
  index 86705b8622a3..3ac195a5c01a 100644
  --- a/llvm/lib/Transforms/Scalar/SCCP.cpp
  +++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
  @@ -1903,7 +1903,8 @@ static bool removeNonFeasibleEdges(const SCCPSolver &Solver, BasicBlock *BB,
         Updates.push_back({DominatorTree::Delete, BB, Succ});
       }
  
  -    BranchInst::Create(OnlyFeasibleSuccessor, BB);
  +    auto BranchInst = BranchInst::Create(OnlyFeasibleSuccessor, BB);
  +    BranchInst->setDebugLoc(TI->getDebugLoc());
       TI->eraseFromParent();
       DTU.applyUpdatesPermissive(Updates);
     } else if (FeasibleSuccessors.size() > 1) {


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100371/new/

https://reviews.llvm.org/D100371



More information about the llvm-commits mailing list