This is an archive of the discontinued LLVM Phabricator instance.

[Scalarizer] Use poison as insertelement's placeholder
ClosedPublic

Authored by aqjune on Jan 3 2021, 6:18 AM.

Details

Summary

This patch makes Scalarizer to use poison as insertelement's placeholder.

It contains two changes in Scalarizer.cpp, and the both changes does not change the semantics of the optimized program.
It is because the placeholder value (poison) is already completely hidden by following insertelement instructions.

The first change at visitBitCastInst() creates poison vector of MidTy and consecutively inserts FanIn times,
which is # of elems of MidTy.
The second change at ScalarizerVisitor::finish() creates poison with Op->getType(), and it is filled with
Count insertelements.

The test diffs show that the poison value is never exposed after insertelements.

Diff Detail

Event Timeline

aqjune created this revision.Jan 3 2021, 6:18 AM
aqjune requested review of this revision.Jan 3 2021, 6:18 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 3 2021, 6:18 AM
nikic accepted this revision.Jan 3 2021, 7:34 AM

LGTM

This revision is now accepted and ready to land.Jan 3 2021, 7:34 AM
This revision was automatically updated to reflect the committed changes.