summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LexicalScopes.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-08-12 18:01:34 +0000
committerDevang Patel <dpatel@apple.com>2011-08-12 18:01:34 +0000
commit2e85b1bfa7412577dd61f21ea10a686d3685144b (patch)
treefca4a383b6de6b905e32aa837b310c53f61f3237 /lib/CodeGen/LexicalScopes.cpp
parent3f3570a38be37ca18c545bd1b4c89604ecaf7e31 (diff)
downloadllvm-2e85b1bfa7412577dd61f21ea10a686d3685144b.tar.gz
llvm-2e85b1bfa7412577dd61f21ea10a686d3685144b.tar.bz2
llvm-2e85b1bfa7412577dd61f21ea10a686d3685144b.tar.xz
Provide fast path as Jakob suggested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137478 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LexicalScopes.cpp')
-rw-r--r--lib/CodeGen/LexicalScopes.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/CodeGen/LexicalScopes.cpp b/lib/CodeGen/LexicalScopes.cpp
index 676328446f..ae06a40703 100644
--- a/lib/CodeGen/LexicalScopes.cpp
+++ b/lib/CodeGen/LexicalScopes.cpp
@@ -256,6 +256,13 @@ getMachineBasicBlocks(DebugLoc DL,
if (!Scope)
return;
+ if (Scope == CurrentFnLexicalScope) {
+ for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
+ I != E; ++I)
+ MBBs.insert(I);
+ return;
+ }
+
SmallVector<InsnRange, 4> &InsnRanges = Scope->getRanges();
for (SmallVector<InsnRange, 4>::iterator I = InsnRanges.begin(),
E = InsnRanges.end(); I != E; ++I) {
@@ -270,6 +277,11 @@ bool LexicalScopes::dominates(DebugLoc DL, MachineBasicBlock *MBB) {
LexicalScope *Scope = getOrCreateLexicalScope(DL);
if (!Scope)
return false;
+
+ // Current function scope covers all basic blocks in the function.
+ if (Scope == CurrentFnLexicalScope && MBB->getParent() == MF)
+ return true;
+
bool Result = false;
for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end();
I != E; ++I) {