[PATCH] D23075: [IndVarSimplify] Extend trip count instead of truncating IV in LFTR, when original IV does not overflow

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 12:07:44 PDT 2016


amehsan created this revision.
amehsan added reviewers: sanjoy, hfinkel.
amehsan added a subscriber: llvm-commits.

When Original IV, before widening, does not overflow, extending trip count in the loop control logic generates better code compared to truncating IV. This is because

(1) extending trip count is a loop invariant operation (see genLoopLimit where we prove trip count is loop invariant).
(2) Scalar Evolution seems to have problems understanding trunc. So removing them allows better analysis performed in Scalar Evolution. (In particular this fixes PR 28363 which is the motivation for this change).

So far I have tested this with unit-tests and test suite on pwr. I am planning to do more functional testing and also add some unit-tests. But I thought to post this here, to get some feedback.

I am not going to perform any performance test. Any degradation caused by this should be an indication of a bug elsewhere.

https://reviews.llvm.org/D23075

Files:
  lib/Transforms/Scalar/IndVarSimplify.cpp
  test/Transforms/IndVarSimplify/elim-extend.ll
  test/Transforms/IndVarSimplify/preserve-signed-wrap.ll
  test/Transforms/IndVarSimplify/promote-iv-to-eliminate-casts.ll
  test/Transforms/IndVarSimplify/signed-trip-count.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23075.66516.patch
Type: text/x-patch
Size: 6118 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160802/0a8e6b5e/attachment.bin>


More information about the llvm-commits mailing list