[all-commits] [llvm/llvm-project] f4e42f: [SCEV] Merge udiv exact logic into general udiv lo...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Thu May 7 00:44:20 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f4e42fb59b2474d368d2f0828a834a4aa32d82c4
https://github.com/llvm/llvm-project/commit/f4e42fb59b2474d368d2f0828a834a4aa32d82c4
Author: Nikita Popov <npopov at redhat.com>
Date: 2026-05-07 (Thu, 07 May 2026)
Changed paths:
M llvm/lib/Analysis/ScalarEvolution.cpp
M llvm/test/Analysis/ScalarEvolution/mul-udiv-folds.ll
A llvm/test/Analysis/ScalarEvolution/udiv.ll
Log Message:
-----------
[SCEV] Merge udiv exact logic into general udiv logic (#195840)
The udiv exact handling for constant RHS is already partially handling
in the generic udiv code:
https://github.com/llvm/llvm-project/blob/8a0c5d3f43b27c8e2895c6106d6b551d626979fd/llvm/lib/Analysis/ScalarEvolution.cpp#L3641-L3657
Move two remaining folds there as well:
* `(%a * %b)<nuw> / %b` to `%a`
* `(A*GCD * %b)<nuw> / (C*GCD)` to `(A * %b)<nuw> / C`
Removing common factors from a multiply does not require exact if the
multiply is nuw (and conversely, being exact is not sufficient without
nuw).
This makes getUDivExactExpr() equivalent to getUDivExpr(). I've retained
the method for now in case we want to add exact specific logic in the
future.
Proof: https://alive2.llvm.org/ce/z/iQeb6v
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list