[PATCH] D33089: [Polly] Generate more 'canonical' induction variable if we can prove there is no overflow.

Tobias Grosser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 23:26:50 PDT 2017


grosser added a comment.

I don't think checking with mayOverflowOnIV is needed. The types we use today  are anyway just a guess, as we have no idea what type is needed. Consequently checking for possible overflows -- while we already may have some overflows just gives a wrong sense of security.

I think we should work towards what we want:

1. code that matches what indvars would like to see
2. code that is typesafe

Dropping this surprising subtract goes towards 1). Maximilian worked in his bachelor thesis on deriving precise types for the ASTs we generate. As a result of this work, he will derive a type that is large enough to contain UB, LB, as well as UB + Stride. Hence, as soon as his code is upstreamed, the code produced after this patch is valid. Hence, I would just add a comment at the top of this function, that we expect the type of UB, LB, UB+Stride to be large enough for values that UB may take throughout the execution of the loop, including the computation of indvar + Stride before the final abort..


Repository:
  rL LLVM

https://reviews.llvm.org/D33089





More information about the llvm-commits mailing list