This is an archive of the discontinued LLVM Phabricator instance.

[LV] Fix PR45525: Incorrect assert in blend recipe
ClosedPublic

Authored by gilr on Apr 14 2020, 8:28 AM.

Details

Summary

Fix an assert introduced in 41ed5d856c1: a phi with a single predecessor and a mask is a valid case, already supported.

Diff Detail

Event Timeline

gilr created this revision.Apr 14 2020, 8:28 AM
fhahn accepted this revision.Apr 14 2020, 8:52 AM

I think this is related to PR44800, which has similarly redundant phis, but with 2 incoming values from the same block. Relaxing the assertion seems a fine workaround for now, but I think ideally we would eliminate such redundant PHIs in VPlan later on.

LGTM, with some suggestions for the test. It would be good to wait with committing a day or so, in case there are additional comments.

llvm/test/Transforms/LoopVectorize/pr45525.ll
3

Should this have -force-vector-width=4 or something, to not rely on the cost model?

45

it would be nice to rename the values to have a bit more compact/descriptive names, e.g. %iv and %iv.next and so on instead of the longer names.

46

Branch on undef is UB, please use a different branch condition (e.g. through a parameter).

49

Better to also have a concrete value instead of undef. Also, might be good to have a user of the value to make the test more robust (in case we decide to remove unused values in a VP2VP transform later on).

This revision is now accepted and ready to land.Apr 14 2020, 8:52 AM

Oh and it would be great if you could add a bit more details to the commit message title :)

gilr marked 4 inline comments as done.Apr 15 2020, 12:25 AM
gilr updated this revision to Diff 257611.Apr 15 2020, 12:30 AM
gilr retitled this revision from [LV] Fix PR45525 to [LV] Fix PR45525: Incorrect assert in blend recipe.

Addressed comments and narrowed LIT checks to the relevant vectorized instructions.
Thanks @fhahn !

This revision was automatically updated to reflect the committed changes.