[all-commits] [llvm/llvm-project] 2480a3: [AMDGPU] SILowerControlFlow::optimizeEndCF should ...

alex-t via All-commits all-commits at lists.llvm.org
Mon Sep 7 09:38:03 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2480a31e5d69a5c2e8e900be3a7f706d77f5a5cc
      https://github.com/llvm/llvm-project/commit/2480a31e5d69a5c2e8e900be3a7f706d77f5a5cc
  Author: alex-t <alexander.timofeev at amd.com>
  Date:   2020-09-07 (Mon, 07 Sep 2020)

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

  Log Message:
  -----------
  [AMDGPU] SILowerControlFlow::optimizeEndCF should remove empty basic block

optimizeEndCF removes EXEC restoring instruction case this instruction is the only one except the branch to the single successor and that successor contains EXEC mask restoring instruction that was lowered from END_CF belonging to IF_ELSE.
As a result of such optimization we get the basic block with the only one instruction that is a branch to the single successor.
In case the control flow can reach such an empty block from S_CBRANCH_EXEZ/EXECNZ it might happen that spill/reload instructions that were inserted later by register allocator are placed under exec == 0 condition and never execute.
Removing empty block solves the problem.

This change require further work to re-implement LIS updates. Recently, LIS is always nullptr in this pass. To enable it we need another patch to fix many places across the codegen.

Reviewed By: rampitec

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




More information about the All-commits mailing list