[llvm-commits] [llvm] r130729 - /llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
Devang Patel
dpatel at apple.com
Mon May 2 14:57:00 PDT 2011
Author: dpatel
Date: Mon May 2 16:57:00 2011
New Revision: 130729
URL: http://llvm.org/viewvc/llvm-project?rev=130729&view=rev
Log:
Scanning entire basic block may be too expensive in terms of compile time. Instead, just use whatever location info first non-phi instruction has.
Modified:
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=130729&r1=130728&r2=130729&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Mon May 2 16:57:00 2011
@@ -542,11 +542,9 @@
/// 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();
}
More information about the llvm-commits
mailing list