[clang] clang: Stop marking M68k and MSP430 interrupt handlers noinline (PR #245859)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 24 19:08:55 PST 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/245859

There seems to be no rationale for marking these as noinline, and no
other target does this. This helps avoid another source of IR
attributes reading existing IR attributes.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>

>From ab2b890a5470488cac2370e96d06ad7332a46d32 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 24 Nov 2026 19:23:12 -0500
Subject: [PATCH] clang: Stop marking M68k and MSP430 interrupt handlers
 noinline

There seems to be no rationale for marking these as noinline, and no
other target does this. This helps avoid another source of IR
attributes reading existing IR attributes.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
---
 clang/lib/CodeGen/Targets/M68k.cpp   | 5 +----
 clang/lib/CodeGen/Targets/MSP430.cpp | 1 -
 clang/test/CodeGen/attr-m68k.c       | 7 +++++++
 clang/test/CodeGen/attr-msp430.c     | 3 +++
 4 files changed, 11 insertions(+), 5 deletions(-)
 create mode 100644 clang/test/CodeGen/attr-m68k.c

diff --git a/clang/lib/CodeGen/Targets/M68k.cpp b/clang/lib/CodeGen/Targets/M68k.cpp
index 120022105f3412..9b4d52f0940e6b 100644
--- a/clang/lib/CodeGen/Targets/M68k.cpp
+++ b/clang/lib/CodeGen/Targets/M68k.cpp
@@ -38,10 +38,7 @@ void M68kTargetCodeGenInfo::setTargetAttributes(
       // Step 1: Set ISR calling convention.
       F->setCallingConv(llvm::CallingConv::M68k_INTR);
 
-      // Step 2: Add attributes goodness.
-      F->addFnAttr(llvm::Attribute::NoInline);
-
-      // Step 3: Emit ISR vector alias.
+      // Step 2: Emit ISR vector alias.
       unsigned Num = attr->getNumber() / 2;
       llvm::GlobalAlias::create(llvm::Function::ExternalLinkage,
                                 "__isr_" + Twine(Num), F);
diff --git a/clang/lib/CodeGen/Targets/MSP430.cpp b/clang/lib/CodeGen/Targets/MSP430.cpp
index 523165c1175020..4ad5607b2c1d31 100644
--- a/clang/lib/CodeGen/Targets/MSP430.cpp
+++ b/clang/lib/CodeGen/Targets/MSP430.cpp
@@ -87,7 +87,6 @@ void MSP430TargetCodeGenInfo::setTargetAttributes(
     F->setCallingConv(llvm::CallingConv::MSP430_INTR);
 
     // Step 2: Add attributes goodness.
-    F->addFnAttr(llvm::Attribute::NoInline);
     F->addFnAttr("interrupt", llvm::utostr(InterruptAttr->getNumber()));
   }
 }
diff --git a/clang/test/CodeGen/attr-m68k.c b/clang/test/CodeGen/attr-m68k.c
new file mode 100644
index 00000000000000..36f02593864d04
--- /dev/null
+++ b/clang/test/CodeGen/attr-m68k.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -triple m68k-unknown-linux -O2 -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s
+
+__attribute__((interrupt(4))) void isr(void) {}
+
+// CHECK: @__isr_2 = alias void (), ptr @isr
+// CHECK: define{{.*}} cc101 void @isr() #0
+// CHECK: attributes #0 = { nounwind {{.*}}}
diff --git a/clang/test/CodeGen/attr-msp430.c b/clang/test/CodeGen/attr-msp430.c
index cbc7599b96bfc0..6a955a399ef049 100644
--- a/clang/test/CodeGen/attr-msp430.c
+++ b/clang/test/CodeGen/attr-msp430.c
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple msp430-unknown-unknown -emit-llvm < %s| FileCheck %s
+// RUN: %clang_cc1 -triple msp430-unknown-unknown -O2 -disable-llvm-passes -emit-llvm < %s | FileCheck --check-prefix=OPT %s
 
 __attribute__((interrupt(1))) void foo(void) {}
 // CHECK: @llvm.compiler.used =
@@ -8,3 +9,5 @@ __attribute__((interrupt(1))) void foo(void) {}
 // CHECK: attributes #0
 // CHECK-SAME: noinline
 // CHECK-SAME: "interrupt"="1"
+
+// OPT: attributes #0 = { nounwind "interrupt"="1" {{.*}}}



More information about the cfe-commits mailing list