[llvm] [InstCombine] Add test to track BPI when condition was inverted (PR #86469)

Haohai Wen via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 00:42:15 PDT 2024


================
@@ -0,0 +1,36 @@
+; RUN: opt < %s -passes="print<branch-prob>,instcombine,print<branch-prob>" -S 2>&1 | FileCheck %s
+
+; CHECK:      Printing analysis 'Branch Probability Analysis' for function 'invert_cond':
+; CHECK-NEXT: ---- Branch Probabilities ----
+; CHECK-NEXT:   edge %entry -> %bb1 probability is 0x06186186 / 0x80000000 = 4.76%
+; CHECK-NEXT:   edge %entry -> %bb2 probability is 0x79e79e7a / 0x80000000 = 95.24% [HOT edge]
+; CHECK-NEXT: Printing analysis 'Branch Probability Analysis' for function 'invert_cond':
+; CHECK-NEXT: ---- Branch Probabilities ----
+; CHECK-NEXT:   edge %entry -> %bb2 probability is 0x06186186 / 0x80000000 = 4.76%
----------------
HaohaiWen wrote:

bb2 probability is obvious wrong after instcombine in this case

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


More information about the llvm-commits mailing list