[llvm] [BranchFolding][SEH] Add test to track SEH CFG optimization (PR #77598)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 05:07:30 PST 2024
https://github.com/HaohaiWen created https://github.com/llvm/llvm-project/pull/77598
This test tracks BranchFolding pass which removes fall through jump and
leaves landing-pad to be machine basic block of no predecessors. It
would raise bug as introduced in #77441.
>From 80a650763278061630e6ff5635bbc3a2dacc093e Mon Sep 17 00:00:00 2001
From: Haohai Wen <haohai.wen at intel.com>
Date: Wed, 10 Jan 2024 16:09:00 +0800
Subject: [PATCH] [BranchFolding][SEH] Add test to track SEH CFG optimization
This test tracks BranchFolding pass which removes fall through jump and
leaves landing-pad to be machine basic block of no predecessors. It
would raise bug as introduced in #77441.
---
.../X86/branchfolding-landingpad-cfg.mir | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 llvm/test/CodeGen/X86/branchfolding-landingpad-cfg.mir
diff --git a/llvm/test/CodeGen/X86/branchfolding-landingpad-cfg.mir b/llvm/test/CodeGen/X86/branchfolding-landingpad-cfg.mir
new file mode 100644
index 00000000000000..a494701c2a3997
--- /dev/null
+++ b/llvm/test/CodeGen/X86/branchfolding-landingpad-cfg.mir
@@ -0,0 +1,49 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
+# RUN: llc -mtriple=x86_64-pc-windows-msvc -run-pass=branch-folder -o - %s | FileCheck %s
+---
+name: main
+body: |
+ ; CHECK-LABEL: name: main
+ ; CHECK: bb.0:
+ ; CHECK-NEXT: successors: %bb.1(0x7ffff800), %bb.3(0x00000800)
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.1:
+ ; CHECK-NEXT: RET 0
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.2 (machine-block-address-taken, landing-pad, ehfunclet-entry):
+ ; CHECK-NEXT: successors: %bb.3(0x80000000)
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: CLEANUPRET
+ ; CHECK-NEXT: {{ $}}
+ ; CHECK-NEXT: bb.3 (landing-pad, ehfunclet-entry):
+ ; CHECK-NEXT: CLEANUPRET
+ bb.0:
+ successors: %bb.1(0x7ffff800), %bb.5(0x00000800)
+ JMP_1 %bb.1
+
+ bb.1:
+ successors: %bb.2(0x7ffff800), %bb.4(0x00000800)
+
+ JMP_1 %bb.2
+
+ bb.2:
+ successors: %bb.3(0x7ffff800), %bb.4(0x00000800)
+
+ JMP_1 %bb.3
+
+ bb.3:
+ successors: %bb.6(0x7ffff800)
+
+ JMP_1 %bb.6
+
+ bb.4 (machine-block-address-taken, landing-pad, ehfunclet-entry):
+ successors: %bb.5(0x80000000)
+ CLEANUPRET
+
+ bb.5 (landing-pad, ehfunclet-entry):
+ CLEANUPRET
+
+ bb.6:
+ RET 0
+...
More information about the llvm-commits
mailing list