[all-commits] [llvm/llvm-project] 3b2256: [test] Make bt_order_by_weight in switch.ll more r...

aeubanks via All-commits all-commits at lists.llvm.org
Wed Oct 28 13:00:19 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b2256a41b062ff5e9dcf52a99b945cadf2388d1
      https://github.com/llvm/llvm-project/commit/3b2256a41b062ff5e9dcf52a99b945cadf2388d1
  Author: Arthur Eubanks <aeubanks at google.com>
  Date:   2020-10-28 (Wed, 28 Oct 2020)

  Changed paths:
    M llvm/test/CodeGen/X86/switch.ll

  Log Message:
  -----------
  [test] Make bt_order_by_weight in switch.ll more robust

    Branch weights are not represented internally linearly with the value in
    the IR. In its current state the test happened to pass, but the branch
    weights for 0,3,6 and 2,5,8,9 were not actually equal.

    $ opt -passes='print<branch-prob>'

    shows that the sum of the branch probabilities going to bb0 and bb2 were not the same.

    Printing analysis results of BPI for function 'bt_order_by_weight':
    ---- Branch Probabilities ----
      edge entry -> bb0 probability is 0x00000003 / 0x80000000 = 0.00%
      edge entry -> bb2 probability is 0x00000004 / 0x80000000 = 0.00%

    with this change:

    Printing analysis results of BPI for function 'bt_order_by_weight':
    ---- Branch Probabilities ----
      edge entry -> bb0 probability is 0x00000004 / 0x80000000 = 0.00%
      edge entry -> bb2 probability is 0x00000004 / 0x80000000 = 0.00%

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D90273




More information about the All-commits mailing list