forked from OSchip/llvm-project
[IRMemoryMap] Avoid redundant zero-init in the Allocation constructor (NFC)
In the lldb-bench/arithmetic benchmark, 1.7% of the total running time is spent zero-initializing a std::vector that has already been zeroed. llvm-svn: 339051
This commit is contained in:
parent
82a7f144a4
commit
9452359887
|
@ -90,7 +90,8 @@ public:
|
|||
/// Set the number of bytes in the data buffer.
|
||||
///
|
||||
/// Sets the number of bytes that this object should be able to contain.
|
||||
/// This can be used prior to copying data into the buffer.
|
||||
/// This can be used prior to copying data into the buffer. Note that this
|
||||
/// zero-initializes up to \p byte_size bytes.
|
||||
///
|
||||
/// @param[in] byte_size
|
||||
/// The new size in bytes that this data buffer should attempt
|
||||
|
|
|
@ -278,14 +278,10 @@ IRMemoryMap::Allocation::Allocation(lldb::addr_t process_alloc,
|
|||
default:
|
||||
assert(0 && "We cannot reach this!");
|
||||
case eAllocationPolicyHostOnly:
|
||||
m_data.SetByteSize(size);
|
||||
memset(m_data.GetBytes(), 0, size);
|
||||
break;
|
||||
case eAllocationPolicyProcessOnly:
|
||||
break;
|
||||
case eAllocationPolicyMirror:
|
||||
m_data.SetByteSize(size);
|
||||
memset(m_data.GetBytes(), 0, size);
|
||||
break;
|
||||
case eAllocationPolicyProcessOnly:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue