Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BranchFolding][SEH] Add test to track SEH CFG optimization #77598

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

HaohaiWen
Copy link
Contributor

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.

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 llvm#77441.
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 10, 2024

@llvm/pr-subscribers-backend-x86

Author: None (HaohaiWen)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/77598.diff

1 Files Affected:

  • (added) llvm/test/CodeGen/X86/branchfolding-landingpad-cfg.mir (+49)
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
+...

@@ -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
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should attach IR in the test? Besides, without IR, how can we enable async exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is just for branch-folder. I hacked the entire MIR just like llvm/test/CodeGen/X86/branchfolding-ehpad.mir. We don't care what IR looks like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See fix patch #77608

Copy link
Contributor

@phoebewang phoebewang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@HaohaiWen HaohaiWen merged commit 9bde5be into llvm:main Jan 10, 2024
5 checks passed
@HaohaiWen HaohaiWen deleted the bf-test branch January 10, 2024 14:34
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
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 llvm#77441.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants