[llvm] [InstCombine] Fold X + umax(X, 1) -> umax(X << 1, 1) (PR #222727)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 09:10:14 PDT 2026
================
@@ -1984,6 +1984,21 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
I.setHasNoUnsignedWrap(true);
}
+ // X + umax(X, 1) --> umax(X << 1, 1) if X + X does not overflow.
----------------
nikic wrote:
```suggestion
// X + umax(X, 1) --> umax(X << 1, 1) if the addition does not overflow.
```
nit: To make the comment match what the implementation actually checks.
https://github.com/llvm/llvm-project/pull/222727
More information about the llvm-commits
mailing list