[llvm] [WebAssembly] Misc. fixes in CFGStackify (PR #107182)
Heejin Ahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 22:31:08 PDT 2024
================
@@ -359,21 +360,20 @@ void WebAssemblyCFGStackify::placeBlockMarker(MachineBasicBlock &MBB) {
TII.get(WebAssembly::BLOCK))
.addImm(int64_t(ReturnType));
- // Decide where in Header to put the END_BLOCK.
+ // Decide where in MBB to put the END_BLOCK.
BeforeSet.clear();
AfterSet.clear();
for (auto &MI : MBB) {
#ifndef NDEBUG
- // END_BLOCK should precede existing LOOP and TRY markers.
- if (MI.getOpcode() == WebAssembly::LOOP ||
- MI.getOpcode() == WebAssembly::TRY)
----------------
aheejin wrote:
We place `loop` markers first for the whole function, and then place `try`/`block` in one pass while we traverse BBs from top to bottom:
(Long ago we used to place `try` first and then `block`, but this turned out to be not working, so I changed it to a single pass: https://github.com/llvm/llvm-project/commit/44a5a4b10704b336700a94403103faaba6fa9729)
https://github.com/llvm/llvm-project/blob/6c607cfb2c2d8acd2b92d7ed8106ab1e4fc0d79d/llvm/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp#L1542-L1557
So there can't be a `try` marker in a BB that we are about to place an `end_block` at this point. The reason we had this code is, we used to place `try` for the whole function first, which cannot happen anymore.
https://github.com/llvm/llvm-project/pull/107182
More information about the llvm-commits
mailing list