[polly] r245316 - Move early exit to the beginning of the function

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 10:25:49 PDT 2015


Author: meinersbur
Date: Tue Aug 18 12:25:48 2015
New Revision: 245316

URL: http://llvm.org/viewvc/llvm-project?rev=245316&view=rev
Log:
Move early exit to the beginning of the function

If the function exits early there is no reason to enter the loop.


Modified:
    polly/trunk/lib/CodeGen/BlockGenerators.cpp

Modified: polly/trunk/lib/CodeGen/BlockGenerators.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/BlockGenerators.cpp?rev=245316&r1=245315&r2=245316&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/BlockGenerators.cpp (original)
+++ polly/trunk/lib/CodeGen/BlockGenerators.cpp Tue Aug 18 12:25:48 2015
@@ -374,6 +374,13 @@ AllocaInst *BlockGenerator::getOrCreateA
 
 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(
   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 =




More information about the llvm-commits mailing list