This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Remove dead mov's in preheader of tail predicated loops
ClosedPublic

Authored by dmgreen on Nov 20 2020, 3:37 AM.

Details

Summary

With t2DoLoopDec we can be left with some extra MOV's in the preheaders of tail predicated loops. This removes them, in the same way we remove other dead variables.

Diff Detail

Event Timeline

dmgreen created this revision.Nov 20 2020, 3:37 AM
dmgreen requested review of this revision.Nov 20 2020, 3:37 AM
samtebbs added inline comments.Nov 20 2020, 6:04 AM
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
800

Is it guaranteed that these extra instructions are unused (and so it's ok to remove them without any extra RDA checks)?

dmgreen added inline comments.Nov 20 2020, 6:52 AM
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
800

I am hoping that is what TryRemove will do. It checks for things like corrupting IT blocks too.

I'm not super confident about this code late-backend dead code removal not causing some problems, but hope it's at least as sane as the existing checks. I have not seen any problems so far at least.

samparker added inline comments.Nov 20 2020, 7:06 AM
llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
809

TryRemove is, relatively, robust :) I think you should just be able to pass ToRemove in place of ElementChain here, though I can't immediately remember why that isn't the case for the loop above.

dmgreen updated this revision to Diff 320547.Feb 1 2021, 12:24 PM

Rebase and cleanup the ToRemove array

samparker accepted this revision.Feb 10 2021, 1:20 AM

cheers!

This revision is now accepted and ready to land.Feb 10 2021, 1:20 AM