This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add a test showing incorrect VSETVLI insertion
ClosedPublic

Authored by frasercrmck on Oct 21 2021, 7:57 AM.

Details

Summary

This test case, reduced from an internal test failure, shows how we may
incorrectly skip the insertion of VSETVLI instructions when doing
cross-basic-block analysis.

The entry block ends in a e32,mf2. Its single successor, %bb.1, ends with a
e8,mf8, but for a mask-type instruction, so is considered compatible.
This means that the info %bb.1 is merged into its predecessor so
produces a e32,mf2. When it comes to the last block, which requires a
e32,mf2, we skip the insertion of a vsetvli because all predecessors
were determined to preserve the right vtype.

However, when %bb.1 is actually laid out it does actually need a
e8,mf8 vsetvli, since the previous instruction has a different tail
policy. This means that when execution flows from %bb.1 to %bb.3, the
vadd.vx is misconfigured.

Diff Detail