[PATCH] D81881: [OPENMP]Fix overflow during counting the number of iterations.

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 11:33:00 PDT 2020


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

In D81881#2095509 <https://reviews.llvm.org/D81881#2095509>, @ABataev wrote:

> In D81881#2094062 <https://reviews.llvm.org/D81881#2094062>, @jdoerfert wrote:
>
> > So the idea is to do the trip count computation with defined overflow behavior, e.g., without `nsw/nuw` in IR, right?
>
>
> Not quite. If we can predict that there is no overflow, everything remains the same as before. If we cannot do this, the trip count calculations are performed on unsigned types instead of signed. It does not just drop `nuw/nsw` flags, but also uses `udiv`, `zext` etc. instead of `sdiv`, `sext` etc. Plus, it tries to reorganize the operations a little bit to avoid possible overflow.


Makes sense. LGTM.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81881/new/

https://reviews.llvm.org/D81881





More information about the cfe-commits mailing list