diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-08-16 21:09:46 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-08-16 21:09:46 +0000 |
commit | 110522bc0fe8e6d4a8f9baaea4f58f1cb827d92d (patch) | |
tree | 7038bc060f19f3aebce2d272797a97bfce00988e /llvm/lib/Transforms/Utils/LoopUnroll.cpp | |
parent | b99b709068ab351e6ee7630137b6bac6313f76c8 (diff) | |
download | llvm-110522bc0fe8e6d4a8f9baaea4f58f1cb827d92d.zip llvm-110522bc0fe8e6d4a8f9baaea4f58f1cb827d92d.tar.gz llvm-110522bc0fe8e6d4a8f9baaea4f58f1cb827d92d.tar.bz2 |
[LoopUnroll] Don't clear out the AssumptionCache on each loop
Clearing out the AssumptionCache can cause us to rescan the entire
function for assumes. If there are many loops, then we are scanning
over the entire function many times.
Instead of clearing out the AssumptionCache, register all cloned
assumes.
llvm-svn: 278854
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnroll.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnroll.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index df785bd..4913c78 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -28,6 +28,7 @@ #include "llvm/IR/BasicBlock.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/Dominators.h" +#include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/LLVMContext.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -486,9 +487,14 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, bool Force, } // Remap all instructions in the most recent iteration - for (BasicBlock *NewBlock : NewBlocks) - for (Instruction &I : *NewBlock) + for (BasicBlock *NewBlock : NewBlocks) { + for (Instruction &I : *NewBlock) { ::remapInstruction(&I, LastValueMap); + if (auto *II = dyn_cast<IntrinsicInst>(&I)) + if (II->getIntrinsicID() == Intrinsic::assume) + AC->registerAssumption(II); + } + } } // Loop over the PHI nodes in the original block, setting incoming values. @@ -601,10 +607,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount, bool Force, } } - // FIXME: We could register any cloned assumptions instead of clearing the - // whole function's cache. - AC->clear(); - // FIXME: We only preserve DT info for complete unrolling now. Incrementally // updating domtree after partial loop unrolling should also be easy. if (DT && !CompletelyUnroll) |