[llvm] aff2719 - Fix warning for unused variable in the non-assert build (NFC)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon May 30 09:22:36 PDT 2022


Author: Mehdi Amini
Date: 2022-05-30T16:21:38Z
New Revision: aff271930e8ac2ca520ba92cf6d736f94edfaaf6

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

LOG: Fix warning for unused variable in the non-assert build (NFC)

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 5adf44f145ba8..04752c4e0f5fc 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -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)))


        


More information about the llvm-commits mailing list