[clang] clang: Stop marking M68k and MSP430 interrupt handlers noinline (PR #245859)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 24 19:09:58 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
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@<!-- -->anthropic.com>
---
Full diff: https://github.com/llvm/llvm-project/pull/245859.diff
4 Files Affected:
- (modified) clang/lib/CodeGen/Targets/M68k.cpp (+1-4)
- (modified) clang/lib/CodeGen/Targets/MSP430.cpp (-1)
- (added) clang/test/CodeGen/attr-m68k.c (+7)
- (modified) clang/test/CodeGen/attr-msp430.c (+3)
``````````diff
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" {{.*}}}
``````````
</details>
https://github.com/llvm/llvm-project/pull/245859
More information about the cfe-commits
mailing list