summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-21 16:22:48 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-21 16:22:48 +0000
commit5c0e64fcd6d93ed1033165ed74b524831fff285e (patch)
treedd4666c310b0c2808c3f6922427de483f6413b02 /llvm/lib/CodeGen/MachineInstr.cpp
parentca08c44a46a7f055534790a0c0691e11ad100faa (diff)
downloadbcm5719-llvm-5c0e64fcd6d93ed1033165ed74b524831fff285e.tar.gz
bcm5719-llvm-5c0e64fcd6d93ed1033165ed74b524831fff285e.zip
Calling memmove on a MachineOperand is totally safe.
While it's not POD due to the user-defined constructor, it's still a trivially copyable type. No functional change. llvm-svn: 230141
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 0514eb6da72..50c4e814b2e 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -674,14 +674,8 @@ static void moveOperands(MachineOperand *Dst, MachineOperand *Src,
if (MRI)
return MRI->moveOperands(Dst, Src, NumOps);
- // Here it would be convenient to call memmove, so that isn't allowed because
- // MachineOperand has a constructor and so isn't a POD type.
- if (Dst < Src)
- for (unsigned i = 0; i != NumOps; ++i)
- new (Dst + i) MachineOperand(Src[i]);
- else
- for (unsigned i = NumOps; i ; --i)
- new (Dst + i - 1) MachineOperand(Src[i - 1]);
+ // MachineOperand is a trivially copyable type so we can just use memmove.
+ std::memmove(Dst, Src, NumOps * sizeof(MachineOperand));
}
/// addOperand - Add the specified operand to the instruction. If it is an
OpenPOWER on IntegriCloud