From e99f98262c5c766ec832b756aa303a3cdcc01bd7 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 27 Apr 2009 20:35:32 +0000 Subject: Permit ChangeCompareStride to rewrite a comparison when the factor between the comparison's iv stride and the candidate stride is exactly -1. llvm-svn: 70244 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index c436cec26ed..a6795a72ef9 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2028,7 +2028,9 @@ ICmpInst *LoopStrengthReduce::ChangeCompareStride(Loop *L, ICmpInst *Cond, if (!isa(SI->first)) continue; int64_t SSInt = cast(SI->first)->getValue()->getSExtValue(); - if (abs(SSInt) <= abs(CmpSSInt) || (SSInt % CmpSSInt) != 0) + if (SSInt == CmpSSInt || + abs(SSInt) < abs(CmpSSInt) || + (SSInt % CmpSSInt) != 0) continue; Scale = SSInt / CmpSSInt; -- cgit v1.2.3