[llvm-dev] [GlobalISel] Simple improvement to CombinerHelper::dominates()

via llvm-dev llvm-dev at lists.llvm.org
Wed Jun 3 22:17:32 PDT 2020


I've improved pre/post indexing a fair bit on our target by simply adding a
third parameter to dominates() - the original MI:

    bool CombinerHelper::dominates(const MachineInstr &DefMI, const
MachineInstr &UseMI, const MachineInstr *OrigMI)

The Original MI is known to dominate all uses, due SSA form. Therefore, if
OrigMI is provided and shares the same parent as DefMI, true can be returned
without even consulting the dominator tree.

Further, if a PHI in the same block, true can also be returned for current
use cases. (Equivalent to if UseMI does not lie between OrigMI and DefMI, it
must be dominated).

These two changes allow many more loops to benefit from transformations,
currently prevented by their backward edges.

HTH.



More information about the llvm-dev mailing list