[clang] [lld] [llvm] [LLVM][WebAssembly] Implement branch hinting proposal (PR #146230)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 29 04:39:51 PDT 2025
================
@@ -2562,8 +2565,22 @@ void WebAssemblyCFGStackify::rewriteDepthImmediates(MachineFunction &MF) {
MO = MachineOperand::CreateImm(getDelegateDepth(Stack, MO.getMBB()));
else if (MI.getOpcode() == WebAssembly::RETHROW)
MO = MachineOperand::CreateImm(getRethrowDepth(Stack, MO.getMBB()));
- else
+ else {
+ // this is the last place where we can easily calculate the branch
+ // probabilities. we do not emit scf-ifs, therefore only br_ifs have
+ // to be handled here.
+ if (MF.getSubtarget<WebAssemblySubtarget>().hasBranchHinting() &&
+ MI.getOpcode() == WebAssembly::BR_IF &&
----------------
aengelke wrote:
I would've expected a `case BR_IF` below, this seems to be the wrong place.
https://github.com/llvm/llvm-project/pull/146230
More information about the llvm-commits
mailing list