[llvm] [clang] [CloneFunction][DebugInfo] Avoid cloning DILocalVariables of inlined functions (PR #75385)

Davide Italiano via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 16:46:18 PST 2024


dcci wrote:

Hitting the same problem on a bunch of services. I am going to revert this to unblock people, our repro is similar enough to the one Jeremy shared.

```
$ ./exe
clang -cc1 version 18.0.0git based upon LLVM 18.0.0git default target x86_64-redhat-linux-gnu
clang++: /home/davidino/llvm-project/llvm/include/llvm/Support/Casting.h:109: static bool llvm::isa_impl_cl<llvm::DILocalScope, const llvm::DIScope *>::doit(const From *) [To = llvm::DILocalScope, From = const llvm::DIScope *]: Assertion `Val && "isa<> used on a null pointer"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/davidino/llvm-build-upstream/bin/clang++ @/tmp/fbcc.4ddf7_1j/compiler.argsfile
1.      Running pass 'Function Pass Manager' on module 'buck-out/v2/gen/fbcode/349d8ab5ad6260b7/dsi/logger/configs/CacheClientFciRequestLoggerConfig/__logger__/__objects__/Logger.cpp.o'.
2.      Running pass 'X86 Assembly Printer' on function '@_ZN8facebook6logger27CacheClientFciRequestLogger9invokeLogIDnDnEEibT_PKciT0_'
 #0 0x00007f123a20a448 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/davidino/llvm-build-upstream/bin/../lib/libLLVMSupport.so.18git+0x20a448)
 #1 0x00007f123a207eee llvm::sys::RunSignalHandlers() (/home/davidino/llvm-build-upstream/bin/../lib/libLLVMSupport.so.18git+0x207eee)
 #2 0x00007f123a20ab18 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f1239854db0 __restore_rt (/lib64/libc.so.6+0x54db0)
 #4 0x00007f12398a365c __pthread_kill_implementation (/lib64/libc.so.6+0xa365c)
 #5 0x00007f1239854d06 gsignal (/lib64/libc.so.6+0x54d06)
 #6 0x00007f12398287f3 abort (/lib64/libc.so.6+0x287f3)
 #7 0x00007f123982871b _nl_load_domain.cold (/lib64/libc.so.6+0x2871b)
 #8 0x00007f123984dca6 (/lib64/libc.so.6+0x4dca6)
 #9 0x00007f123d3f54c3 getRetainedNodeScope(llvm::MDNode const*) DwarfDebug.cpp:0:0
#10 0x00007f123d3f686a llvm::DwarfDebug::endFunctionImpl(llvm::MachineFunction const*) (/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMAsmPrinter.so.18git+0x10086a)
#11 0x00007f123d3ce46f llvm::DebugHandlerBase::endFunction(llvm::MachineFunction const*) (/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMAsmPrinter.so.18git+0xd846f)
#12 0x00007f123d3a70fb llvm::AsmPrinter::emitFunctionBody() (/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMAsmPrinter.so.18git+0xb10fb)
#13 0x00007f1240c3db08 llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) X86AsmPrinter.cpp:0:0
#14 0x00007f123e1de48d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCodeGen.so.18git+0x5de48d)
#15 0x00007f123a8a0842 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCore.so.18git+0x4a0842)
#16 0x00007f123a8a7542 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCore.so.18git+0x4a7542)
#17 0x00007f123a8a0f56 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/davidino/llvm-build-upstream/bin/../lib/libLLVMCore.so.18git+0x4a0f56)
#18 0x00007f123cbd248a codegen(llvm::lto::Config const&, llvm::TargetMachine*, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) LTOBackend.cpp:0:0
#19 0x00007f123cbd35cb llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&)::$_6::operator()(llvm::Module&, llvm::TargetMachine*, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>) const LTOBackend.cpp:0:0
#20 0x00007f123cbd3329 llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::DenseMap<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, std::unordered_set<unsigned long, std::hash<unsigned long>, std::equal_to<unsigned long>, std::allocator<unsigned long>>>> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*>> const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfo<llvm::StringRef, void>, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int>>, llvm::SmallVector<std::pair<llvm::StringRef, llvm::BitcodeModule>, 0u>>*, std::vector<unsigned char, std::allocator<unsigned char>> const&) (/home/davidino/llvm-build-upstream/bin/../lib/../lib/libLLVMLTO.so.18git+0x5a329)
#21 0x00007f123e8a1d0a clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/davidino/llvm-build-upstream/bin/../lib/libclangCodeGen.so.18git+0x2a1d0a)
#22 0x00007f123ed589dc clang::CodeGenAction::ExecuteAction() (/home/davidino/llvm-build-upstream/bin/../lib/libclangCodeGen.so.18git+0x7589dc)
#23 0x00007f123cd98aaf clang::FrontendAction::Execute() (/home/davidino/llvm-build-upstream/bin/../lib/libclangFrontend.so.18git+0x198aaf)
#24 0x00007f123ccfb21d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/davidino/llvm-build-upstream/bin/../lib/libclangFrontend.so.18git+0xfb21d)
#25 0x00007f1240ff67fa clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/davidino/llvm-build-upstream/bin/../lib/libclangFrontendTool.so.18git+0x57fa)
#26 0x0000000000216d0f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/davidino/llvm-build-upstream/bin/clang+++0x216d0f)
#27 0x00000000002131df ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#28 0x0000000000212497 clang_main(int, char**, llvm::ToolContext const&) (/home/davidino/llvm-build-upstream/bin/clang+++0x212497)
```

https://github.com/llvm/llvm-project/pull/75385


More information about the cfe-commits mailing list