[llvm] c6ec955 - [TargetInstrInfo] Disable size verification for EH_LABEL (#223641)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 15 04:02:12 PDT 2026
Author: Nikita Popov
Date: 2026-09-15T11:02:07Z
New Revision: c6ec955ea331a089169fd2ffb8b08af88c0cb350
URL: https://github.com/llvm/llvm-project/commit/c6ec955ea331a089169fd2ffb8b08af88c0cb350
DIFF: https://github.com/llvm/llvm-project/commit/c6ec955ea331a089169fd2ffb8b08af88c0cb350.diff
LOG: [TargetInstrInfo] Disable size verification for EH_LABEL (#223641)
EH_LABEL may produce a nop if using async exceptions and followed
by a trapping instruction.
Suppress the verification error until the incorrect size reporting
is fixed.
Added:
llvm/test/CodeGen/AArch64/wineh-async-eh-pad-instr-size.ll
Modified:
llvm/include/llvm/CodeGen/TargetInstrInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
index eff16348a8bc0..260cf794c731f 100644
--- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -450,6 +450,9 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
/// getInstSizeInBytes() should be verified.
virtual InstSizeVerifyMode
getInstSizeVerifyMode(const MachineInstr &MI) const {
+ // FIXME: Incorrect size reported if nop inserted for async exceptions.
+ if (MI.getOpcode() == TargetOpcode::EH_LABEL)
+ return InstSizeVerifyMode::NoVerify;
return InstSizeVerifyMode::AllowOverEstimate;
}
diff --git a/llvm/test/CodeGen/AArch64/wineh-async-eh-pad-instr-size.ll b/llvm/test/CodeGen/AArch64/wineh-async-eh-pad-instr-size.ll
new file mode 100644
index 0000000000000..d6eca0b3a6a99
--- /dev/null
+++ b/llvm/test/CodeGen/AArch64/wineh-async-eh-pad-instr-size.ll
@@ -0,0 +1,34 @@
+; RUN: llc -mtriple=aarch64-unknown-windows-msvc -filetype=obj < %s | llvm-objdump -d - | FileCheck %s
+
+; Check that there is no instruction size verification error when a nop has
+; to be inserted for an EH_LABEL.
+
+; CHECK: nop
+define void @test() personality ptr @__C_specific_handler {
+entry:
+ %a = alloca i32, align 4
+ invoke void @llvm.seh.try.begin()
+ to label %invoke.cont unwind label %catch.dispatch
+
+invoke.cont:
+ %a.val = load volatile i32, ptr %a, align 4
+ invoke void @llvm.seh.try.end()
+ to label %exit unwind label %catch.dispatch
+
+catch.dispatch:
+ %cs = catchswitch within none [label %__except.ret] unwind to caller
+
+__except.ret:
+ %cp = catchpad within %cs [ptr @filt]
+ catchret from %cp to label %exit
+
+exit:
+ ret void
+}
+
+declare i32 @filt(ptr %exception_pointers, ptr %frame_pointer)
+
+declare i32 @__C_specific_handler(...)
+
+!llvm.module.flags = !{!1}
+!1 = !{i32 2, !"eh-asynch", i32 1}
More information about the llvm-commits
mailing list