[llvm] 34d2d7f - [InstSimplify] Drop redundant div fold (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 24 05:14:11 PDT 2023


Author: Nikita Popov
Date: 2023-04-24T14:14:02+02:00
New Revision: 34d2d7f565501acc5662dcb303d60e13695472ce

URL: https://github.com/llvm/llvm-project/commit/34d2d7f565501acc5662dcb303d60e13695472ce
DIFF: https://github.com/llvm/llvm-project/commit/34d2d7f565501acc5662dcb303d60e13695472ce.diff

LOG: [InstSimplify] Drop redundant div fold (NFCI)

This is nowadays handled generically via isDivZero() and icmp
simplification, specifically the computeConstantRange() based
logic.

Added: 
    

Modified: 
    llvm/lib/Analysis/InstructionSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index fd11331f1a5f..7bbf7266deb2 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -1179,16 +1179,6 @@ static Value *simplifyDiv(Instruction::BinaryOps Opcode, Value *Op0, Value *Op1,
 
   bool IsSigned = Opcode == Instruction::SDiv;
 
-  // (X /u C1) /u C2 -> 0 if C1 * C2 overflow
-  ConstantInt *C1, *C2;
-  if (!IsSigned && match(Op0, m_UDiv(m_Value(), m_ConstantInt(C1))) &&
-      match(Op1, m_ConstantInt(C2))) {
-    bool Overflow;
-    (void)C1->getValue().umul_ov(C2->getValue(), Overflow);
-    if (Overflow)
-      return Constant::getNullValue(Op0->getType());
-  }
-
   // If the operation is with the result of a select instruction, check whether
   // operating on either branch of the select always yields the same value.
   if (isa<SelectInst>(Op0) || isa<SelectInst>(Op1))


        


More information about the llvm-commits mailing list