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

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 06:04:08 PDT 2020


ABataev added a comment.

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.


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