[llvm] a8ed86b - moveOperands - assert Src/Dst MachineOperands are non-null.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 11 06:38:25 PST 2020


Author: Simon Pilgrim
Date: 2020-01-11T14:37:19Z
New Revision: a8ed86b5c705cf1d2f3ca55b0640cf0f2fe01abc

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

LOG: moveOperands - assert Src/Dst MachineOperands are non-null.

Fixes static-analyzer warnings.

Added: 
    

Modified: 
    llvm/lib/CodeGen/MachineInstr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index c8e3e5bb01ac..08d786f8f12c 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -187,8 +187,8 @@ static void moveOperands(MachineOperand *Dst, MachineOperand *Src,
                          unsigned NumOps, MachineRegisterInfo *MRI) {
   if (MRI)
     return MRI->moveOperands(Dst, Src, NumOps);
-
   // MachineOperand is a trivially copyable type so we can just use memmove.
+  assert(Dst && Src && "Unknown operands");
   std::memmove(Dst, Src, NumOps * sizeof(MachineOperand));
 }
 


        


More information about the llvm-commits mailing list