StripLayer: Optimize shared_ptr move
StripDesignPtr
is a shared pointer so this simple construction is doing needless reference counting (expensive memory locking).
MuonGMR4::StripLayer::StripLayer(GeoModel::TransientConstSharedPtr<StripDesign>) [base object constructor]: # @MuonGMR4::StripLayer::StripLayer(GeoModel::TransientConstSharedPtr<StripDesign>) [base object constructor]
mov rax, qword ptr [rsi]
mov qword ptr [rdi], rax
mov rax, qword ptr [rsi + 8]
mov qword ptr [rdi + 8], rax
test rax, rax
je .LBB0_4
mov rcx, qword ptr [rip + __libc_single_threaded@GOTPCREL]
cmp byte ptr [rcx], 0
je .LBB0_3
inc dword ptr [rax + 8]
ret
.LBB0_3:
lock inc dword ptr [rax + 8]
.LBB0_4:
ret
changes to
MuonGMR4::StripLayer::StripLayer(GeoModel::TransientConstSharedPtr<StripDesign>) [base object constructor]: # @MuonGMR4::StripLayer::StripLayer(GeoModel::TransientConstSharedPtr<StripDesign>) [base object constructor]
mov qword ptr [rdi + 8], 0
movups xmm0, xmmword ptr [rsi]
mov qword ptr [rsi + 8], 0
movups xmmword ptr [rdi], xmm0
mov qword ptr [rsi], 0
ret