aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
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
commit5ab6867177fc45e51066ac0afc88de29874d40d7 (patch)
treec39d1d7382ef4c63e98502c73ec87ba64b2fe106 /lib/Transforms
parent92aa2d0b95f956f726b7f5cf10313a7bba82544e (diff)
downloadexternal_llvm-5ab6867177fc45e51066ac0afc88de29874d40d7.zip
external_llvm-5ab6867177fc45e51066ac0afc88de29874d40d7.tar.gz
external_llvm-5ab6867177fc45e51066ac0afc88de29874d40d7.tar.bz2
improve comment and drop a dead check. If PH had
no uses, it would have been deleted by RecursivelyDeleteTriviallyDeadInstructions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100275 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index b5fdd0c..650231b 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/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());