[all-commits] [llvm/llvm-project] 8d5b69: extending code layout alg

spupyrev via All-commits all-commits at lists.llvm.org
Wed Aug 24 09:41:59 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d5b694da172c97f4fc10d5586830fea1b486037
      https://github.com/llvm/llvm-project/commit/8d5b694da172c97f4fc10d5586830fea1b486037
  Author: spupyrev <spupyrev at fb.com>
  Date:   2022-08-24 (Wed, 24 Aug 2022)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/CodeLayout.h
    M llvm/lib/CodeGen/MachineBlockPlacement.cpp
    M llvm/lib/Transforms/Utils/CodeLayout.cpp
    M llvm/test/CodeGen/X86/code_placement_ext_tsp_large.ll

  Log Message:
  -----------
  extending code layout alg

The diff modifies ext-tsp code layout algorithm in the following ways:
(i) fixes merging of cold block chains (this is a port of D129397);
(ii) adjusts the cost model utilized for optimization;
(iii) adjusts some APIs so that the implementation can be used in BOLT; this is
a prerequisite for D129895.

The only non-trivial change is (ii). Here we introduce different weights for
conditional and unconditional branches in the cost model. Based on the new model
it is slightly more important to increase the number of "fall-through
unconditional" jumps, which makes sense, as placing two blocks with an
unconditional jump next to each other reduces the number of jump instructions in
the generated code. Experimentally, this makes a mild impact on the performance;
I've seen up to 0.2%-0.3% perf win on some benchmarks.

Reviewed By: hoy

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




More information about the All-commits mailing list