[PATCH] D88880: [LoopFlatten] Initial support for different types

Oliver Stannard (Linaro) via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 06:41:23 PDT 2020


ostannard added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/LoopFlatten.cpp:386
+      //
+      // For the overflow check, we first calculate an 'effective' GEP
+      // bitwidth. I.e., we look through a ZExt instruction which widens the
----------------
I don't think this logic is correct. The check below is proving that the add and mul cannot overflow because the GEP would overflow before they do, and that would be UB. However, in the example in this comment, the add or mul could overflow, but the GEP would be fine, because it never sees an offset greater than 2*32-1. Since there's no UB, we would need to preserve the wrapping behaviour, which we can't do with a single, simple loop.


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

https://reviews.llvm.org/D88880



More information about the llvm-commits mailing list