[all-commits] [llvm/llvm-project] 12a324: [AMDGPU] Limit endcf-collapase to simple if

Stanislav Mekhanoshin via All-commits all-commits at lists.llvm.org
Tue Apr 7 10:27:31 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 12a324393d61a0ef602feeb9705ccb5b61563c27
      https://github.com/llvm/llvm-project/commit/12a324393d61a0ef602feeb9705ccb5b61563c27
  Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
  Date:   2020-04-07 (Tue, 07 Apr 2020)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
    M llvm/test/CodeGen/AMDGPU/collapse-endcf.mir

  Log Message:
  -----------
  [AMDGPU] Limit endcf-collapase to simple if

We can only collapse adjacent SI_END_CF if outer statement
belongs to a simple SI_IF, otherwise correct mask is not in the
register we expect, but is an argument of an S_XOR instruction.

Even if SI_IF is simple it might be lowered using S_XOR because
lowering is dependent on a basic block layout. It is not
considered simple if instruction consuming its output is
not an SI_END_CF. Since that SI_END_CF might have already been
lowered to an S_OR isSimpleIf() check may return false.

This situation is an opportunity for a further optimization
of SI_IF lowering, but that is a separate optimization. In the
meanwhile move SI_END_CF post the lowering when we already know
how the rest of the CFG was lowered since a non-simple SI_IF
case still needs to be handled.

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




More information about the All-commits mailing list