This is an archive of the discontinued LLVM Phabricator instance.

[LV] Fix the combination of predicated epilogs and DataAndControlFlow
Needs ReviewPublic

Authored by dmgreen on Mar 13 2023, 5:24 AM.

Details

Summary

Currently DataAndControlFlow will insert a active.lane.mask at the start of the loop, assuming that the initial value should always be 0. This is incorrect for epilogues where the initial value will be the CanonicalIVStartVPValue. This patch attempts to create a vplan value for CanonicalIVStartVPValue, in the same line as VPValues like BackedgeTakenCount and TripCount. This can then be replaced by the correct value for the main body or the epilog loop in prepareToExecute. In the main loop it will always be 0. For epilogs it will use the %vec.epilog.resume.val value from the phi from the middle block.

That allows the initial value for the active.lane.mask in DataAndControlFlow to be replaced with the correct value when building the plan with the vplan, in the same way as the VPCanonicalIVPHIRecipe.

Diff Detail