This is an archive of the discontinued LLVM Phabricator instance.

[LSR] Improve filtered uses in NarrowSearchSpaceByPickingWinnerRegs
ClosedPublic

Authored by dmgreen on Feb 14 2023, 7:28 AM.

Details

Summary

NarrowSearchSpaceByPickingWinnerRegs has an aggressive filtering method to reduce the complexity of the search space down by picking a best formula with the highest number of reuses and assuming it will yield profitable reuse. In certain cases we can find a "best" formula like {X+30,+,1} and later check a formula like {X,+,1} with the same number of Uses. On certain architectures it can be better to pick {X,+,1}, especially if an offset of 30 can be used as a legal addressing mode, but -30 cannot. That happens under Thumb1 code, which has fairly limited addressing modes. This patch adds a check to see if it can pick the simpler formula, if it looks more profitable.

Diff Detail

Event Timeline

dmgreen created this revision.Feb 14 2023, 7:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 7:28 AM
dmgreen requested review of this revision.Feb 14 2023, 7:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 7:28 AM

LGTM. Does this unblock the inliner change?

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
4985–4986
aemerson accepted this revision.Feb 15 2023, 1:53 PM
This revision is now accepted and ready to land.Feb 15 2023, 1:53 PM
fhahn accepted this revision.Feb 15 2023, 1:55 PM

LGTM, thanks!

LGTM. Does this unblock the inliner change?

Thanks. This is hopefully fixing the second of the issues, there is still the problems in arm_mult_q15.ll. I haven't looked to see if there are any other issues beyond those two, but hopefully these are the largest parts.

This revision was landed with ongoing or failed builds.Feb 16 2023, 7:48 AM
This revision was automatically updated to reflect the committed changes.
Allen added a subscriber: Allen.Feb 22 2023, 6:55 PM