Commit 47b756a
authored
[RISCV] Only reduce VLs of instructions with demanded VLs (#168693)
In RISCVVLOptimizer we first compute all the demanded VLs, then we walk
backwards through the function and try to reduce any VLs.
We don't actually need to walk backwards anymore since after #124530 the
order in which we modify the instructions doesn't matter.
This patch changes it to just iterate over the instructions with a
demanded VL computed, which means we don't iterate over scalar
instructions etc.
This also fixes #168665, where we triggered an assert on instructions
with a dead $vxsat implicit-def:
dead %x:vr = PseudoVSADDU_VV_M1 $noreg, $noreg, $noreg, -1, 3 /* e8 */,
0 /* tu, mu */, implicit-def dead $vxsat
Because $vxsat is a reserved register, DeadMachineInstructionElim won't
remove it and the instruction makes it to RISCVVLOptimizer.
And because the def of %x is dead, we don't reach this instruction in
the dataflow analysis. This instruction returns true for isCandidate, so
we would try to lookup its demanded VL which doesn't exist and assert.
But with this patch we don't try to reduce instructions that aren't in
DemandedVLs, which fixes the crash.1 parent 3f151a3 commit 47b756a
File tree
3 files changed
+61
-31
lines changed- llvm
- lib/Target/RISCV
- test/CodeGen/RISCV/rvv
3 files changed
+61
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
1607 | 1607 | | |
1608 | 1608 | | |
1609 | 1609 | | |
1610 | | - | |
| 1610 | + | |
| 1611 | + | |
1611 | 1612 | | |
1612 | 1613 | | |
1613 | 1614 | | |
| |||
1620 | 1621 | | |
1621 | 1622 | | |
1622 | 1623 | | |
1623 | | - | |
1624 | | - | |
1625 | | - | |
| 1624 | + | |
1626 | 1625 | | |
1627 | 1626 | | |
1628 | 1627 | | |
1629 | 1628 | | |
1630 | | - | |
1631 | | - | |
| 1629 | + | |
| 1630 | + | |
1632 | 1631 | | |
1633 | 1632 | | |
1634 | | - | |
| 1633 | + | |
1635 | 1634 | | |
1636 | 1635 | | |
1637 | | - | |
| 1636 | + | |
1638 | 1637 | | |
1639 | 1638 | | |
1640 | 1639 | | |
1641 | 1640 | | |
1642 | | - | |
| 1641 | + | |
1643 | 1642 | | |
1644 | 1643 | | |
1645 | 1644 | | |
1646 | 1645 | | |
1647 | 1646 | | |
1648 | | - | |
| 1647 | + | |
1649 | 1648 | | |
1650 | | - | |
1651 | | - | |
| 1649 | + | |
| 1650 | + | |
1652 | 1651 | | |
1653 | 1652 | | |
1654 | | - | |
| 1653 | + | |
1655 | 1654 | | |
1656 | 1655 | | |
1657 | 1656 | | |
1658 | 1657 | | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
1662 | | - | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
1663 | 1661 | | |
1664 | 1662 | | |
1665 | | - | |
1666 | | - | |
| 1663 | + | |
| 1664 | + | |
1667 | 1665 | | |
1668 | 1666 | | |
1669 | 1667 | | |
| |||
1718 | 1716 | | |
1719 | 1717 | | |
1720 | 1718 | | |
1721 | | - | |
1722 | | - | |
1723 | | - | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
1724 | 1722 | | |
1725 | | - | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
1730 | | - | |
1731 | | - | |
1732 | | - | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
1733 | 1726 | | |
1734 | 1727 | | |
1735 | 1728 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
325 | 325 | | |
326 | 326 | | |
327 | 327 | | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
396 | 408 | | |
397 | 409 | | |
398 | 410 | | |
| |||
0 commit comments