This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by amehsan on Aug 2 2016, 11:58 AM.

Details

Summary

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.

Diff Detail

Event Timeline

amehsan updated this revision to Diff 66508.Aug 2 2016, 11:58 AM
amehsan retitled this revision from to [IndVarSimplify] Extend trip count instead of truncating IV in LFTR, when original IV does not overflow.
amehsan updated this object.
amehsan added reviewers: sanjoy, hfinkel.
mehdi_amini commandeered this revision.Aug 2 2016, 12:06 PM
mehdi_amini abandoned this revision.
mehdi_amini added a reviewer: amehsan.

Please reopen with llvm-commits as a subscriber since the beginning.

abandoning this if you don't mind @mehdi_amini

amehsan commandeered this revision.Aug 2 2016, 12:11 PM
amehsan reclaimed this revision.
amehsan abandoned this revision.
amehsan edited reviewers, added: mehdi_amini; removed: amehsan.