Commit 2cfe79a
Skip RMW for loop split temporaries
RMW optimization in spill insertion should conservatively assume that loop split temporaries require
read-modify-write sequence. Following explains why this is required:
// ********************
// Before:
// Loop_Header:
// V10:uq = ...
// ...
// jmpi Loop_Header
// ...
// = V10
// ********************
// After split around loop:
//
// (W) LOOP_TMP = V10
// Loop_Header:
// LOOP_TMP:uq = ...
// ...
// jmpi Loop_Header
// (W) V10 = LOOP_TMP
// ...
// = V10
// ********************
// Since V10 is spilled already, spill/fill code is inserted as:
// (Note that program no longer has direct references to V10)
//
// (W) FILL_TMP = Fill from V10 offset
// (W) LOOP_TMP = FILL_TMP
// Loop_Header:
// LOOP_TMP:uq = ...
// ...
// jmpi Loop_Header
// (W) SPILL_TMP = LOOP_TMP
// (W) Spill SPILL_TMP to V10 offset
// ...
// (W) FILL_TMP1 = Fill from V10 offset
// = FILL_TMP1
// ********************
//
// If LOOP_TMP is spilled in later iteration, we need to check whether
// RMW is needed for its def in the loop body. But by this iteration
// all original references to V10 have already been transformed to
// temporary ranges, so we cannot easily determine dominance relation
// between LOOP_TMP and other V10 references. If LOOP_TMP doesn't
// dominate all defs and uses then it would be illegal to skip RMW. Hence,
// we conservatively assume RMW is required for LOOP_TMP.
(cherry picked from commit 887a2e8)1 parent e90e360 commit 2cfe79a
1 file changed
+53
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2800 | 2800 | | |
2801 | 2801 | | |
2802 | 2802 | | |
2803 | | - | |
2804 | | - | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
2805 | 2807 | | |
2806 | 2808 | | |
2807 | | - | |
2808 | | - | |
2809 | | - | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
2810 | 2858 | | |
2811 | 2859 | | |
2812 | 2860 | | |
| |||
0 commit comments