summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2015-08-18 17:25:48 +0000
committerMichael Kruse <llvm@meinersbur.de>2015-08-18 17:25:48 +0000
commitacb6ade757f6cca1a56df11052e07a16a114296f (patch)
tree31938fef77f920a5ab0876cdaead9db8e1b8fa9a
parenteb7c9be43cfdfd5df0b08cdee9800ec9d4c6d724 (diff)
downloadbcm5719-llvm-acb6ade757f6cca1a56df11052e07a16a114296f.tar.gz
bcm5719-llvm-acb6ade757f6cca1a56df11052e07a16a114296f.zip
Move early exit to the beginning of the function
If the function exits early there is no reason to enter the loop. llvm-svn: 245316
-rw-r--r--polly/lib/CodeGen/BlockGenerators.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/polly/lib/CodeGen/BlockGenerators.cpp b/polly/lib/CodeGen/BlockGenerators.cpp
index 0f488e783f2..82082cbdbe1 100644
--- a/polly/lib/CodeGen/BlockGenerators.cpp
+++ b/polly/lib/CodeGen/BlockGenerators.cpp
@@ -374,6 +374,13 @@ AllocaInst *BlockGenerator::getOrCreateAlloca(Value *ScalarBase,
void BlockGenerator::handleOutsideUsers(const Region &R, Instruction *Inst,
Value *InstCopy) {
+ // If there are escape users we get the alloca for this instruction and put
+ // it in the EscapeMap for later finalization. However, if the alloca was not
+ // created by an already handled scalar dependence we have to initialize it
+ // also. Lastly, if the instruction was copied multiple times we already did
+ // this and can exit.
+ if (EscapeMap.count(Inst))
+ return;
EscapeUserVectorTy EscapeUsers;
for (User *U : Inst->users()) {
@@ -393,14 +400,6 @@ void BlockGenerator::handleOutsideUsers(const Region &R, Instruction *Inst,
if (EscapeUsers.empty())
return;
- // If there are escape users we get the alloca for this instruction and put
- // it in the EscapeMap for later finalization. However, if the alloca was not
- // created by an already handled scalar dependence we have to initialize it
- // also. Lastly, if the instruction was copied multiple times we already did
- // this and can exit.
- if (EscapeMap.count(Inst))
- return;
-
// Get or create an escape alloca for this instruction.
bool IsNew;
AllocaInst *ScalarAddr =
OpenPOWER on IntegriCloud