[all-commits] [llvm/llvm-project] 473ef1: [WebAssembly] Demote PHIs in catchswitch BB only (...
Heejin Ahn via All-commits
all-commits at lists.llvm.org
Tue Feb 13 13:43:32 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 473ef10b0fc93eeb2cbb3b2cf2f1b748eac6ddd9
https://github.com/llvm/llvm-project/commit/473ef10b0fc93eeb2cbb3b2cf2f1b748eac6ddd9
Author: Heejin Ahn <aheejin at gmail.com>
Date: 2024-02-13 (Tue, 13 Feb 2024)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
M llvm/lib/CodeGen/TargetPassConfig.cpp
M llvm/test/CodeGen/WebAssembly/wasm-eh-prepare.ll
Log Message:
-----------
[WebAssembly] Demote PHIs in catchswitch BB only (#81570)
`DemoteCatchSwitchPHIOnly` option in `WinEHPrepare` pass was added in
https://github.com/llvm/llvm-project/commit/99d60e0dabcf20f4db683da83cde905b7a1373de,
because Wasm EH uses `WinEHPrepare`, but it doesn't need to demote all
PHIs. PHIs in `catchswitch` BBs have to be removed (= demoted) because
`catchswitch`s are removed in ISel and `catchswitch` BBs are removed as
well, so they can't have other instructions.
But because Wasm EH doesn't use funclets, so PHIs in `catchpad` or
`cleanuppad` BBs don't need to be demoted. That was the reason
`DemoteCatchSwitchPHIOnly` option was added, in order not to demote more
instructions unnecessarily.
The problem is it should have been set to `true` for Wasm EH. (Its
default value is `false` for WinEH) And I mistakenly set it to `false`
and wasn't aware about this for more than 5 years. This was not the end
of the world; it just means we've been demoting more instructions than
we should, possibly huting code size. In practice I think it would've
had hardly any effect in real performance given that the occurrence of
PHIs in `catchpad` or `cleanuppad` BBs are not very frequent and many
people run other optimizers like Binaryen anyway.
More information about the All-commits
mailing list