This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Fix missing cross-block VSETVLI insertion
ClosedPublic

Authored by frasercrmck on Oct 21 2021, 8:29 AM.

Details

Summary

This patch fixes a codegen bug, the test for which was introduced in
D112223.

When merging VSETVLIInfo across blocks, if the 'exit' VSETVLIInfo
produced by a block is found to be compatible with the VSETVLIInfo
computed as the intersection of the 'exit' VSETVLIInfo produced by the
block's predecessors, that blocks' 'exit' info is discarded and the
intersected value is taken in its place.

However, we have one authority on what constitutes VSETVLIInfo
compatibility and we are using it in two different contexts.

Compatibility is used in one context to elide VSETVLIs between
straight-line vector instructions. But compatibility when evaluated
between two blocks' exit infos ignores any info produced *inside* each
respective block before the exit points. As such it does not guarantee
that a block will not produce a VSETVLI which is incompatible with the
'previous' block.

As such, we must ensure that any merging of VSETVLIInfo is performed
using some notion of "strict" compatibility. I've defined this as a full
vtype match, but this is perhaps too pessimistic. Given that test
coverage in this regard is lacking -- the only change is in the failing
test -- I think this is a good starting point.

Diff Detail

Event Timeline

frasercrmck created this revision.Oct 21 2021, 8:29 AM
frasercrmck requested review of this revision.Oct 21 2021, 8:29 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2021, 8:29 AM
This revision is now accepted and ready to land.Oct 21 2021, 8:54 AM
  • no-op so buildbots retry the patch with the parent correctly set
This revision was automatically updated to reflect the committed changes.