From a9348dc7acc6f292425721c178311d7b0b5144b6 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 3 Sep 2008 00:10:56 +0000 Subject: [PATCH] Check iteration count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55680 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 ++++ test/Transforms/LoopStrengthReduce/2008-09-02-IVType.ll | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index b2c5977a1b6..16b8dbb451f 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -1908,6 +1908,10 @@ BinaryOperator *getNewPHIIncrement(BinaryOperator *Incr, PHINode *PHI, /// change the type of IV, if possible. void LoopStrengthReduce::OptimizeIVType(Loop *L) { + SCEVHandle IterationCount = SE->getIterationCount(L); + if (isa(IterationCount)) + return; + BasicBlock *LPH = L->getLoopPreheader(); BasicBlock *LatchBB = L->getLoopLatch(); SmallVector PHIs; diff --git a/test/Transforms/LoopStrengthReduce/2008-09-02-IVType.ll b/test/Transforms/LoopStrengthReduce/2008-09-02-IVType.ll index 772d9dda0f5..49df675e588 100644 --- a/test/Transforms/LoopStrengthReduce/2008-09-02-IVType.ll +++ b/test/Transforms/LoopStrengthReduce/2008-09-02-IVType.ll @@ -49,7 +49,7 @@ bb28: ; preds = %bb8, %bb store i16* %theDCTBufferIter.0.lcssa, i16** %tmp6, align 4 %tmp37 = add i16 %component.09, 1 ; [#uses=2] %phitmp15 = sext i16 %tmp37 to i32 ; [#uses=1] - %tmp46 = icmp slt i32 %phitmp15, %tmp4412 ; [#uses=1] + %tmp46 = icmp slt i32 %phitmp15, 42 ; [#uses=1] br i1 %tmp46, label %bb, label %bb49 bb49: ; preds = %bb28, %entry -- 2.34.1