This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Revert WLSTP to DLSTP if the target block is out of range
ClosedPublic

Authored by dmgreen on Jun 22 2021, 6:26 AM.

Details

Summary

If the block target for a WLSTP instruction is known to be out of range, and cannot be fixed by the ARMBlockPlacementPass, we can relax it to a DLSTP (and cmp/branch) to still allow the creation of tail predicated loops. That is what this patch does, adding extra revert code to the fallback path of ARMBlockPlacementPass.

Due to the code produced when reverting, this creates a DLSTP between a Bcc and a Br. As a DLS isn't necessarily a terminator we need to split the block to move the DLS/Br into.

Diff Detail

Event Timeline

dmgreen created this revision.Jun 22 2021, 6:26 AM
dmgreen requested review of this revision.Jun 22 2021, 6:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 22 2021, 6:26 AM
dmgreen updated this revision to Diff 360889.Jul 22 2021, 11:06 AM
dmgreen edited the summary of this revision. (Show Details)

Now splits the block to keep terminators happy.

samtebbs added inline comments.Jul 29 2021, 9:08 AM
llvm/lib/Target/ARM/ARMBlockPlacement.cpp
104

Will you need to mark them as killed in the new DLS or is that done automatically?

120

DPS -> DLS ?

dmgreen updated this revision to Diff 362973.Jul 29 2021, 11:47 PM

Thanks. This also now updates some block offsets, which need to be kept uptodate.

dmgreen added inline comments.Jul 29 2021, 11:52 PM
llvm/lib/Target/ARM/ARMBlockPlacement.cpp
104

Yeah it should done automatically if it's needed. The kill flags only need to be conservative, not precise.

samtebbs accepted this revision.Jul 30 2021, 1:41 AM

Nice one. Looks good to me.

This revision is now accepted and ready to land.Jul 30 2021, 1:41 AM
This revision was landed with ongoing or failed builds.Aug 2 2021, 3:00 AM
This revision was automatically updated to reflect the committed changes.