diff options
author | Andrew Trick <atrick@apple.com> | 2014-01-07 01:50:58 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2014-01-07 01:50:58 +0000 |
commit | 3c0ed08996d8347fd18a8fe78caf1aac74c44379 (patch) | |
tree | 4f6f9359665a741b4dd3622bae2f026384d8d4af /llvm/lib | |
parent | 0458b599f85801782bfd0a9b5e35baf35ee87a70 (diff) | |
download | bcm5719-llvm-3c0ed08996d8347fd18a8fe78caf1aac74c44379.tar.gz bcm5719-llvm-3c0ed08996d8347fd18a8fe78caf1aac74c44379.zip |
Revert "indvars: sink truncates outside the loop."
This reverts commit r198654.
One of the bots reported a SciMark failure.
llvm-svn: 198659
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index 08df9533f16..1076e50bc28 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -883,8 +883,6 @@ const SCEVAddRecExpr *WidenIV::GetWideRecurrence(Instruction *NarrowUse) { /// This IV user cannot be widen. Replace this use of the original narrow IV /// with a truncation of the new wide IV to isolate and eliminate the narrow IV. static void truncateIVUse(NarrowIVDefUse DU, DominatorTree *DT) { - DEBUG(dbgs() << "INDVARS: Truncate IV " << *DU.WideDef - << " for user " << *DU.NarrowUse << "\n"); IRBuilder<> Builder(getInsertPointForUses(DU.NarrowUse, DU.NarrowDef, DT)); Value *Trunc = Builder.CreateTrunc(DU.WideDef, DU.NarrowDef->getType()); DU.NarrowUse->replaceUsesOfWith(DU.NarrowDef, Trunc); @@ -895,27 +893,10 @@ static void truncateIVUse(NarrowIVDefUse DU, DominatorTree *DT) { Instruction *WidenIV::WidenIVUse(NarrowIVDefUse DU, SCEVExpander &Rewriter) { // Stop traversing the def-use chain at inner-loop phis or post-loop phis. - if (PHINode *UsePhi = dyn_cast<PHINode>(DU.NarrowUse)) { - if (LI->getLoopFor(UsePhi->getParent()) != L) { - // For LCSSA phis, sink the truncate outside the loop. - // After SimplifyCFG most loop exit targets have a single predecessor. - // Otherwise fall back to a truncate within the loop. - if (UsePhi->getNumOperands() != 1) - truncateIVUse(DU, DT); - else { - PHINode *WidePhi = - PHINode::Create(DU.WideDef->getType(), 1, UsePhi->getName() + ".wide", - UsePhi); - WidePhi->addIncoming(DU.WideDef, UsePhi->getIncomingBlock(0)); - IRBuilder<> Builder(WidePhi->getParent()->getFirstInsertionPt()); - Value *Trunc = Builder.CreateTrunc(WidePhi, DU.NarrowDef->getType()); - UsePhi->replaceAllUsesWith(Trunc); - DeadInsts.push_back(UsePhi); - DEBUG(dbgs() << "INDVARS: Widen lcssa phi " << *UsePhi - << " to " << *WidePhi << "\n"); - } - return 0; - } + if (isa<PHINode>(DU.NarrowUse) && + LI->getLoopFor(DU.NarrowUse->getParent()) != L) { + truncateIVUse(DU, DT); + return 0; } // Our raison d'etre! Eliminate sign and zero extension. if (IsSigned ? isa<SExtInst>(DU.NarrowUse) : isa<ZExtInst>(DU.NarrowUse)) { |