[llvm-commits] [llvm] r130551 - in /llvm/trunk: include/llvm/Transforms/Utils/BasicBlockUtils.h lib/Transforms/Utils/BasicBlockUtils.cpp lib/Transforms/Utils/SSAUpdater.cpp

Duncan Sands baldrick at free.fr
Sat Apr 30 05:23:54 PDT 2011


Hi Devang,

> +/// GetFirstDebugLocInBasicBlock - Return first valid DebugLoc entry in a
> +/// given basic block.
> +DebugLoc llvm::GetFirstDebugLocInBasicBlock(const BasicBlock *BB) {
> +  for (BasicBlock::const_iterator BI = BB->begin(), BE = BB->end();
> +       BI != BE; ++BI) {
> +    DebugLoc DL = BI->getDebugLoc();
> +    if (!DL.isUnknown())
> +      return DL;
> +  }
> +  return DebugLoc();
> +}

this potentially scans through the entire basic block which might be expensive
if it is big.  Also, it's not clear to me that this makes any sense.  Suppose
the first instructions in the basic block have no line number info.  Why should
the phi node get the same line number as some random instruction deep down in
the basic block?  How about just giving the phi node the same line info as the
first instruction in the basic block?  If it doesn't have any then too bad.

Ciao, Duncan.



More information about the llvm-commits mailing list