Page MenuHomePhabricator

[VPlan] Support PHIs as LastInst when inserting scalars in ::get().
ClosedPublic

Authored by fhahn on Jun 12 2021, 2:22 PM.

Details

Summary

At the moment, we create insertelement instructions directly after
LastInst when inserting scalar values in a vector in
VPTransformState::get.

This results in invalid IR when LastInst is a phi, followed by another
phi. In that case, the new instructions should be inserted just after
the last PHI node in the block.

At the moment, I don't think the problematic case can be triggered, but
it can happen once predicate regions are merged and multiple
VPredInstPHI recipes are in the same block (D100260).

Diff Detail

Event Timeline

fhahn created this revision.Jun 12 2021, 2:22 PM
fhahn requested review of this revision.Jun 12 2021, 2:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2021, 2:22 PM
Herald added a subscriber: vkmr. · View Herald Transcript
Ayal accepted this revision.Jun 16 2021, 1:35 PM

Good catch! Please remember to add a testcase along with D100260.

This revision is now accepted and ready to land.Jun 16 2021, 1:35 PM
fhahn added a comment.Jun 17 2021, 1:19 AM

Good catch! Please remember to add a testcase along with D100260.

Thanks, the test case that triggers a crash without the fix (together with D100260) has been added in 9e77526d4673