[llvm] [ARM] Ignore `ANNOTATION_LABEL` node in scheduler (PR #190499)

Trung Nguyen via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 4 18:54:08 PDT 2026


https://github.com/trungnt2910 created https://github.com/llvm/llvm-project/pull/190499

This fixes a crash in `clang` for `armv7` targets when optimizations are enabled.

Fixes #190497

>From 2311f8a417d46ded2aa6aef3149022c6afc7c0ea Mon Sep 17 00:00:00 2001
From: Trung Nguyen <trungnt282910 at gmail.com>
Date: Sun, 5 Apr 2026 11:48:43 +1000
Subject: [PATCH] [ARM] Ignore `ANNOTATION_LABEL` node in scheduler

This fixes a crash in `clang` for `armv7` targets when optimizations are
enabled.

Fixes #190497
---
 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp |  1 +
 llvm/test/CodeGen/ARM/pr190497.ll                   | 13 +++++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 llvm/test/CodeGen/ARM/pr190497.ll

diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index 12fc26d949581..bc747d250afae 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -712,6 +712,7 @@ void ScheduleDAGRRList::EmitNode(SUnit *SU) {
   case ISD::CopyToReg:
   case ISD::CopyFromReg:
   case ISD::EH_LABEL:
+  case ISD::ANNOTATION_LABEL:
     // Noops don't affect the scoreboard state. Copies are likely to be
     // removed.
     return;
diff --git a/llvm/test/CodeGen/ARM/pr190497.ll b/llvm/test/CodeGen/ARM/pr190497.ll
new file mode 100644
index 0000000000000..8d852819a09de
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/pr190497.ll
@@ -0,0 +1,13 @@
+; RUN: llc -mtriple=thumbv7-windows-msvc -O1 < %s
+
+; No check in a crash test
+
+declare void @llvm.codeview.annotation(metadata)
+
+define void @foo() {
+entry:
+  call void @llvm.codeview.annotation(metadata !0)
+  ret void
+}
+
+!0 = !{!"annotation"}



More information about the llvm-commits mailing list