================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to