moveOperands - assert Src/Dst MachineOperands are non-null.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 11 Jan 2020 14:36:46 +0000 (14:36 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sat, 11 Jan 2020 14:37:19 +0000 (14:37 +0000)
Fixes static-analyzer warnings.

llvm/lib/CodeGen/MachineInstr.cpp

index c8e3e5b..08d786f 100644 (file)
@@ -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));
 }