forked from OSchip/llvm-project
[MS] Copy the symbols assigned to the former instruction when memory folding.
The memory folding raplaced the old instruction without copying the symbols assigned. Which will resulted in built fail due to the lost symbols. Reviewed by craig.topper Differential Revision: https://reviews.llvm.org/D78471
This commit is contained in:
parent
a8fbbf8fe2
commit
6eb9eae010
|
@ -597,6 +597,10 @@ MachineInstr *TargetInstrInfo::foldMemoryOperand(MachineInstr &MI,
|
||||||
Flags, MemSize, MFI.getObjectAlign(FI));
|
Flags, MemSize, MFI.getObjectAlign(FI));
|
||||||
NewMI->addMemOperand(MF, MMO);
|
NewMI->addMemOperand(MF, MMO);
|
||||||
|
|
||||||
|
// The pass "x86 speculative load hardening" always attaches symbols to
|
||||||
|
// call instructions. We need copy it form old instruction.
|
||||||
|
NewMI->cloneInstrSymbols(MF, MI);
|
||||||
|
|
||||||
return NewMI;
|
return NewMI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
define i32 @foo(void ()** %0) {
|
define i32 @foo(void ()** %0) {
|
||||||
; CHECK-LABEL: foo:
|
; CHECK-LABEL: foo:
|
||||||
; CHECK-NOT: .Lslh_ret_addr0:
|
|
||||||
; CHECK: callq *(%{{.*}})
|
; CHECK: callq *(%{{.*}})
|
||||||
|
; CHECK-NEXT: .Lslh_ret_addr0:
|
||||||
; CHECK-NEXT: movq %rsp, %rcx
|
; CHECK-NEXT: movq %rsp, %rcx
|
||||||
; CHECK-NEXT: movq -{{[0-9]+}}(%rsp), %rax
|
; CHECK-NEXT: movq -{{[0-9]+}}(%rsp), %rax
|
||||||
; CHECK-NEXT: sarq $63, %rcx
|
; CHECK-NEXT: sarq $63, %rcx
|
||||||
|
|
Loading…
Reference in New Issue