[llvm] [JumpThreading] Use [BB->SuccIndx] to get probability when updating BB info. (PR #134585)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 8 00:09:38 PDT 2025
================
@@ -0,0 +1,42 @@
+; RUN: opt -debug-only=branch-prob -passes=jump-threading -S %s 2>&1 | FileCheck %s
+; REQUIRES: asserts
+
+; Make sure that edges' probabilities would not accumulate if they are
+; the same target BB.
+; Edge L0 -> 2 and L0 -> 3 's targets are both L2, but their respective
+; probability should not be L0 -> L2, because prob[L0->L2] equls to
+; prob[L0->2] + prob[L0->3]
+
+; CHECK: Computing probabilities for entry
+; CHECK: eraseBlock L0
+; CHECK-NOT: set edge L0 -> 0 successor probability to 0x12492492 / 0x80000000 = 14.29%
+; CHECK-NOT: set edge L0 -> 1 successor probability to 0x24924925 / 0x80000000 = 28.57%
+; CHECK-NOT: set edge L0 -> 2 successor probability to 0x24924925 / 0x80000000 = 28.57%
+; CHECK-NOT: set edge L0 -> 3 successor probability to 0x24924925 / 0x80000000 = 28.57%
----------------
nikic wrote:
I don't think these CHECK-NOTs are useful if you already CHECK the corresponding lines.
https://github.com/llvm/llvm-project/pull/134585
More information about the llvm-commits
mailing list