summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-04-03 06:16:22 +0000
committerChris Lattner <sabre@nondot.org>2010-04-03 06:16:22 +0000
commit774858fc38efba59407d34e06ffa169ac5187d5a (patch)
tree29d564c68aa277ad9a4bcfcd017ec845dd6e513c /llvm/lib
parent915322bc4aaf3b99b006eed9e6ffb02904381dc6 (diff)
downloadbcm5719-llvm-774858fc38efba59407d34e06ffa169ac5187d5a.tar.gz
bcm5719-llvm-774858fc38efba59407d34e06ffa169ac5187d5a.zip
improve comment and drop a dead check. If PH had
no uses, it would have been deleted by RecursivelyDeleteTriviallyDeadInstructions llvm-svn: 100275
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/IndVarSimplify.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index b5fdd0c4a17..650231b8e5c 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -759,10 +759,14 @@ void IndVarSimplify::HandleFloatingPointIV(Loop *L, PHINode *PH) {
Incr->replaceAllUsesWith(UndefValue::get(Incr->getType()));
RecursivelyDeleteTriviallyDeadInstructions(Incr);
- // Replace floating induction variable, if it isn't already deleted.
- // Give SIToFPInst preference over UIToFPInst because it is faster on
- // platforms that are widely used.
- if (WeakPH && !PH->use_empty()) {
+ // If the FP induction variable still has uses, this is because something else
+ // in the loop uses its value. In order to canonicalize the induction
+ // variable, we chose to eliminate the IV and rewrite it in terms of an
+ // int->fp cast.
+ //
+ // We give preference to sitofp over uitofp because it is faster on most
+ // platforms.
+ if (WeakPH) {
if (CanUseSIToFP(InitValueVal, ExitValueVal, InitValue, ExitValue)) {
SIToFPInst *Conv = new SIToFPInst(NewPHI, PH->getType(), "indvar.conv",
PH->getParent()->getFirstNonPHI());
OpenPOWER on IntegriCloud