summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-05-02 21:57:00 +0000
committerDevang Patel <dpatel@apple.com>2011-05-02 21:57:00 +0000
commitbb35e8ba88680f62778c2868f8e54e5b91264b7a (patch)
tree594af30ba0eeebd973a00578cd5201fe13090312 /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
parentb501b99c6e86575cb0c2c609e85f9324474ecf6d (diff)
downloadbcm5719-llvm-bb35e8ba88680f62778c2868f8e54e5b91264b7a.tar.gz
bcm5719-llvm-bb35e8ba88680f62778c2868f8e54e5b91264b7a.zip
Scanning entire basic block may be too expensive in terms of compile time. Instead, just use whatever location info first non-phi instruction has.
llvm-svn: 130729
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/BasicBlockUtils.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index c705cc51094..92464e8cf13 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -542,11 +542,9 @@ ReturnInst *llvm::FoldReturnIntoUncondBranch(ReturnInst *RI, BasicBlock *BB,
/// 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;
- }
+ if (const Instruction *I = BB->getFirstNonPHI())
+ return I->getDebugLoc();
+ // Scanning entire block may be too expensive, if the first instruction
+ // does not have valid location info.
return DebugLoc();
}
OpenPOWER on IntegriCloud