Cranelift: Derive Copy for InstructionData (#5043)
* Cranelift: Derive `Copy` for `InstructionData` And update `clone` calls to be copies. * Add a test for `InstructionData`'s size
This commit is contained in:
@@ -386,7 +386,7 @@ impl FunctionStencil {
|
||||
.zip(self.dfg.inst_results(src))
|
||||
.all(|(a, b)| self.dfg.value_type(*a) == self.dfg.value_type(*b)));
|
||||
|
||||
self.dfg[dst] = self.dfg[src].clone();
|
||||
self.dfg[dst] = self.dfg[src];
|
||||
self.layout.remove_inst(src);
|
||||
}
|
||||
|
||||
|
||||
@@ -755,6 +755,19 @@ mod tests {
|
||||
use super::*;
|
||||
use alloc::string::ToString;
|
||||
|
||||
#[test]
|
||||
fn inst_data_is_copy() {
|
||||
fn is_copy<T: Copy>() {}
|
||||
is_copy::<InstructionData>();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inst_data_size() {
|
||||
// The size of `InstructionData` is performance sensitive, so make sure
|
||||
// we don't regress it unintentionally.
|
||||
assert_eq!(std::mem::size_of::<InstructionData>(), 16);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opcodes() {
|
||||
use core::mem;
|
||||
|
||||
Reference in New Issue
Block a user