[llvm] 05d722a - [llvm] Fix an "unused variable" warning when assertions are disabled

Dmitri Gribenko via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 02:38:21 PST 2023


Author: Dmitri Gribenko
Date: 2023-01-09T11:33:05+01:00
New Revision: 05d722a11d779bd1d7990790b390f0d44a3d8afe

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

LOG: [llvm] Fix an "unused variable" warning when assertions are disabled

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index dbf0f8a42176..373aa11663bf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -677,15 +677,15 @@ void InstrEmitter::EmitRegSequence(SDNode *Node,
 MachineInstr *
 InstrEmitter::EmitDbgValue(SDDbgValue *SD,
                            DenseMap<SDValue, Register> &VRBaseMap) {
-  MDNode *Var = SD->getVariable();
   DebugLoc DL = SD->getDebugLoc();
-  assert(cast<DILocalVariable>(Var)->isValidLocationForIntrinsic(DL) &&
+  assert(cast<DILocalVariable>(SD->getVariable())
+             ->isValidLocationForIntrinsic(DL) &&
          "Expected inlined-at fields to agree");
 
   SD->setIsEmitted();
 
-  ArrayRef<SDDbgOperand> LocationOps = SD->getLocationOps();
-  assert(!LocationOps.empty() && "dbg_value with no location operands?");
+  assert(!SD->getLocationOps().empty() &&
+         "dbg_value with no location operands?");
 
   if (SD->isInvalidated())
     return EmitDbgNoLocation(SD);


        


More information about the llvm-commits mailing list