Skip to content

Commit 2763964

Browse files
committed
Add the eor instruction to any code model
1 parent c5b61ae commit 2763964

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
@@ -2496,14 +2496,15 @@ bool AArch64InstrInfo::expandPostRAPseudo(MachineInstr &MI) const {
24962496
.addGlobalAddress(GV, 0, LoFlags)
24972497
.addMemOperand(*MI.memoperands_begin());
24982498
}
2499-
if (Subtarget.getTargetTriple().isOSMSVCRT() &&
2500-
!Subtarget.getTargetLowering()
2501-
->getTargetMachine()
2502-
.Options.EnableGlobalISel) {
2503-
BuildMI(MBB, MI, DL, get(AArch64::EORWrr), Reg)
2504-
.addReg(Reg, RegState::Kill)
2505-
.addReg(AArch64::SP);
2506-
}
2499+
}
2500+
// To match MSVC
2501+
if (Subtarget.getTargetTriple().isOSMSVCRT() &&
2502+
!Subtarget.getTargetLowering()
2503+
->getTargetMachine()
2504+
.Options.EnableGlobalISel) {
2505+
BuildMI(MBB, MI, DL, get(AArch64::EORWrr), Reg)
2506+
.addReg(Reg, RegState::Kill)
2507+
.addReg(AArch64::SP);
25072508
}
25082509

25092510
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
@@ -125,12 +125,14 @@ define dso_local void @sspFunc() #0 {
125125
; CHECK-NEXT: add x0, sp, #7
126126
; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
127127
; CHECK-NEXT: ldr x8, [x8]
128+
; CHECK-NEXT: eor x8, x8, sp
128129
; CHECK-NEXT: str x8, [sp, #8]
129130
; CHECK-NEXT: bl ptrUser
130131
; CHECK-NEXT: adrp x8, .refptr.__stack_chk_guard
131132
; CHECK-NEXT: ldr x8, [x8, :lo12:.refptr.__stack_chk_guard]
132133
; CHECK-NEXT: ldr x9, [sp, #8]
133134
; CHECK-NEXT: ldr x8, [x8]
135+
; CHECK-NEXT: eor x8, x8, sp
134136
; CHECK-NEXT: cmp x8, x9
135137
; CHECK-NEXT: b.ne .LBB6_2
136138
; CHECK-NEXT: // %bb.1: // %entry

0 commit comments

Comments
 (0)