[all-commits] [llvm/llvm-project] 687e4a: [BOLT] CMOVConversion pass

Amir Ayupov via All-commits all-commits at lists.llvm.org
Tue Mar 8 10:44:52 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 687e4af1c05ae36af88900d41150e260d8f273c0
      https://github.com/llvm/llvm-project/commit/687e4af1c05ae36af88900d41150e260d8f273c0
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M bolt/include/bolt/Core/MCPlusBuilder.h
    A bolt/include/bolt/Passes/CMOVConversion.h
    A bolt/lib/Passes/CMOVConversion.cpp
    M bolt/lib/Passes/CMakeLists.txt
    M bolt/lib/Rewrite/BinaryPassManager.cpp
    M bolt/lib/Target/X86/X86MCPlusBuilder.cpp
    A bolt/test/X86/cmov-conversion.s

  Log Message:
  -----------
  [BOLT] CMOVConversion pass

Convert simple hammocks into cmov based on misprediction rate.

Test Plan:
- Assembly test: `cmov-conversion.s`
- Testing on a binary:
  # Bootstrap clang with `-x86-cmov-converter-force-all` and `-Wl,--emit-relocs`
  (Release build)
  # Collect perf.data:

    - `clang++ <opts> bolt/lib/Core/BinaryFunction.cpp -E > bf.cpp`
    - `perf record -e cycles:u -j any,u -- clang-15 bf.cpp -O2 -std=c++14 -c -o bf.o`
  # Optimize clang-15 with and w/o -cmov-conversion:
    - `llvm-bolt clang-15 -p perf.data -o clang-15.bolt`
    - `llvm-bolt clang-15 -p perf.data -cmov-conversion -o clang-15.bolt.cmovconv`
  # Run perf experiment:
    - test: `clang-15.bolt.cmovconv`,
    - control: `clang-15.bolt`,
    - workload (clang options): `bf.cpp -O2 -std=c++14 -c -o bf.o`
Results:
```
  task-clock [delta: -360.21 ± 356.75, delta(%): -1.7760 ± 1.7589, p-value: 0.047951, balance: -6]
  instructions  [delta: 44061118 ± 13246382, delta(%): 0.0690 ± 0.0207, p-value: 0.000001, balance: 50]
  icache-misses [delta: -5534468 ± 2779620, delta(%): -0.4331 ± 0.2175, p-value: 0.028014, balance: -28]
  branch-misses [delta: -1624270 ± 1113244, delta(%): -0.3456 ± 0.2368, p-value: 0.030300, balance: -22]
```

Reviewed By: rafauler

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




More information about the All-commits mailing list