Skip to content

Commit 5c230ae

Browse files
committed
Fix failed tests
1 parent 00dddda commit 5c230ae

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29093,10 +29093,17 @@ void AArch64TargetLowering::ReplaceNodeResults(
2909329093
bool AArch64TargetLowering::useLoadStackGuardNode(const Module &M) const {
2909429094
if (Subtarget->isTargetAndroid() || Subtarget->isTargetFuchsia())
2909529095
return TargetLowering::useLoadStackGuardNode(M);
29096-
return false;
29096+
return !Subtarget->getTargetTriple().isOSMSVCRT() ||
29097+
Subtarget->isTargetMachO() ||
29098+
getTargetMachine().Options.EnableGlobalISel;
2909729099
}
2909829100

29099-
bool AArch64TargetLowering::useStackGuardXorFP() const { return true; }
29101+
bool AArch64TargetLowering::useStackGuardXorFP() const {
29102+
// Currently only MSVC CRTs XOR the frame pointer into the stack guard value.
29103+
return Subtarget->getTargetTriple().isOSMSVCRT() &&
29104+
!Subtarget->isTargetMachO() &&
29105+
!getTargetMachine().Options.EnableGlobalISel;
29106+
}
2910029107

2910129108
SDValue AArch64TargetLowering::emitStackGuardXorFP(SelectionDAG &DAG,
2910229109
SDValue Val,

llvm/test/CodeGen/AArch64/mingw-refptr.ll

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
22
; RUN: llc < %s -mtriple=aarch64-w64-mingw32 | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3-
; RUN: llc < %s -mtriple=aarch64-w64-mingw32 -global-isel | FileCheck %s --check-prefixes=CHECK,CHECK-GI
3+
; RUN: llc < %s -mtriple=aarch64-w64-mingw32 -global-isel | FileCheck %s --check-prefixes=CHECK-GI
44

55
@var = external local_unnamed_addr global i32, align 4
66
@dsolocalvar = external dso_local local_unnamed_addr global i32, align 4
@@ -82,25 +82,31 @@ define dso_local void @sspFunc() #0 {
8282
; CHECK-NEXT: // %bb.0: // %entry
8383
; CHECK-NEXT: sub sp, sp, #32
8484
; CHECK-NEXT: .seh_stackalloc 32
85-
; CHECK-NEXT: str x30, [sp, #16] // 8-byte Folded Spill
86-
; CHECK-NEXT: .seh_save_reg x30, 16
85+
; CHECK-NEXT: str x19, [sp, #16] // 8-byte Folded Spill
86+
; CHECK-NEXT: .seh_save_reg x19, 16
87+
; CHECK-NEXT: str x30, [sp, #24] // 8-byte Folded Spill
88+
; CHECK-NEXT: .seh_save_reg x30, 24
8789
; CHECK-NEXT: .seh_endprologue
88-
; CHECK-NEXT: adrp x8, .refptr.__stack_chk_guard
90+
; CHECK-NEXT: adrp x19, .refptr.__stack_chk_guard
91+
; CHECK-NEXT: mov x9, sp
8992
; CHECK-NEXT: add x0, sp, #7
90-
; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
91-
; CHECK-NEXT: ldr x8, [x8]
93+
; CHECK-NEXT: ldr x19, [x19, :lo12:.refptr.__stack_chk_guard]
94+
; CHECK-NEXT: ldr x8, [x19]
95+
; CHECK-NEXT: eor x8, x8, x9
9296
; CHECK-NEXT: str x8, [sp, #8]
9397
; CHECK-NEXT: bl ptrUser
94-
; CHECK-NEXT: adrp x8, .refptr.__stack_chk_guard
95-
; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
9698
; CHECK-NEXT: ldr x9, [sp, #8]
97-
; CHECK-NEXT: ldr x8, [x8]
98-
; CHECK-NEXT: cmp x8, x9
99+
; CHECK-NEXT: mov x8, sp
100+
; CHECK-NEXT: ldr x10, [x19]
101+
; CHECK-NEXT: eor x8, x9, x8
102+
; CHECK-NEXT: cmp x10, x8
99103
; CHECK-NEXT: b.ne .LBB6_2
100104
; CHECK-NEXT: // %bb.1: // %entry
101105
; CHECK-NEXT: .seh_startepilogue
102-
; CHECK-NEXT: ldr x30, [sp, #16] // 8-byte Folded Reload
103-
; CHECK-NEXT: .seh_save_reg x30, 16
106+
; CHECK-NEXT: ldr x30, [sp, #24] // 8-byte Folded Reload
107+
; CHECK-NEXT: .seh_save_reg x30, 24
108+
; CHECK-NEXT: ldr x19, [sp, #16] // 8-byte Folded Reload
109+
; CHECK-NEXT: .seh_save_reg x19, 16
104110
; CHECK-NEXT: add sp, sp, #32
105111
; CHECK-NEXT: .seh_stackalloc 32
106112
; CHECK-NEXT: .seh_endepilogue

llvm/test/CodeGen/AArch64/stack-protector-target.ll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ declare void @_Z7CapturePi(ptr)
2929
; FUCHSIA-AARCH64-COMMON: ldr [[D:.*]], [sp,
3030
; FUCHSIA-AARCH64-COMMON: cmp [[C]], [[D]]
3131

32-
; WINDOWS-AARCH64: adrp x8, __security_cookie
33-
; WINDOWS-AARCH64: ldr x8, [x8, :lo12:__security_cookie]
32+
; WINDOWS-AARCH64: adrp x19, __security_cookie
33+
; WINDOWS-AARCH64: ldr x8, [x19, :lo12:__security_cookie]
3434
; WINDOWS-AARCH64: str x8, [sp, #8]
3535
; WINDOWS-AARCH64: bl _Z7CapturePi
36-
; WINDOWS-AARCH64: ldr x0, [sp, #8]
36+
; WINDOWS-AARCH64: ldr x8, [sp, #8]
3737
; WINDOWS-AARCH64: bl __security_check_cookie
3838

39-
; WINDOWS-ARM64EC: adrp x8, __security_cookie
40-
; WINDOWS-ARM64EC: ldr x8, [x8, :lo12:__security_cookie]
39+
; WINDOWS-ARM64EC: adrp x19, __security_cookie
40+
; WINDOWS-ARM64EC: ldr x8, [x19, :lo12:__security_cookie]
4141
; WINDOWS-ARM64EC: str x8, [sp, #8]
4242
; WINDOWS-ARM64EC: bl "#_Z7CapturePi"
43-
; WINDOWS-ARM64EC: ldr x0, [sp, #8]
43+
; WINDOWS-ARM64EC: ldr x8, [sp, #8]
4444
; WINDOWS-ARM64EC: bl "#__security_check_cookie_arm64ec"

0 commit comments

Comments
 (0)