diff options
author | Duncan Sands <baldrick@free.fr> | 2010-11-23 20:26:33 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-11-23 20:26:33 +0000 |
commit | 433c1679cf6b3daec4ec5731bfc83e7e8f596248 (patch) | |
tree | a7da5df1d460af0ae0ae63f0972575f6d2870fab /llvm/lib/Transforms/Utils/LoopUnroll.cpp | |
parent | 46cc61ea7cd79ce350fdf1cae10a3c604a9f3de0 (diff) | |
download | bcm5719-llvm-433c1679cf6b3daec4ec5731bfc83e7e8f596248.tar.gz bcm5719-llvm-433c1679cf6b3daec4ec5731bfc83e7e8f596248.zip |
Replace calls to ConstantFoldInstruction with calls to SimplifyInstruction
in two places that are really interested in simplified instructions, not
constants.
llvm-svn: 120044
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnroll.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnroll.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index e23cdc92b50..9af0be904e2 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -22,7 +22,7 @@ #include "llvm/Transforms/Utils/UnrollLoop.h" #include "llvm/BasicBlock.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Analysis/ConstantFolding.h" +#include "llvm/Analysis/InstructionSimplify.h" #include "llvm/Analysis/LoopPass.h" #include "llvm/Analysis/ScalarEvolution.h" #include "llvm/Support/Debug.h" @@ -361,10 +361,11 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, LoopInfo* LI, LPPassManager* LPM) if (isInstructionTriviallyDead(Inst)) (*BB)->getInstList().erase(Inst); - else if (Constant *C = ConstantFoldInstruction(Inst)) { - Inst->replaceAllUsesWith(C); - (*BB)->getInstList().erase(Inst); - } + else if (Value *V = SimplifyInstruction(Inst)) + if (LI->replacementPreservesLCSSAForm(Inst, V)) { + Inst->replaceAllUsesWith(V); + (*BB)->getInstList().erase(Inst); + } } NumCompletelyUnrolled += CompletelyUnroll; |