This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Attempt to distribute reductions
ClosedPublic

Authored by dmgreen on Jul 22 2021, 2:16 AM.

Details

Summary

This adds a combine for adds of reductions, distributing them so that they occur sequentially to enable better use of accumulating VADDVA instructions. It combines:

add(X, add(vecreduce(Y), vecreduce(Z))) -> add(add(X, vecreduce(Y)), vecreduce(Z))

and

add(add(A, reduce(B)), add(C, reduce(D))) -> add(add(add(A, C), reduce(B)), reduce(D))

These together distribute the add's so that more reductions can be selected to VADDVA.

Diff Detail

Event Timeline

dmgreen created this revision.Jul 22 2021, 2:16 AM
dmgreen requested review of this revision.Jul 22 2021, 2:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 22 2021, 2:16 AM
NickGuy accepted this revision.Jul 26 2021, 8:44 AM

Apart from a personal gripe (which I feel shouldn't stop this being merged), LGTM

llvm/lib/Target/ARM/ARMISelLowering.cpp
13103–13104

If this IsVecReduce returns true, then the second will run needlessly. I'd prefer if the second invocation was conditional on the first failing.

This revision is now accepted and ready to land.Jul 26 2021, 8:44 AM
This revision was landed with ongoing or failed builds.Jul 30 2021, 6:48 AM
This revision was automatically updated to reflect the committed changes.