[PATCH] D90648: [SCEV] Fix nsw flags for GEP expressions

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 2 20:56:56 PST 2020


mkazantsev added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:3487
+  // non-negative, we can use nuw.
+  SCEV::NoWrapFlags BaseWrap = GEP->isInBounds() && isKnownNonNegative(Offset)
+      ? SCEV::FlagNUW : SCEV::FlagAnyWrap;
----------------
How about case when gep has no inbounds flag, but we can prove that `base+ offset` does not sign-wrap? Likewise, we could prove that `base + offset` does not unsign-wrap even without non-negative fact for offset in some cases. Why don't we use `isKnownPredicate(slt/ult, base, base + offset)` (at least in affine case)?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90648



More information about the llvm-commits mailing list