[llvm] [InstCombine] Fold ((X << nuw Z) binop nuw Y) >>u Z --> X binop nuw (Y >>u Z) (PR #88193)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Tue May 7 08:54:19 PDT 2024
================
@@ -1259,6 +1259,53 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
match(Op1, m_SpecificIntAllowPoison(BitWidth - 1)))
return new ZExtInst(Builder.CreateIsNotNeg(X, "isnotneg"), Ty);
+ // ((X << nuw Z) sub nuw Y) >>u exact Z --> X sub nuw (Y >>u exact Z),
+ // ONLY if I is exact, and both the shift and sub are nuw
----------------
dtcxzyw wrote:
```suggestion
```
It is the same as the above line.
https://github.com/llvm/llvm-project/pull/88193
More information about the llvm-commits
mailing list