[PATCH] D125500: [ValueTracking] recognize sub X, (X % Y) as not overflowing

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 13 02:07:27 PDT 2022


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

LGTM

There are a lot more cases we could handle here (at least for the unsigned case) -- in particular a lot of the cases starting at https://github.com/llvm/llvm-project/blob/6d53d35efd3b876d2cc70a776fb168d6debfeba5/llvm/lib/Analysis/InstructionSimplify.cpp#L3023 are relevant. We have quite a few operations (urem, udiv, shr, and) that are non-increasing functions, often of both operands. Though I'm also not sure whether its worthwhile to try particularly hard to infer nuw here.


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

https://reviews.llvm.org/D125500



More information about the llvm-commits mailing list