[llvm] ead2aa7 - Fix unused variable warning when compiling with asserts disabled.

Adrian Kuegel via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 03:55:53 PDT 2020


Author: Adrian Kuegel
Date: 2020-10-15T12:50:19+02:00
New Revision: ead2aa7098cfd693ed1842a88346ba67cfccd7df

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

LOG: Fix unused variable warning when compiling with asserts disabled.

Differential Revision: https://reviews.llvm.org/D89454

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineFunction.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 60af65834947..2568448f3c92 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -967,11 +967,10 @@ void MachineFunction::substituteDebugValuesForInst(const MachineInstr &Old,
   // MIR output.
   for (unsigned int I = 0; I < Old.getNumOperands(); ++I) {
     const auto &OldMO = Old.getOperand(I);
-    auto &NewMO = Old.getOperand(I);
 
     if (!OldMO.isReg() || !OldMO.isDef())
       continue;
-    assert(NewMO.isDef());
+    assert(Old.getOperand(I).isDef());
 
     unsigned NewInstrNum = New.getDebugInstrNum();
     makeDebugValueSubstitution(std::make_pair(OldInstrNum, I),


        


More information about the llvm-commits mailing list