Commit 74defde
committed
JIT: Fix VN-based dead store removal for unused SSA defs (#123621)
The VN-based dead store removal phase only handled value-redundant
stores but had no mechanism to remove stores with zero remaining uses.
After Redundant branch opts removes JTRUE references, inlining temps'
dead stores were left behind, preventing fgFoldCondToReturnBlock from
producing branchless codegen.
- Add an SSA use recount pass to get accurate counts after earlier
phases may have removed references without updating use counts
- Change the inner loop to start at defIndex=0 so inlining temps'
first explicit def (at m_array[0], with no implicit entry def) is
considered for removal
- Add a "no remaining uses" dead store removal path that removes the
entire statement when data has no side effects, falling back to the
COMMA approach otherwise
- Revert optimizebools.cpp to the original hasSingleStmt() check,
since the dead stores are now properly removed before Optimize bools1 parent 8a2123e commit 74defde
3 files changed
Lines changed: 109 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
296 | 303 | | |
297 | 304 | | |
298 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1769 | 1769 | | |
1770 | 1770 | | |
1771 | 1771 | | |
1772 | | - | |
| 1772 | + | |
1773 | 1773 | | |
1774 | 1774 | | |
1775 | | - | |
1776 | | - | |
1777 | | - | |
1778 | | - | |
1779 | | - | |
1780 | | - | |
1781 | | - | |
1782 | | - | |
1783 | | - | |
1784 | | - | |
1785 | | - | |
1786 | | - | |
1787 | | - | |
1788 | | - | |
1789 | | - | |
| 1775 | + | |
1790 | 1776 | | |
1791 | 1777 | | |
1792 | 1778 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5727 | 5727 | | |
5728 | 5728 | | |
5729 | 5729 | | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
| 5747 | + | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
| 5764 | + | |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
5730 | 5775 | | |
5731 | 5776 | | |
5732 | 5777 | | |
| |||
5749 | 5794 | | |
5750 | 5795 | | |
5751 | 5796 | | |
5752 | | - | |
| 5797 | + | |
5753 | 5798 | | |
5754 | 5799 | | |
5755 | 5800 | | |
| |||
5766 | 5811 | | |
5767 | 5812 | | |
5768 | 5813 | | |
| 5814 | + | |
| 5815 | + | |
| 5816 | + | |
| 5817 | + | |
| 5818 | + | |
| 5819 | + | |
| 5820 | + | |
| 5821 | + | |
| 5822 | + | |
| 5823 | + | |
| 5824 | + | |
| 5825 | + | |
| 5826 | + | |
| 5827 | + | |
| 5828 | + | |
| 5829 | + | |
| 5830 | + | |
| 5831 | + | |
| 5832 | + | |
| 5833 | + | |
| 5834 | + | |
| 5835 | + | |
| 5836 | + | |
| 5837 | + | |
| 5838 | + | |
| 5839 | + | |
| 5840 | + | |
| 5841 | + | |
| 5842 | + | |
| 5843 | + | |
| 5844 | + | |
| 5845 | + | |
| 5846 | + | |
| 5847 | + | |
| 5848 | + | |
| 5849 | + | |
| 5850 | + | |
| 5851 | + | |
| 5852 | + | |
| 5853 | + | |
| 5854 | + | |
| 5855 | + | |
| 5856 | + | |
| 5857 | + | |
| 5858 | + | |
| 5859 | + | |
| 5860 | + | |
| 5861 | + | |
| 5862 | + | |
| 5863 | + | |
| 5864 | + | |
| 5865 | + | |
| 5866 | + | |
| 5867 | + | |
5769 | 5868 | | |
5770 | 5869 | | |
5771 | 5870 | | |
| |||
0 commit comments