Skip to content

Commit f7a1e48

Browse files
committed
Merging r370204:
------------------------------------------------------------------------ r370204 | hans | 2019-08-28 15:55:10 +0200 (Wed, 28 Aug 2019) | 6 lines [SelectionDAG] Don't generate libcalls for wide shifts on Windows (PR42711) Neither libgcc or compiler-rt are usually used on Windows, so these functions can't be called. Differential revision: https://reviews.llvm.org/D66880 ------------------------------------------------------------------------ llvm-svn: 370205
1 parent e82a536 commit f7a1e48

File tree

6 files changed

+31
-11
lines changed

6 files changed

+31
-11
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11995,6 +11995,14 @@ bool AArch64TargetLowering::isMaskAndCmp0FoldingBeneficial(
1199511995
return Mask->getValue().isPowerOf2();
1199611996
}
1199711997

11998+
bool AArch64TargetLowering::shouldExpandShift(SelectionDAG &DAG,
11999+
SDNode *N) const {
12000+
if (DAG.getMachineFunction().getFunction().hasMinSize() &&
12001+
!Subtarget->isTargetWindows())
12002+
return false;
12003+
return true;
12004+
}
12005+
1199812006
void AArch64TargetLowering::initializeSplitCSR(MachineBasicBlock *Entry) const {
1199912007
// Update IsSplitCSR in AArch64unctionInfo.
1200012008
AArch64FunctionInfo *AFI = Entry->getParent()->getInfo<AArch64FunctionInfo>();

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,7 @@ class AArch64TargetLowering : public TargetLowering {
480480
return VT.getSizeInBits() >= 64; // vector 'bic'
481481
}
482482

483-
bool shouldExpandShift(SelectionDAG &DAG, SDNode *N) const override {
484-
if (DAG.getMachineFunction().getFunction().hasMinSize())
485-
return false;
486-
return true;
487-
}
483+
bool shouldExpandShift(SelectionDAG &DAG, SDNode *N) const override;
488484

489485
bool shouldTransformSignedTruncationCheck(EVT XVT,
490486
unsigned KeptBits) const override {

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5059,6 +5059,14 @@ bool X86TargetLowering::shouldFoldMaskToVariableShiftPair(SDValue Y) const {
50595059
return true;
50605060
}
50615061

5062+
bool X86TargetLowering::shouldExpandShift(SelectionDAG &DAG,
5063+
SDNode *N) const {
5064+
if (DAG.getMachineFunction().getFunction().hasMinSize() &&
5065+
!Subtarget.isOSWindows())
5066+
return false;
5067+
return true;
5068+
}
5069+
50625070
bool X86TargetLowering::shouldSplatInsEltVarIndex(EVT VT) const {
50635071
// Any legal vector type can be splatted more efficiently than
50645072
// loading/spilling from memory.

llvm/lib/Target/X86/X86ISelLowering.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -863,11 +863,7 @@ namespace llvm {
863863
return VTIsOk(XVT) && VTIsOk(KeptBitsVT);
864864
}
865865

866-
bool shouldExpandShift(SelectionDAG &DAG, SDNode *N) const override {
867-
if (DAG.getMachineFunction().getFunction().hasMinSize())
868-
return false;
869-
return true;
870-
}
866+
bool shouldExpandShift(SelectionDAG &DAG, SDNode *N) const override;
871867

872868
bool shouldSplatInsEltVarIndex(EVT VT) const override;
873869

llvm/test/CodeGen/AArch64/shift_minsize.ll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc < %s -mtriple=aarch64-unknown-unknown | FileCheck %s
3+
; RUN: llc < %s -mtriple=aarch64-windows | FileCheck %s -check-prefix=CHECK-WIN
4+
5+
; The Windows runtime doesn't have these.
6+
; CHECK-WIN-NOT: __ashlti3
7+
; CHECK-WIN-NOT: __ashrti3
38

49
define i64 @f0(i64 %val, i64 %amt) minsize optsize {
510
; CHECK-LABEL: f0:
@@ -53,6 +58,7 @@ define dso_local { i64, i64 } @shl128(i64 %x.coerce0, i64 %x.coerce1, i8 signext
5358
; CHECK-NEXT: bl __ashlti3
5459
; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
5560
; CHECK-NEXT: ret
61+
5662
entry:
5763
%x.sroa.2.0.insert.ext = zext i64 %x.coerce1 to i128
5864
%x.sroa.2.0.insert.shift = shl nuw i128 %x.sroa.2.0.insert.ext, 64

llvm/test/CodeGen/X86/shift_minsize.ll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2-
; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
2+
; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
3+
; RUN: llc < %s -mtriple=x86_64--windows-msvc | FileCheck %s -check-prefix=CHECK-WIN
4+
5+
; The Windows runtime doesn't have these.
6+
; CHECK-WIN-NOT: __ashlti3
7+
; CHECK-WIN-NOT: __ashrti3
8+
; CHECK-WIN-NOT: __lshrti3
39

410
define i64 @f0(i64 %val, i64 %amt) minsize optsize {
511
; CHECK-LABEL: f0:

0 commit comments

Comments
 (0)