On Mon, Dec 04, 2023 at 05:30:45PM +0000, Richard Sandiford wrote: > > I don't think it's worth adding the note problem to shrink-wrapping > > just for the regcprop code. If we're prepared to take that compile-time > > hit, we might as well run a proper (fast) DCE. > > Here's a patch that tries to do that. Boostrapped & regression tested > on aarch64-linux-gnu. Also tested on x86_64-linux-gnu for the testcase. > (I'll run full x86_64-linux-gnu testing overnight.) > > OK to install if that passes? Not an elegant fix, but it's probably > too much to hope for one of those.
Isn't this way too conservative though, basically limiting single_set to ~ 15 out of the ~ 65 RTL passes (sure, it will still DTRT for non-PARALLEL or just PARALLEL with clobbers/uses)? Do we know about passes other than postreload which may invalidate REG_UNUSED notes while not purging them altogether? Given what postreload does, I bet cse/gcse might too. If we add a RTL checking verification of the notes, we could know immediately what other passes invalidate it. So, couldn't we just set such flag at the end of such passes (or only if they actually remove any redundant insns and thus potentially invalidate them, perhaps during doing so)? And on the x86 side, the question from the PR still stands, why is vzeroupper pass placed exactly after reload and not postreload which cleans stuff up after reload. Jakub