[all-commits] [llvm/llvm-project] db05f2: [Scalarizer] Centralize instruction DCE

Roman Lebedev via All-commits all-commits at lists.llvm.org
Mon Jul 6 15:13:38 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: db05f2e34a5e9380ddcc199d6687531108d795e4
      https://github.com/llvm/llvm-project/commit/db05f2e34a5e9380ddcc199d6687531108d795e4
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-07-07 (Tue, 07 Jul 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/Scalarizer.cpp
    M llvm/test/Transforms/Scalarizer/basic.ll
    M llvm/test/Transforms/Scalarizer/crash-bug.ll
    M llvm/test/Transforms/Scalarizer/phi-unreachable-pred.ll

  Log Message:
  -----------
  [Scalarizer] Centralize instruction DCE

As reported in https://reviews.llvm.org/D83101#2133062
the new visitInsertElementInst()/visitExtractElementInst() functionality
is causing miscompiles (previously-crashing test added)

It is due to the fact how the infra of Scalarizer is dealing with DCE,
it was not updated or was it ready for such scalar value forwarding.
It always assumed that the moment we "scalarized" something,
it can go away, and did so with prejudice.

But that is no longer safe/okay to do.

Instead, let's prevent it from ever shooting itself into foot,
and let's just accumulate the instructions-to-be-deleted
in a vector, and collectively cleanup (those that are *actually* dead)
them all at the end.

All existing tests are not reporting any new garbage leftovers,
but maybe it's test coverage issue.




More information about the All-commits mailing list