This is an archive of the discontinued LLVM Phabricator instance.

[LV] Fix PR34523 - avoid generating redundant selects
ClosedPublic

Authored by Ayal on Sep 8 2017, 3:29 AM.

Details

Summary

When converting a PHI into a series of 'select' instructions to combine the
incoming values together according their edge masks, initialize the first
value to the incoming value In0 of the first predecessor, instead of
generating a redundant identity 'select(Cond[0], In0, In0)'. The latter
fails when the Cond[0] mask of the first predecessor is null, representing
a full mask, which can happen only when there's a single incoming value.

Added the testcase from the PR.

This fix follows D35725, which introduced using null to represent full masks.

Diff Detail

Event Timeline

Ayal created this revision.Sep 8 2017, 3:29 AM
uabelho edited edge metadata.Sep 8 2017, 4:34 AM

I don't know this code, but at least the patch solves the crash I reported in PR34523 so thumbs up for that.

rengolin accepted this revision.Sep 8 2017, 4:51 AM

I can't see anything immediately wrong with this patch, it looks trivial and correct. Moreover, if this was done because of a know problem (unlikely, given the commit it came from), we have the assert to help.

LGTM. Thanks!

This revision is now accepted and ready to land.Sep 8 2017, 4:51 AM
This revision was automatically updated to reflect the committed changes.