[llvm] [Cygwin] Cygwin X86ISelDAGToDAG.cpp (PR #76284)
εΎζζ Xu Chiheng via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 23 10:48:21 PST 2023
https://github.com/xu-chiheng updated https://github.com/llvm/llvm-project/pull/76284
>From ed11ebba4b3e714feda1d6decfa355d32dabff78 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: Sun, 24 Dec 2023 02:47:50 +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 7ec59c74f5f58c..8eb4e4ac44cc93 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2947,6 +2947,18 @@ bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) {
return false;
Imm = N;
+ if (Subtarget->isTargetWindowsCygwin() && Subtarget->isTargetWin64()) {
+ 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