This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Improve speed of ComplexDeinterleaving pass
ClosedPublic

Authored by igor.kirillov on Aug 2 2023, 10:12 AM.

Details

Summary

Cache all results of running identifyNode, even those that do not identify
potential complex operations. This patch prevents ComplexDeinterleaving pass
from repeatedly trying to identify Nodes for the same pair of instructions.

Fixes https://github.com/llvm/llvm-project/issues/64379

Diff Detail

Event Timeline

igor.kirillov created this revision.Aug 2 2023, 10:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 10:12 AM
igor.kirillov requested review of this revision.Aug 2 2023, 10:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 10:12 AM
igor.kirillov edited the summary of this revision. (Show Details)

Added link to GitHub issue

NickGuy accepted this revision.Aug 3 2023, 6:07 AM

LGTM.

And after adding one extra u[i] = u[i] * (a[i] * b[i] + c[i]); line it takes 23 seconds.

Out of interest; How long does that sample take with this change? And any idea why the time it takes grows so quickly with a single statement?

This revision is now accepted and ready to land.Aug 3 2023, 6:07 AM

@NickGuy, it looks like we had O(2**N) complexity there where N is the depth of identifyNode call stack :)

After turning off complex deinterleaving, the file compiles for 0.5 seconds on my machine and with this patch and the complex deinterleaving enabled, it is still the same 0.5 seconds no matter how many times I copy/paste those lines.