[llvm] [InstCombine] Simplify fractions when there is no overflow (PR #92949)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 16:26:46 PDT 2024
================
@@ -1057,7 +1057,8 @@ static Value *foldIDivShl(BinaryOperator &I, InstCombiner::BuilderTy &Builder) {
// (X * Y) s/ (X << Z) --> Y s/ (1 << Z)
if (IsSigned && HasNSW && (Op0->hasOneUse() || Op1->hasOneUse())) {
- Value *Shl = Builder.CreateShl(ConstantInt::get(Ty, 1), Z);
+ Value *Shl = Builder.CreateShl(ConstantInt::get(Ty, 1), Z, "", true,
+ HasNUW && HasNSW);
----------------
topperc wrote:
This looks like it could be its own patch?
Why do you need to check HasNSW here? It was already checked on the `if` above.
https://github.com/llvm/llvm-project/pull/92949
More information about the llvm-commits
mailing list