[llvm-commits] [llvm] r49928 - /llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Chris Lattner
clattner at apple.com
Sat Apr 19 17:12:41 PDT 2008
On Apr 18, 2008, at 2:38 PM, Dale Johannesen wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=49928&view=rev
> Log:
> Fix a scalar evolution bug. Reversing everything
> does not work because of 0; 2>0 but -2U is also >0.
Sorry for being late to the party :)
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
> +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Fri Apr 18 16:38:31
> 2008
> @@ -1980,8 +1980,7 @@
> break;
> }
> case ICmpInst::ICMP_UGT: {
> - SCEVHandle TC = HowManyLessThans(SE.getNegativeSCEV(LHS),
> - SE.getNegativeSCEV(RHS), L,
> false);
> + SCEVHandle TC = HowFarToZero(SE.getMinusSCEV(LHS, RHS), L);
> if (!isa<SCEVCouldNotCompute>(TC)) return TC;
> break;
> }
Shouldn't this just be:
case ICmpInst::ICMP_ULT: {
SCEVHandle TC = HowManyLessThans(LHS, RHS, L, false);
if (!isa<SCEVCouldNotCompute>(TC)) return TC;
break;
}
case ICmpInst::ICMP_UGT: {
SCEVHandle TC = HowManyLessThans(RHS, LHS, L, false);
if (!isa<SCEVCouldNotCompute>(TC)) return TC;
break;
}
x > y --> y < x
-Chris
More information about the llvm-commits
mailing list