[PATCH] D135967: [StructurizeCFG][DebugInfo] Maintain DILocations in the branches created by StructurizeCFG
    Juan Manuel Martinez CaamaƱo via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 18 09:02:06 PDT 2022
    
    
  
jmmartinez added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/StructurizeCFG.cpp:865
   FlowSet.insert(Flow);
+  TermDL[Flow] = TermDL[Dominator];
   DT->addNewBlock(Flow, Dominator);
----------------
arsenm wrote:
> Why can't you just directly set the debug info when the terminator is created?
That was my original approach, however I struggled to make it always work.
For example, in the function `changeExit` when the branch is created and appended to the basic-block, sometimes there is the old terminator that's going to be replaced, but sometims the basic-block is empty (when it's a new flow block created by `getNextFlow`).
In the end, I picked the current strategy since it was the simpler one. 
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135967/new/
https://reviews.llvm.org/D135967
    
    
More information about the llvm-commits
mailing list