continue;
MachineInstr &MI = MBB.back();
- if (!MI.isReturn())
+
+ // We only care about returns that are not also calls. For calls, that
+ // happen to also be returns (tail calls) we will have already handled
+ // them as calls.
+ if (!MI.isReturn() || MI.isCall())
continue;
hardenReturnInstr(MI);
; X64-NEXT: movq %rsp, %rax
; X64-NEXT: movq $-1, %rcx
; X64-NEXT: sarq $63, %rax
-; X64-NEXT: movq %rax, %rcx
-; X64-NEXT: shlq $47, %rcx
-; X64-NEXT: orq %rcx, %rsp
; X64-NEXT: shlq $47, %rax
; X64-NEXT: orq %rax, %rsp
; X64-NEXT: jmpq *(%rdi) # TAILCALL
; X64-NEXT: movq %rsp, %rax
; X64-NEXT: movq $-1, %rcx
; X64-NEXT: sarq $63, %rax
-; X64-NEXT: movq %rax, %rcx
-; X64-NEXT: shlq $47, %rcx
-; X64-NEXT: orq %rcx, %rsp
; X64-NEXT: shlq $47, %rax
; X64-NEXT: orq %rax, %rsp
; X64-NEXT: jmpq *{{.*}}(%rip) # TAILCALL