[llvm] [Cygwin] Cygwin X86ISelDAGToDAG.cpp (PR #76284)
εΎζζ Xu Chiheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 02:25:03 PST 2024
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/76284
>From 25497274dfddcaeddbd85ac5fe0da59dd6f256a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
<chiheng.xu at gmail.com>
Date: Thu, 4 Jan 2024 16:12:05 +0800
Subject: [PATCH 1/3] 1
---
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 77a997588c4fee..c478f1c3fd30c8 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2944,6 +2944,18 @@ bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) {
return false;
Imm = N;
+ if (Subtarget->isTargetWindowsCygwin() && Subtarget->is64Bit()) {
+ if (N->getOpcode() != ISD::TargetGlobalAddress)
+ return TM.getCodeModel() == CodeModel::Small;
+
+ std::optional<ConstantRange> CR =
+ cast<GlobalAddressSDNode>(N)->getGlobal()->getAbsoluteSymbolRange();
+ if (!CR)
+ return TM.getCodeModel() == CodeModel::Small;
+
+ return CR->getUnsignedMax().ult(1ull << 32);
+ }
+
// Small/medium code model can reference non-TargetGlobalAddress objects with
// 32 bit constants.
if (N->getOpcode() != ISD::TargetGlobalAddress) {
>From 88f721e19b59be2881fbc85c75daa47559ef508d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
<chiheng.xu at gmail.com>
Date: Thu, 4 Jan 2024 18:18:50 +0800
Subject: [PATCH 2/3] 1
---
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 24 ++++++------------------
1 file changed, 6 insertions(+), 18 deletions(-)
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index c478f1c3fd30c8..66acb07f0a2826 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2944,30 +2944,18 @@ bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) {
return false;
Imm = N;
- if (Subtarget->isTargetWindowsCygwin() && Subtarget->is64Bit()) {
- if (N->getOpcode() != ISD::TargetGlobalAddress)
- return TM.getCodeModel() == CodeModel::Small;
-
- std::optional<ConstantRange> CR =
- cast<GlobalAddressSDNode>(N)->getGlobal()->getAbsoluteSymbolRange();
- if (!CR)
- return TM.getCodeModel() == CodeModel::Small;
-
- return CR->getUnsignedMax().ult(1ull << 32);
- }
-
// Small/medium code model can reference non-TargetGlobalAddress objects with
// 32 bit constants.
if (N->getOpcode() != ISD::TargetGlobalAddress) {
return TM.getCodeModel() == CodeModel::Small ||
- TM.getCodeModel() == CodeModel::Medium;
+ (!(Subtarget->isTargetWindowsCygwin() && Subtarget->is64Bit()) && TM.getCodeModel() == CodeModel::Medium );
}
+ std::optional<ConstantRange> CR =
+ cast<GlobalAddressSDNode>(N)->getGlobal()->getAbsoluteSymbolRange();
+ if (!CR)
+ return TM.getCodeModel() == CodeModel::Small;
- const GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal();
- if (std::optional<ConstantRange> CR = GV->getAbsoluteSymbolRange())
- return CR->getUnsignedMax().ult(1ull << 32);
-
- return !TM.isLargeGlobalValue(GV);
+ return CR->getUnsignedMax().ult(1ull << 32);
}
bool X86DAGToDAGISel::selectLEA64_32Addr(SDValue N, SDValue &Base,
>From aa5679e04a344f20ece425b97f5ea51300bde16c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
<chiheng.xu at gmail.com>
Date: Thu, 4 Jan 2024 18:24:30 +0800
Subject: [PATCH 3/3] 1
---
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 66acb07f0a2826..0384e541ad2c07 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2948,7 +2948,8 @@ bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) {
// 32 bit constants.
if (N->getOpcode() != ISD::TargetGlobalAddress) {
return TM.getCodeModel() == CodeModel::Small ||
- (!(Subtarget->isTargetWindowsCygwin() && Subtarget->is64Bit()) && TM.getCodeModel() == CodeModel::Medium );
+ (!(Subtarget->isTargetWindowsCygwin() && Subtarget->is64Bit()) &&
+ TM.getCodeModel() == CodeModel::Medium);
}
std::optional<ConstantRange> CR =
cast<GlobalAddressSDNode>(N)->getGlobal()->getAbsoluteSymbolRange();
More information about the llvm-commits
mailing list