[llvm-branch-commits] [llvm] 370eb8d - [Mips][FastISel] Also add low part when materializing private functions (#229717)
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Oct 12 07:55:41 PDT 2026
Author: Alex Rønne Petersen
Date: 2026-10-12T16:55:01+02:00
New Revision: 370eb8ddac247231554bb863e7c067c619d48b16
URL: https://github.com/llvm/llvm-project/commit/370eb8ddac247231554bb863e7c067c619d48b16
DIFF: https://github.com/llvm/llvm-project/commit/370eb8ddac247231554bb863e7c067c619d48b16.diff
LOG: [Mips][FastISel] Also add low part when materializing private functions (#229717)
I have no idea why the code was explicitly written to exclude private
functions; it seems obviously incorrect to me.
(cherry picked from commit 85b4fbfecb65cd1f5a06e707e7ec0fc2de562407)
Added:
llvm/test/CodeGen/Mips/Fast-ISel/private-fn.ll
Modified:
llvm/lib/Target/Mips/MipsFastISel.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Mips/MipsFastISel.cpp b/llvm/lib/Target/Mips/MipsFastISel.cpp
index 7ef770184e78e..bc5885b2ba3c3 100644
--- a/llvm/lib/Target/Mips/MipsFastISel.cpp
+++ b/llvm/lib/Target/Mips/MipsFastISel.cpp
@@ -420,8 +420,7 @@ unsigned MipsFastISel::materializeGV(const GlobalValue *GV, MVT VT) {
emitInst(Mips::LW, DestReg)
.addReg(MFI->getGlobalBaseReg(*MF))
.addGlobalAddress(GV, 0, MipsII::MO_GOT);
- if ((GV->hasInternalLinkage() ||
- (GV->hasLocalLinkage() && !isa<Function>(GV)))) {
+ if (GV->hasLocalLinkage()) {
Register TempReg = createResultReg(RC);
emitInst(Mips::ADDiu, TempReg)
.addReg(DestReg)
diff --git a/llvm/test/CodeGen/Mips/Fast-ISel/private-fn.ll b/llvm/test/CodeGen/Mips/Fast-ISel/private-fn.ll
new file mode 100644
index 0000000000000..589deeb7ef0e3
--- /dev/null
+++ b/llvm/test/CodeGen/Mips/Fast-ISel/private-fn.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mtriple=mipsel -relocation-model=pic -O0 -fast-isel-abort=3 < %s | FileCheck %s
+
+define private void @priv() {
+ ret void
+}
+
+define ptr @addr() {
+; CHECK-LABEL: addr:
+; CHECK: lw $[[R:[0-9]+]], %got($priv)(${{[0-9]+}})
+; CHECK-NEXT: addiu ${{[0-9]+}}, $[[R]], %lo($priv)
+ ret ptr @priv
+}
+
+define void @call() {
+; CHECK-LABEL: call:
+; CHECK: lw $[[R:[0-9]+]], %got($priv)(${{[0-9]+}})
+; CHECK-NEXT: addiu $25, $[[R]], %lo($priv)
+; CHECK-NEXT: .reloc {{.*}}, R_MIPS_JALR, priv
+ call void @priv()
+ ret void
+}
More information about the llvm-branch-commits
mailing list