HomePhabricator

[Scalarizer] Centralize instruction DCE

Authored by lebedev.ri on Jul 6 2020, 2:25 PM.

Description

[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.

Details

Committed
lebedev.riJul 6 2020, 3:12 PM
Parents
rGc359c5d53442: [X86] Centalize the 'sse4' hack to a single place in X86TargetInfo…
Branches
Unknown
Tags
Unknown