Skip to content

Commit 23fbbbb

Browse files
committed
Add the eor instruction to any code model
1 parent 12ded1e commit 23fbbbb

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,14 +2310,15 @@ bool AArch64InstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
23102310
.addGlobalAddress(GV, 0, LoFlags)
23112311
.addMemOperand(*MI.memoperands_begin());
23122312
}
2313-
if (Subtarget.getTargetTriple().isOSMSVCRT() &&
2314-
!Subtarget.getTargetLowering()
2315-
->getTargetMachine()
2316-
.Options.EnableGlobalISel) {
2317-
BuildMI(MBB, MI, DL, get(AArch64::EORWrr), Reg)
2318-
.addReg(Reg, RegState::Kill)
2319-
.addReg(AArch64::SP);
2320-
}
2313+
}
2314+
// To match MSVC
2315+
if (Subtarget.getTargetTriple().isOSMSVCRT() &&
2316+
!Subtarget.getTargetLowering()
2317+
->getTargetMachine()
2318+
.Options.EnableGlobalISel) {
2319+
BuildMI(MBB, MI, DL, get(AArch64::EORWrr), Reg)
2320+
.addReg(Reg, RegState::Kill)
2321+
.addReg(AArch64::SP);
23212322
}
23222323

23232324
MBB.erase(MI);

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

Lines changed: 3 additions & 1 deletion
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
@@ -89,12 +89,14 @@ define dso_local void @sspFunc() #0 {
8989
; CHECK-NEXT: add x0, sp, #7
9090
; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
9191
; CHECK-NEXT: ldr x8, [x8]
92+
; CHECK-NEXT: eor x8, x8, sp
9293
; CHECK-NEXT: str x8, [sp, #8]
9394
; CHECK-NEXT: bl ptrUser
9495
; CHECK-NEXT: adrp x8, .refptr.__stack_chk_guard
9596
; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
9697
; CHECK-NEXT: ldr x9, [sp, #8]
9798
; CHECK-NEXT: ldr x8, [x8]
99+
; CHECK-NEXT: eor x8, x8, sp
98100
; CHECK-NEXT: cmp x8, x9
99101
; CHECK-NEXT: b.ne .LBB6_2
100102
; CHECK-NEXT: // %bb.1: // %entry

0 commit comments

Comments
 (0)