[llvm] [NFC]Update test case (PR #117584)
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 12:25:16 PST 2024
teresajohnson wrote:
> > The ThinLTO indexing step can import a function alias without importing its aliasee, making `aliasee:null` in the summary. The backend compile will crash in function-import pass when trying to get aliasee of the alias. The crash stack up to `FunctionImportPass::run` is pasted below.
>
> I'm confused as to what is happening here. The below crash is when we are computing imports, not after importing. The function importer should import an alias as a copy of its aliasee when it actually does the IR importing, but the below crash seems earlier. Hmm, it looks like you are trying to run the function import pass, which is just for testing, using the distributed ThinLTO index files. We shouldn't use these for computing imports. What are you trying to do here?
Ah, I assume you are trying to simulate a ThinLTO distributed backend. Add "-import-all-index" to your opt invocation. This will do what a ThinLTO distributed backend will do and blindly follow the importing decisions encoded in the sharded index file, rather than trying to recompute the import decisions. See for example the invocations in llvm/test/ThinLTO/X86/distributed_import.ll.
>
> > This patch updates the existing tests to reflect this.
> > ```
> > 0. Program arguments: /home/tmp/llvm-type-profiling/llvm-project/build/bin/opt -passes=function-import -summary-file=/home/tmp/llvm-type-profiling/llvm-project/build/test/ThinLTO/X86/Output/distributed_indexes.ll.tmp1.bc.thinlto.bc /home/tmp/llvm-type-profiling/llvm-project/build/test/ThinLTO/X86/Output/distributed_indexes.ll.tmp1.bc -o /dev/null
> > 1. Running pass "function-import" on module "/home/tmp/llvm-type-profiling/llvm-project/build/test/ThinLTO/X86/Output/distributed_indexes.ll.tmp1.bc"
> > #0 0x0000563eaf4dbf74 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:22
> > #1 0x0000563eaf4dc3b2 PrintStackTraceSignalHandler(void*) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Support/Unix/Signals.inc:798:1
> > #2 0x0000563eaf4d9b38 llvm::sys::RunSignalHandlers() /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Support/Signals.cpp:105:20
> > #3 0x0000563eaf4db950 SignalHandler(int) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
> > #4 0x00007f8cdef74590 (/lib/x86_64-linux-gnu/libc.so.6+0x3f590)
> > #5 0x00007f8cdefc33ac __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
> > #6 0x00007f8cdef744f2 raise ./signal/../sysdeps/posix/raise.c:27:6
> > #7 0x00007f8cdef5d4ed abort ./stdlib/abort.c:81:7
> > #8 0x00007f8cdef5d415 _nl_load_domain ./intl/loadmsgcat.c:1177:9
> > #9 0x00007f8cdef6d012 (/lib/x86_64-linux-gnu/libc.so.6+0x38012)
> > #10 0x0000563eaf66150b llvm::AliasSummary::getAliasee() const /home/tmp/llvm-type-profiling/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h:689:13
> > #11 0x0000563eaf8bff26 llvm::AliasSummary::getAliasee() /home/tmp/llvm-type-profiling/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h:695:3
> > #12 0x0000563eaf8c008d llvm::GlobalValueSummary::getBaseObject() /home/tmp/llvm-type-profiling/llvm-project/llvm/include/llvm/IR/ModuleSummaryIndex.h:714:28
> > #13 0x0000563eb1ccbcf7 qualifyCalleeCandidates(llvm::ModuleSummaryIndex const&, llvm::ArrayRef<std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>>>, llvm::StringRef)::'lambda'(std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const&)::operator()(std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const&) const /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:238:50
> > #14 0x0000563eb1cd45ff decltype(auto) llvm::callable_detail::Callable<qualifyCalleeCandidates(llvm::ModuleSummaryIndex const&, llvm::ArrayRef<std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>>>, llvm::StringRef)::'lambda'(std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const&), false>::operator()<std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const&, 0>(std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const&) const /home/tmp/llvm-type-profiling/llvm-project/llvm/include/llvm/ADT/STLExtras.h:250:18
> > #15 0x0000563eb1cd4636 llvm::mapped_iterator<std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const*, qualifyCalleeCandidates(llvm::ModuleSummaryIndex const&, llvm::ArrayRef<std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>>>, llvm::StringRef)::'lambda'(std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>> const&), std::pair<llvm::FunctionImporter::ImportFailureReason, llvm::GlobalValueSummary const*>>::operator*() const /home/tmp/llvm-type-profiling/llvm-project/llvm/include/llvm/ADT/STLExtras.h:363:43
> > #16 0x0000563eb1ccc0f6 selectCallee(llvm::ModuleSummaryIndex const&, llvm::ArrayRef<std::unique_ptr<llvm::GlobalValueSummary, std::default_delete<llvm::GlobalValueSummary>>>, unsigned int, llvm::StringRef, llvm::GlobalValueSummary const*&, llvm::FunctionImporter::ImportFailureReason&) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:301:30
> > #17 0x0000563eb1ccd436 computeImportForFunction(llvm::FunctionSummary const&, llvm::ModuleSummaryIndex const&, unsigned int, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::function_ref<bool (unsigned long, llvm::GlobalValueSummary const*)>, llvm::SmallVectorImpl<std::tuple<llvm::FunctionSummary const*, unsigned int>>&, GlobalsImporter&, llvm::FunctionImporter::ImportMapTy&, llvm::DenseMap<llvm::StringRef, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, llvm::DenseSet<llvm::ValueInfo, llvm::DenseMapInfo<llvm::ValueInfo, void>>>>*, llvm::DenseMap<unsigned long, std::tuple<unsigned int, llvm::GlobalValueSummary const*, std::unique_ptr<llvm::FunctionImporter::ImportFailureInfo, std::default_delete<llvm::FunctionImporter::ImportFailureInfo>>>, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, std::tuple<unsigned int, llvm::GlobalValueSummary const*, std::unique_ptr<llvm::FunctionImporter::ImportFailureInfo, std::default_delete<llvm::FunctionImporter::ImportFailureInfo>>>>>&) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:916:23
> > #18 0x0000563eb1ccdde5 ModuleImportsManager::computeImportForModule(llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::StringRef, llvm::FunctionImporter::ImportMapTy&) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:1037:29
> > #19 0x0000563eb1ccf9fa ComputeCrossModuleImportForModuleForTest(llvm::StringRef, llvm::function_ref<bool (unsigned long, llvm::GlobalValueSummary const*)>, llvm::ModuleSummaryIndex const&, llvm::FunctionImporter::ImportMapTy&) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:1309:26
> > #20 0x0000563eb1cd3e1b doImportingForModuleForTest(llvm::Module&, llvm::function_ref<bool (unsigned long, llvm::GlobalValueSummary const*)>) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:2013:19
> > #21 0x0000563eb1cd4189 llvm::FunctionImportPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) /home/tmp/llvm-type-profiling/llvm-project/llvm/lib/Transforms/IPO/FunctionImport.cpp:2055:7
> > ```
https://github.com/llvm/llvm-project/pull/117584
More information about the llvm-commits
mailing list