[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


================
@@ -697,6 +738,34 @@ void WebAssemblyAsmPrinter::emitInstruction(const MachineInstr *MI) {
     WebAssemblyMCInstLower MCInstLowering(OutContext, *this);
     MCInst TmpInst;
     MCInstLowering.lower(MI, TmpInst);
+    if (Subtarget->hasBranchHinting() &&
+        MI->getOpcode() == WebAssembly::BR_IF && MFI &&
+        MFI->BranchProbabilities.contains(MI)) {
----------------
aengelke wrote:

Avoid duplicate hash table (BranchProbabilities) lookup. Why is the check for BR_IF duplicated here? The lookup alone should suffice to determine whether an instruction has a branch hint attached.

https://github.com/llvm/llvm-project/pull/146230


More information about the llvm-commits mailing list