Issue 76048
Summary [SPIRV] Module analysis stage is not able to complete processing of a really big LLVM source
Labels new issue
Assignees
Reporter VyacheslavLevytskyy
    There is an example of a bulky LLVM source: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/test/SpecConstants/long-spec-const-composite.ll

Processing of this file to produce SPIR-V output using LLVM SPIR-V backend takes so long that I've never been able to see it actually completes. It can be reproduced, for example, using the following command:
`llc -mtriple=spirv64-unknown-unknown -O0 long-spec-const-composite.ll -o long-spec-const-composite.spvt`

Debugging shows that a problem is within the Module Analysis stage, namely, on a step of collectOtherInstr()/findSameInstrInMS() calls from lib/Target/SPIRV/SPIRVModuleAnalysis.cpp

The reason seems to be O(n^2) complexity of this particular analysis step, related to choice of a data structure behind `MS` field of `struct ModuleAnalysisInfo`. Possible solution is to use, for example, `std::set` to trace instructions with identical operands instead of `findSameInstrInMS()`.

PR: https://github.com/llvm/llvm-project/pull/76047

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to