[llvm] [InstCombine] Simplify fractions when there is no overflow (PR #92949)

via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 16:28:32 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);
----------------
AtariDreams wrote:

True.

https://github.com/llvm/llvm-project/pull/92949


More information about the llvm-commits mailing list