[llvm] [Cygwin] Cygwin X86ISelDAGToDAG.cpp (PR #76284)
εΎζζ Xu Chiheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 00:13:00 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
---
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) {
More information about the llvm-commits
mailing list