[all-commits] [llvm/llvm-project] 7091a7: [GlobalISel][Legalizer] Don't use eraseFromParentA...

Amara Emerson via All-commits all-commits at lists.llvm.org
Mon Sep 20 23:35:03 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7091a7f781c9889f109b6be7b07822bfd91094dc
      https://github.com/llvm/llvm-project/commit/7091a7f781c9889f109b6be7b07822bfd91094dc
  Author: Amara Emerson <amara at apple.com>
  Date:   2021-09-20 (Mon, 20 Sep 2021)

  Changed paths:
    M llvm/lib/CodeGen/GlobalISel/Utils.cpp
    M llvm/test/CodeGen/AMDGPU/GlobalISel/bug-legalization-artifact-combiner-dead-def.mir

  Log Message:
  -----------
  [GlobalISel][Legalizer] Don't use eraseFromParentAndMarkDBGValuesForRemoval() for some artifacts.

For artifacts excluding G_TRUNC/G_SEXT, which have IR counterparts, we don't
seem to have debug users of defs. However, in the legalizer we're always calling
MachineInstr::eraseFromParentAndMarkDBGValuesForRemoval() which is expensive.
In some rare cases, this contributes significantly to unreasonably long compile
times when we have lots of artifact combiner activity.

To verify this, I added asserts to that function when it actually replaced a debug
use operand with undef for these artifacts. On CTMark with both -O0 and -Os and
debug info enabled, I didn't see a single case where it triggered.

In my measurements I saw around a 0.5% geomean compile-time improvement on -g -O0
for AArch64 with this change.

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




More information about the All-commits mailing list