about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--lib/Module/Checks.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Module/Checks.cpp b/lib/Module/Checks.cpp
index a9ef0dd4..b6aadce4 100644
--- a/lib/Module/Checks.cpp
+++ b/lib/Module/Checks.cpp
@@ -47,6 +47,12 @@ bool DivCheckPass::runOnModule(Module &M) {
         if (opcode != Instruction::SDiv && opcode != Instruction::UDiv &&
             opcode != Instruction::SRem && opcode != Instruction::URem)
           continue;
+
+        // Check if the operand is constant and not zero, skip in that case.
+        const auto &operand = binOp->getOperand(1);
+        if (const auto &coOp = dyn_cast<llvm::Constant>(operand)) {
+          if (!coOp->isZeroValue())
+            continue;
         }
       }
     }