[PATCH] D12073: Make ScalarEvolution::isKnownPredicate a little smarter

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 17 15:26:48 PDT 2015


hfinkel removed rL LLVM as the repository for this revision.
hfinkel updated this revision to Diff 32347.
hfinkel added a comment.

As suggested, move logic into ScalarEvolution::isImpliedCondOperandsHelper, and sign-extend before the subtraction to deal with potential overflow in the subtraction.

There are now three failing tests, mostly due to IV widening that now does not happen. The new known-predicate results are:

test/Transforms/IndVarSimplify/elim-extend.ll:

- {%init,+,1}<nsw><%loop> sle {(1 + %init),+,1}<nsw><%loop>
- {(sext i32 %init to i64),+,1}<nsw><%loop> sle {(1 + (sext i32 %init to i64)),+,1}<nsw><%loop>
- {-1,+,1}<nsw><%outerloop> sle {1,+,1}<nuw><%outerloop>
- {-1,+,1}<nsw><%outerloop> sle {1,+,1}<nuw><nsw><%outerloop>

test/Transforms/IndVarSimplify/iv-sext.ll:

- {-1,+,1}<nsw><%bb> sle {1,+,1}<nuw><%bb>
- {-1,+,1}<nsw><%bb> sle {1,+,1}<nuw><nsw><%bb>

test/Transforms/IndVarSimplify/strengthen-overflow.ll:

- {%init,+,1}<nsw><%loop> sle {(1 + %init),+,1}<nsw><%loop>

These look right, but some consumer of the information seems to make a worse no-wrap deductions as a result (thus, this patch is still WIP).


http://reviews.llvm.org/D12073

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Transforms/IndVarSimplify/bec-cmp.ll
  test/Transforms/IndVarSimplify/elim-extend.ll
  test/Transforms/IndVarSimplify/iv-sext.ll
  test/Transforms/IndVarSimplify/strengthen-overflow.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12073.32347.patch
Type: text/x-patch
Size: 5448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150817/cdbe7adb/attachment.bin>


More information about the llvm-commits mailing list