[llvm-commits] [llvm] r135654 - in /llvm/trunk: lib/Transforms/Scalar/LoopStrengthReduce.cpp test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll

Andrew Trick atrick at apple.com
Wed Jul 20 18:45:54 PDT 2011


Author: atrick
Date: Wed Jul 20 20:45:54 2011
New Revision: 135654

URL: http://llvm.org/viewvc/llvm-project?rev=135654&view=rev
Log:
LSR, correct fix for rdar://9786536. Silly casting bug.

Modified:
    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
    llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll

Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=135654&r1=135653&r2=135654&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Jul 20 20:45:54 2011
@@ -1480,8 +1480,8 @@
     ConstantInt *Init = dyn_cast<ConstantInt>(PH->getIncomingValue(Entry));
     if (!Init) continue;
     Constant *NewInit = ConstantFP::get(DestTy, IsSigned ?
-                                        Init->getSExtValue() :
-                                        Init->getZExtValue());
+                                        (double)Init->getSExtValue() :
+                                        (double)Init->getZExtValue());
 
     BinaryOperator *Incr =
       dyn_cast<BinaryOperator>(PH->getIncomingValue(Latch));

Modified: llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll?rev=135654&r1=135653&r2=135654&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll (original)
+++ llvm/trunk/test/Transforms/LoopStrengthReduce/2011-07-20-DoubleIV.ll Wed Jul 20 20:45:54 2011
@@ -25,7 +25,7 @@
 
 ; Now check that the computed double constant is correct.
 ; CHECK: @doubleIV
-; CHECK: phi double [ 0x43F0000000000000, %entry ]
+; CHECK: phi double [ -3.900000e+01, %entry ]
 ; CHECK: br
 define void @doubleIV() nounwind {
 entry:





More information about the llvm-commits mailing list