[all-commits] [llvm/llvm-project] eef303: [DSE] Precommit test case for invalid elimination ...

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon Sep 14 04:07:33 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: eef30334d1daaddf8b4e465be7c0f4aa4f98e208
      https://github.com/llvm/llvm-project/commit/eef30334d1daaddf8b4e465be7c0f4aa4f98e208
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-09-14 (Mon, 14 Sep 2020)

  Changed paths:
    M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-loops.ll

  Log Message:
  -----------
  [DSE] Precommit test case for invalid elimination of store in loop.


  Commit: f715d81c9df3fb3e047a54899fc749f57c84aeb5
      https://github.com/llvm/llvm-project/commit/f715d81c9df3fb3e047a54899fc749f57c84aeb5
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2020-09-14 (Mon, 14 Sep 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    M llvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-loops.ll

  Log Message:
  -----------
  [DSE] Only eliminate candidates that always store the same loc.

AliasAnalysis/MemoryLocation does not account for loops. Two
MemoryLocation can be must-overwrite, even if the first one writes
multiple locations in a loop.

This patch prevents removing such stores, by only considering candidates
that are known to be loop invariant, or executed in the same BB.

Currently the invariant check is quite conservative and only considers
Alloca and Alloca-like instructions and arguments as invariant base pointers.
It also considers GEPs with all constant indices and invariant bases as
invariant.

This can be improved in the future, but the current implementation has
only minor impact on the total number of stores eliminated (25903 vs
26047 for the baseline). There are some 2-10% swings for some individual
benchmarks. In roughly half of the cases, the number of stores removed
increases actually, because we skip candidates that are unlikely to be
valid candidates early.


Compare: https://github.com/llvm/llvm-project/compare/dd519bf0b074...f715d81c9df3


More information about the All-commits mailing list