[all-commits] [llvm/llvm-project] f2284e: [Sink] Optimize/simplify sink candidate finding wi...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Aug 30 22:52:14 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f2284e3405d87143b2478f28b8045bef84953c91
      https://github.com/llvm/llvm-project/commit/f2284e3405d87143b2478f28b8045bef84953c91
  Author: Fangrui Song <i at maskray.me>
  Date:   2020-08-30 (Sun, 30 Aug 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/Sink.cpp
    M llvm/test/CodeGen/AMDGPU/sdiv64.ll
    M llvm/test/CodeGen/AMDGPU/setcc.ll
    M llvm/test/CodeGen/AMDGPU/si-annotate-cf.ll
    M llvm/test/CodeGen/AMDGPU/srem64.ll
    M llvm/test/CodeGen/AMDGPU/urem64.ll

  Log Message:
  -----------
  [Sink] Optimize/simplify sink candidate finding with nearest common dominator

For an instruction in the basic block BB, SinkingPass enumerates basic blocks
dominated by BB and BB's successors. For each enumerated basic block,
SinkingPass uses `AllUsesDominatedByBlock` to check whether the basic
block dominates all of the instruction's users. This is inefficient.

Use the nearest common dominator of all users to avoid enumerating the
candidate. The nearest common dominator may be in a parent loop which is
not beneficial. In that case, find the ancestors in the dominator tree.

In the case that the instruction has no user, with this change we will
not perform unnecessary move. This causes some amdgpu test changes.

A stage-2 x86-64 clang is a byte identical with this change.




More information about the All-commits mailing list