Skip to content

[WebAssembly] Remove unnecessary code after #187484 (NFC)#194188

Merged
aheejin merged 2 commits intollvm:mainfrom
aheejin:remove_code_after_pr187484
Apr 28, 2026
Merged

[WebAssembly] Remove unnecessary code after #187484 (NFC)#194188
aheejin merged 2 commits intollvm:mainfrom
aheejin:remove_code_after_pr187484

Conversation

@aheejin
Copy link
Copy Markdown
Member

@aheejin aheejin commented Apr 25, 2026

This code was written under the assumption that
fixCallUnwindMismatches runs before fixCatchUnwindMismatches, but since #187484 it's not true anymore.

This code was written under the assumption that
`fixCallUnwindMismatches` runs before `fixCatchUnwindMismatches`, but
since llvm#187484 it's not true anymore.
@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Apr 25, 2026

@llvm/pr-subscribers-backend-webassembly

Author: Heejin Ahn (aheejin)

Changes

This code was written under the assumption that
fixCallUnwindMismatches runs before fixCatchUnwindMismatches, but since #187484 it's not true anymore.


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

1 Files Affected:

  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp (+3-15)
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
index 540388cb17b68..5680cbc60ff8f 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp
@@ -2141,25 +2141,13 @@ bool WebAssemblyCFGStackify::fixCatchUnwindMismatches(MachineFunction &MF) {
 
   for (auto &MBB : reverse(MF)) {
     for (auto &MI : reverse(MBB)) {
-      if (MI.getOpcode() == WebAssembly::TRY)
+      if (WebAssembly::isTry(MI.getOpcode())) {
         EHPadStack.pop_back();
-      else if (MI.getOpcode() == WebAssembly::TRY_TABLE) {
-        // We want to exclude try_tables created in fixCallUnwindMismatches.
-        // Check if the try_table's unwind destination matches the EH pad stack
-        // top. If it is created in fixCallUnwindMismatches, it wouldn't.
-        if (getSingleUnwindDest(&MI) == EHPadStack.back())
-          EHPadStack.pop_back();
-      } else if (MI.getOpcode() == WebAssembly::DELEGATE)
+      } else if (MI.getOpcode() == WebAssembly::DELEGATE) {
         EHPadStack.push_back(&MBB);
-      else if (WebAssembly::isCatch(MI.getOpcode())) {
+      } else if (WebAssembly::isCatch(MI.getOpcode())) {
         auto *EHPad = &MBB;
 
-        // If the BB has a catch pseudo instruction but is not marked as an EH
-        // pad, it's a trampoline BB we created in fixCallUnwindMismatches. Skip
-        // it.
-        if (!EHPad->isEHPad())
-          continue;
-
         // catch_all always catches an exception, so we don't need to do
         // anything
         if (WebAssembly::isCatchAll(MI.getOpcode())) {

for (auto &MBB : reverse(MF)) {
for (auto &MI : reverse(MBB)) {
if (MI.getOpcode() == WebAssembly::TRY)
if (WebAssembly::isTry(MI.getOpcode())) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added braces for consistency.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 25, 2026

🐧 Linux x64 Test Results

  • 194289 tests passed
  • 5240 tests skipped

✅ The build succeeded and all tests passed.

@aheejin aheejin merged commit c355081 into llvm:main Apr 28, 2026
10 checks passed
@aheejin aheejin deleted the remove_code_after_pr187484 branch April 28, 2026 18:36
kirthana14m pushed a commit to ROCm/llvm-project that referenced this pull request Apr 30, 2026
…94188)

This code was written under the assumption that
`fixCallUnwindMismatches` runs before `fixCatchUnwindMismatches`, but
since llvm#187484 it's not true anymore.
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.

3 participants