[llvm] r219150 - LoopUnroll: Change code order of changes to new basic blocks

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Oct 6 15:05:02 PDT 2014


Author: dexonsmith
Date: Mon Oct  6 17:05:02 2014
New Revision: 219150

URL: http://llvm.org/viewvc/llvm-project?rev=219150&view=rev
Log:
LoopUnroll: Change code order of changes to new basic blocks

Add new basic blocks to `LoopInfo` earlier.  No functionality change
intended (simplifies upcoming bugfix patch).

Modified:
    llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp

Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=219150&r1=219149&r2=219150&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Mon Oct  6 17:05:02 2014
@@ -308,6 +308,8 @@ bool llvm::UnrollLoop(Loop *L, unsigned
       BasicBlock *New = CloneBasicBlock(*BB, VMap, "." + Twine(It));
       Header->getParent()->getBasicBlockList().push_back(New);
 
+      L->addBasicBlockToLoop(New, LI->getBase());
+
       if (*BB == Header)
         // Loop over all of the PHI nodes in the block, changing them to use
         // the incoming values from the previous block.
@@ -327,8 +329,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned
            VI != VE; ++VI)
         LastValueMap[VI->first] = VI->second;
 
-      L->addBasicBlockToLoop(New, LI->getBase());
-
       // Add phi entries for newly created values to all exit blocks.
       for (succ_iterator SI = succ_begin(*BB), SE = succ_end(*BB);
            SI != SE; ++SI) {





More information about the llvm-commits mailing list