Fix warning for unused variable in the non-assert build (NFC)
authorMehdi Amini <joker.eph@gmail.com>
Mon, 30 May 2022 16:21:38 +0000 (16:21 +0000)
committerMehdi Amini <joker.eph@gmail.com>
Mon, 30 May 2022 16:21:38 +0000 (16:21 +0000)
llvm/lib/Analysis/ValueTracking.cpp

index 5adf44f..04752c4 100644 (file)
@@ -4607,6 +4607,7 @@ bool llvm::isSafeToSpeculativelyExecuteWithOpcode(unsigned Opcode,
                                         const Instruction *CtxI,
                                         const DominatorTree *DT,
                                         const TargetLibraryInfo *TLI) {
+#ifndef NDEBUG
   if (Inst->getOpcode() != Opcode) {
     // Check that the operands are actually compatible with the Opcode override.
     auto hasEqualReturnAndLeadingOperandTypes =
@@ -4624,6 +4625,7 @@ bool llvm::isSafeToSpeculativelyExecuteWithOpcode(unsigned Opcode,
     assert(!Instruction::isUnaryOp(Opcode) ||
            hasEqualReturnAndLeadingOperandTypes(Inst, 1));
   }
+#endif
 
   for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i)
     if (Constant *C = dyn_cast<Constant>(Inst->getOperand(i)))