SuccessChanges

Summary

  1. [Sink] Optimize/simplify sink candidate finding with nearest common dominator (details)
Commit f2284e3405d87143b2478f28b8045bef84953c91 by i
[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.
The file was modifiedllvm/test/CodeGen/AMDGPU/sdiv64.ll (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/srem64.ll (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/si-annotate-cf.ll (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/urem64.ll (diff)
The file was modifiedllvm/lib/Transforms/Scalar/Sink.cpp (diff)
The file was modifiedllvm/test/CodeGen/AMDGPU/setcc.ll (diff)