[PATCH] D30446: [IndVars] Do not branch on poison

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 10:24:01 PDT 2017


sanjoy added a comment.

In https://reviews.llvm.org/D30446#742283, @atrick wrote:

> My suggestion was this: LFTR is not necessary this early in the pipeline if it's only purpose is converting a 'cmp slt' to 'cmp eq'. As long as SCEV can compute the trip count, the loop test shouldn't matter. If we really need to convert the loop test, it could be done during LSR and we could drop the 'nw' flags at that point.
>
> We still want to remove sext/zext by widening, remove quadratic IVs, etc.


I think we're on the same page then (https://reviews.llvm.org/D30446#741950).

>   It's not clear to me why we need to pessimize those particular test cases.  In all those cases, is the problem that the rewritten loop test uses a possibly-poison IV? I don't even see nsw/nuw flags in the tests.

I'll have to check case by case, but in several tests I see an inbounds GEP, which can also generate poison.

> @mzolotukhin, if we do need to pessimize any of these cases, can you evaluate the performance impact, or suggest someone who can?

I can provide a version of this patch that avoids stripping no-wrap flags if that helps.  Alternatively, you can remove the code paths that call `dropPoisonGeneratingFlags` and get the same effect.


https://reviews.llvm.org/D30446





More information about the llvm-commits mailing list