To simplify D150297.
We should be looking at OpFlags more.
Differential D157907
[NFC] Refactor X86TargetLowering::getGlobalWrapperKind() aeubanks on Aug 14 2023, 11:28 AM. Authored by
Details
Diff Detail
Event Timeline
Comment Actions remove default args
Comment Actions Hi, this is causing a regression on the greendragon x86_64 lldb bot, it took a little while to repo and narrow down today. https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/ is failing on TestDequeFromStdModule.py, I can repo it on an intel mac. We're crashing under LLVM ERROR: unable to evaluate offset to undefined symbol 'L21$pb' 4 liblldb.18.0.0git.dylib 0x1357b08a4 llvm::report_fatal_error(llvm::Twine const&, bool) + 388 (ErrorHandling.cpp:123) 5 liblldb.18.0.0git.dylib 0x13f73da2b getLabelOffset(llvm::MCAsmLayout const&, llvm::MCSymbol const&, bool, unsigned long long&) + 187 (MCFragment.cpp:107) 6 liblldb.18.0.0git.dylib 0x13f73aa48 getSymbolOffsetImpl(llvm::MCAsmLayout const&, llvm::MCSymbol const&, bool, unsigned long long&) + 72 (MCFragment.cpp:118) 7 liblldb.18.0.0git.dylib 0x13f73abde getSymbolOffsetImpl(llvm::MCAsmLayout const&, llvm::MCSymbol const&, bool, unsigned long long&) + 478 (MCFragment.cpp:143) 8 liblldb.18.0.0git.dylib 0x13f73ac56 llvm::MCAsmLayout::getSymbolOffset(llvm::MCSymbol const&) const + 38 (MCFragment.cpp:158) 9 liblldb.18.0.0git.dylib 0x13f6df97f llvm::MCAssembler::evaluateFixup(llvm::MCAsmLayout const&, llvm::MCFixup const&, llvm::MCFragment const*, llvm::MCValue&, unsigned long long&, bool&) const + 1151 (MCAssembler.cpp:262) 10 liblldb.18.0.0git.dylib 0x13f6e2aec llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&, llvm::MCFragment&, llvm::MCFixup const&) + 92 (MCAssembler.cpp:804) 11 liblldb.18.0.0git.dylib 0x13f6e362b llvm::MCAssembler::layout(llvm::MCAsmLayout&) + 2651 (MCAssembler.cpp:933) 12 liblldb.18.0.0git.dylib 0x13f6e40cd llvm::MCAssembler::Finish() + 77 (MCAssembler.cpp:944) 13 liblldb.18.0.0git.dylib 0x13f75b10b llvm::MCObjectStreamer::finishImpl() + 203 (MCObjectStreamer.cpp:932) 14 liblldb.18.0.0git.dylib 0x13f744709 (anonymous namespace)::MCMachOStreamer::finishImpl() + 761 (MCMachOStreamer.cpp:533) 15 liblldb.18.0.0git.dylib 0x13f785b10 llvm::MCStreamer::finish(llvm::SMLoc) + 224 (MCStreamer.cpp:1021) 16 liblldb.18.0.0git.dylib 0x1381ac986 llvm::AsmPrinter::doFinalization(llvm::Module&) + 6502 (AsmPrinter.cpp:2398) 17 liblldb.18.0.0git.dylib 0x13f1708ae llvm::FPPassManager::doFinalization(llvm::Module&) + 78 (LegacyPassManager.cpp:1499) 18 liblldb.18.0.0git.dylib 0x13f1699be (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) + 1358 (LegacyPassManager.cpp:1586) 19 liblldb.18.0.0git.dylib 0x13f1692ba llvm::legacy::PassManagerImpl::run(llvm::Module&) + 266 (LegacyPassManager.cpp:535) 20 liblldb.18.0.0git.dylib 0x13f170af1 llvm::legacy::PassManager::run(llvm::Module&) + 33 (LegacyPassManager.cpp:1677) 21 liblldb.18.0.0git.dylib 0x138d51d7d llvm::MCJIT::emitObject(llvm::Module*) + 477 (MCJIT.cpp:171) @Michael137 might be better able to understand the nature of the regression, I'm not very familiar with this part of llvm, I'm trying to get repo steps for him on an aarch64 mac to build & run it under translation. I think we'll need to revert this until we can figure out the failure. Comment Actions I can repro under Rosetta. Let me know if you need any details on how to repro or about the Module we're trying to compile. builder.setEngineKind(llvm::EngineKind::JIT) .setErrorStr(&error_string) .setRelocationModel(triple.isOSBinFormatMachO() ? llvm::Reloc::PIC_ : llvm::Reloc::Static) .setMCJITMemoryManager(std::make_unique<MemoryManager>(*this)) .setOptLevel(llvm::CodeGenOpt::Less); And the getTargetMachine().getCodeModel() == Large (which is a codepath that changed in this patch). Comment Actions I won't be on my PC for the next 12 hours or so. I shared the IR with @jasonmolenda earlier today, hopefully he can forward it to you If you have access to a x86_64 (or Rosetta) Darwin machine you should be able to repro it by compiling lldb/test/API/commands/expression/import-std-module/deque-basic/main.cpp with your changes and attaching lldb as follows: ./bin/lldb a.out -o "sett set target.import-std-module true" -o "br se -p return -X main" -o run -o "expr std::sort(a.begin(), a.end())" Comment Actions I sent you the module file. You should be able to repro the crash without going through LLDB by running: ./bin/lli --relocation-model=pic --code-model=large --jit-kind=mcjit --entry-function="_Z12\$__lldb_exprPv" module.ll Comment Actions reduced target triple = "x86_64-apple-macosx13.0.0" define void @f() noinline optnone { bb: switch i64 0, label %bb1 [ i64 0, label %bb1 i64 2, label %bb2 i64 5, label %bb4 i64 4, label %bb3 ] bb1: ; preds = %bb, %bb ret void bb2: ; preds = %bb ret void bb3: ; preds = %bb ret void bb4: ; preds = %bb ret void } $ lli --relocation-model=pic --code-model=large --jit-kind=mcjit --entry-function=f /tmp/a.ll has something to do with jump tables (which are actually known to be an issue in clang's large code model) Comment Actions Regarding large code model jump tables, I think I filed an issue for alternative, relocation-less jump table encodings: https://github.com/llvm/llvm-project/issues/62894 |
Are there more no-operand call sites? It seems that now they will do the wrong thing in the large code model. Should we remove the optional arguments to mandate that all sites pass OpFlag?