This is an archive of the discontinued LLVM Phabricator instance.

[Inliner] Change inline remark format and update ReplayInlineAdvisor to use it
ClosedPublic

Authored by modimo on Jan 8 2021, 12:35 PM.

Details

Summary

This change modifies the source location formatting from:
LineNumber.Discriminator
to:
LineNumber:ColumnNumber.Discriminator

The motivation here is to enhance location information for inline replay that currently exists for the SampleProfile inliner. This will be leveraged further in inline replay for the CGSCC inliner in the related diff.

The ReplayInlineAdvisor is also modified to read the new format and now takes into account the callee for greater accuracy.

Testing:
ninja check-llvm

Diff Detail

Event Timeline

modimo created this revision.Jan 8 2021, 12:35 PM
modimo requested review of this revision.Jan 8 2021, 12:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2021, 12:35 PM
modimo retitled this revision from change remark format to [Inliner] Change inline remark format.Jan 8 2021, 12:41 PM
modimo edited the summary of this revision. (Show Details)
modimo added reviewers: mtrofin, wenlei, wmi.
thegameg added inline comments.
llvm/lib/Analysis/InlineAdvisor.cpp
405–406

Can we use a DebugLoc here like Callee and Caller?

Something like:

- String: 'at callsite '
- CallSite: bar
  DebugLoc: { File: '/tmp/s.c', Line: 1, Column: 10 }

The proposal in the patch is to use line:col.discriminator (which is reasonable), but the implementation uses line:col:discriminator -- please update the patch to be consistent.

wenlei added inline comments.Jan 8 2021, 2:33 PM
llvm/lib/Analysis/InlineAdvisor.cpp
405–406

Having location in text output as well (in addition to yaml) makes it easier to consume for replay. If we go with what Caller/Callee use, I guess the location only goes to yaml, but not text remarks?

As for the format of location string in text mark, the current form aligns with the context representation of CSSPGO's profile, so it makes things a bit easier for inlining related investigation, etc, which is intended use case for inline replay scaffolding.

modimo updated this revision to Diff 315556.Jan 8 2021, 4:58 PM
modimo edited the summary of this revision. (Show Details)

Split changes with D94334 better: now the ReplayInlineAdvisor update which needs to be atomic with the formatting change is moved over to here. Removed ReplayInlineAdvice and modified DefaultInlineAdvice to provide the desired functionality. Fixed up tests.

modimo added a comment.Jan 8 2021, 5:25 PM

The proposal in the patch is to use line:col.discriminator (which is reasonable), but the implementation uses line:col:discriminator -- please update the patch to be consistent.

I might have missed something but the implemented format is line:col.discriminator. See:

remark: calls.cc:4:0: _Z3subii inlined into main to match profiling context with (cost=-5, threshold=337) at callsite _Z3sumii:1:0 @ main:3:0.1;

and

if (Discriminator)
  CallSiteLoc << "." << llvm::utostr(Discriminator);
llvm/lib/Analysis/InlineAdvisor.cpp
405–406

I like the idea! Testing out using the DLoc as an ORE generates:

- CallSite:        'calls.cc:10:0'
  DebugLoc:        { File: calls.cc, Line: 10, Column: 0 }

As compared to:

- String:          main
- String:          ':'
- Line:            '3'
- String:          ':'
- Column:          '0'
- String:          .
- Disc:            '1'
- String:          ';'

We can probably package up the DLoc to output its name better like how Callee gets it automatically with ore::NV("Callee", &Callee). One of the refinements we do here though is to generate function-relative line numbers which are more tolerant of adding/deleting source lines while maintaining inline replay. Also, looking at the implementation DebugLoc doesn't seem to recurse through inlined sites which we need for cases like:

callsite _Z3sumii:1:0 @ main:3:0.1;

If we can extend DebugLoc to have the processed form than I think that's an elegant way to do this.

Additionally I've verified that DebugLoc only shows up in the yaml output which with the current scheme of reading the remarks as plaintext means that won't work. There's discussion on companion diff D94334 on whether it makes more sense to use YAML for these remarks which also informs whether we should go down this route.

modimo retitled this revision from [Inliner] Change inline remark format to [Inliner] Change inline remark format and update ReplayInlineAdvisor to it.Jan 8 2021, 5:27 PM
modimo edited the summary of this revision. (Show Details)
modimo retitled this revision from [Inliner] Change inline remark format and update ReplayInlineAdvisor to it to [Inliner] Change inline remark format and update ReplayInlineAdvisor to use it.Jan 8 2021, 5:35 PM

You are right -- the text format is properly implemented.

mtrofin added inline comments.Jan 8 2021, 7:04 PM
llvm/lib/Analysis/InlineAdvisor.cpp
65

Why add optional remark emission?

Should we get rid of DefaultInlineAdvice and fold it into the base class InlineAdvice? 'DefaultInlineAdvice' implies it is an advice provided by the default advisor which no longer is true.

Besides the inlineAdvice contains a reference to the inlineAdvisor, so where the advice comes from is discoverable.

@mtrofin

mtrofin added a comment.EditedJan 8 2021, 7:35 PM

Should we get rid of DefaultInlineAdvice and fold it into the base class InlineAdvice? 'DefaultInlineAdvice' implies it is an advice provided by the default advisor which no longer is true.

Besides the inlineAdvice contains a reference to the inlineAdvisor, so where the advice comes from is discoverable.

@mtrofin

I can look into it, we need to look at its uses on the ML side. Perhaps the logging part can be moved, because the InlineCost stuff is very much default policy-specific.

The modifications to the DefaultInlineAdvice is an attempt to solve the following problem:

  1. In the SampleProfile inliner it emits remarks through the "legacy" interface with emitInlinedInto. For replay if advice generates remarks you'll get duplicate remarks but if it doesn't you get a single set (which is what's happening today and correct).
  2. In the CGSCC inliner in newPM it emits remarks through InlineAdvice via recordInlining and nowhere else. For replay if InlineAdvice generates remarks you're good but if it doesn't you get no remarks.

So to solve this issue I have the ReplayAdvisor use DefaultInlineAdvice with modifications to suppress remarks for the SampleProfile inliner.

I can look into it, we need to look at its uses on the ML side. Perhaps the logging part can be moved, because the InlineCost stuff is very much default policy-specific.

This seems like a cleaner approach than my current solution. I'll need to move the EmitRemarks over to the base class which looks to be okay given it can be defaulted to true. Thoughts?

llvm/lib/Analysis/InlineAdvisor.cpp
65

The SampleProfile.cpp inliner emits its own remarks via the emitInlinedInto interface. Without this you would get double remarks when dumping the SampleProfile.cpp inliner which I want to avoid. The rest of the comments suggests there's a better holistic solution so I'll add my thoughts to a below comment.

The modifications to the DefaultInlineAdvice is an attempt to solve the following problem:

  1. In the SampleProfile inliner it emits remarks through the "legacy" interface with emitInlinedInto. For replay if advice generates remarks you'll get duplicate remarks but if it doesn't you get a single set (which is what's happening today and correct).
  2. In the CGSCC inliner in newPM it emits remarks through InlineAdvice via recordInlining and nowhere else. For replay if InlineAdvice generates remarks you're good but if it doesn't you get no remarks.

So to solve this issue I have the ReplayAdvisor use DefaultInlineAdvice with modifications to suppress remarks for the SampleProfile inliner.

I can look into it, we need to look at its uses on the ML side. Perhaps the logging part can be moved, because the InlineCost stuff is very much default policy-specific.

This seems like a cleaner approach than my current solution. I'll need to move the EmitRemarks over to the base class which looks to be okay given it can be defaulted to true. Thoughts?

I wouldn't block this patch on that - we can do the refactoring subsequently.

mtrofin accepted this revision.Jan 11 2021, 5:48 PM

LGTM; but so I understand something better: the ability to replay is somewhat 'best effort' if the compiler changes (or, of course, the compiled code). May be worth adding a comment about that?

This revision is now accepted and ready to land.Jan 11 2021, 5:48 PM

I wouldn't block this patch on that - we can do the refactoring subsequently.

Sounds good.

LGTM; but so I understand something better: the ability to replay is somewhat 'best effort' if the compiler changes (or, of course, the compiled code). May be worth adding a comment about that?

Thanks for signing off! Your take here is correct, this is operating under a best effort approach to replay. In D94334 I note that testing on mysqld the current solution for CGSCC inline replay is ~94% accurate in replaying when comparing remarks base vs. replay.

Added a comment in ReplayInlineAdvisor describing the best effort approach here.

modimo updated this revision to Diff 315982.Jan 11 2021, 7:47 PM

Add comment about best effort approach of replay.

Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2021, 1:44 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
wenlei added inline comments.Jan 12 2021, 9:07 PM
llvm/lib/Analysis/InlineAdvisor.cpp
412

nit: any special reason for adding this? doesn't seem consistent with other remarks we have.

modimo added inline comments.Jan 14 2021, 2:54 PM
llvm/lib/Analysis/InlineAdvisor.cpp
412

If you grab the remark outputs via -Rpass=inline you'll get additional suffix information:

inline.cpp:8:12: remark: _Z3foov inlined into main with (cost=0, threshold=375) at callsite main:2:12; [-Rpass=inline]
    return foo();

The semicolon is to separate the remark from any additional output at the end so when replaying we can match the correct callsite. Something like this would be unneeded for yaml replay but for the current implementation it's necessary for correctness.

wenlei added inline comments.Jan 19 2021, 12:59 PM
llvm/lib/Analysis/InlineAdvisor.cpp
412

By correctness, did you mean the fact that you rely on split(";") in parsing, or something else?

This is not a big deal, but if no other remarks end with ;, it would be good to be consistent. Using split(";") for parsing is just one way of implementing it, and IMO could be changed to favor consistency in remarks output.

modimo added inline comments.Jan 21 2021, 3:11 PM
llvm/lib/Analysis/InlineAdvisor.cpp
412

By correctness, did you mean the fact that you rely on split(";") in parsing, or something else?

Yeah, without that we would store the callsite from remarks as main:2:12 [-Rpass=inline] which would not match the actual callsite string main:2:12 that we query the map with which causes replay to never inline.

This is not a big deal, but if no other remarks end with ;, it would be good to be consistent. Using split(";") for parsing is just one way of implementing it, and IMO could be changed to favor consistency in remarks output.

Doing a search query for OptimizationRemarkAnalysis I see vectorizer ORE uses "." for their terminator so switching to that is better consistency. I'll make the change in an upcoming patch.

I think this change broke apt.llvm.org

> [100%] Linking CXX shared library ../../lib/libLLVM-13.so
> cd "/build/llvm-toolchain-snapshot-13~++20210619083511+1605fce6c307/build-llvm/tools/llvm-shlib" && /usr/bin/cmake -E cmake_link_script CMakeFiles/LLVM.dir/link.txt --verbose=1
> /usr/lib/ccache/g++-10 -fPIC -g -O2 -fdebug-prefix-map=/build/llvm-toolchain-snapshot-13~++20210619083511+1605fce6c307=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wmisleading-indentation -ffunction-sections -fdata-sections -O2 -DNDEBUG -g1  -Wl,-rpath-link,/build/llvm-toolchain-snapshot-13~++20210619083511+1605fce6c307/build-llvm/./lib  -Wl,-O3 -Wl,--gc-sections -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,defs -Wl,-z,nodelete -shared -Wl,-soname,libLLVM-13.so.1 -o ../../lib/libLLVM-13.so.1 CMakeFiles/LLVM.dir/libllvm.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib" -Wl,--version-script,/build/llvm-toolchain-snapshot-13~++20210619083511+1605fce6c307/build-llvm/./lib/tools/llvm-shlib/simple_version_script.map -Wl,--whole-archive ../../lib/libLLVMDemangle.a ../../lib/libLLVMSupport.a ../../lib/libLLVMCore.a ../../lib/libLLVMFuzzMutate.a ../../lib/libLLVMFileCheck.a ../../lib/libLLVMInterfaceStub.a ../../lib/libLLVMIRReader.a ../../lib/libLLVMCodeGen.a ../../lib/libLLVMSelectionDAG.a ../../lib/libLLVMAsmPrinter.a ../../lib/libLLVMMIRParser.a ../../lib/libLLVMGlobalISel.a ../../lib/libLLVMBinaryFormat.a ../../lib/libLLVMBitReader.a ../../lib/libLLVMBitWriter.a ../../lib/libLLVMBitstreamReader.a ../../lib/libLLVMDWARFLinker.a ../../lib/libLLVMExtensions.a ../../lib/libLLVMFrontendOpenACC.a ../../lib/libLLVMFrontendOpenMP.a ../../lib/libLLVMTransformUtils.a ../../lib/libLLVMInstrumentation.a ../../lib/libLLVMAggressiveInstCombine.a ../../lib/libLLVMInstCombine.a ../../lib/libLLVMScalarOpts.a ../../lib/libLLVMipo.a ../../lib/libLLVMVectorize.a ../../lib/libLLVMObjCARCOpts.a ../../lib/libLLVMCoroutines.a ../../lib/libLLVMCFGuard.a ../../lib/libLLVMLinker.a ../../lib/libLLVMAnalysis.a ../../lib/libLLVMLTO.a ../../lib/libLLVMMC.a ../../lib/libLLVMMCParser.a ../../lib/libLLVMMCDisassembler.a ../../lib/libLLVMMCA.a ../../lib/libLLVMObject.a ../../lib/libLLVMObjectYAML.a ../../lib/libLLVMOption.a ../../lib/libLLVMRemarks.a ../../lib/libLLVMDebugInfoDWARF.a ../../lib/libLLVMDebugInfoGSYM.a ../../lib/libLLVMDebugInfoMSF.a ../../lib/libLLVMDebugInfoCodeView.a ../../lib/libLLVMDebugInfoPDB.a ../../lib/libLLVMSymbolize.a ../../lib/libLLVMExecutionEngine.a ../../lib/libLLVMInterpreter.a ../../lib/libLLVMJITLink.a ../../lib/libLLVMMCJIT.a ../../lib/libLLVMOrcJIT.a ../../lib/libLLVMOrcShared.a ../../lib/libLLVMOrcTargetProcess.a ../../lib/libLLVMRuntimeDyld.a ../../lib/libLLVMPerfJITEvents.a ../../lib/libLLVMTarget.a ../../lib/libLLVMAArch64CodeGen.a ../../lib/libLLVMAArch64AsmParser.a ../../lib/libLLVMAArch64Disassembler.a ../../lib/libLLVMAArch64Desc.a ../../lib/libLLVMAArch64Info.a ../../lib/libLLVMAArch64Utils.a ../../lib/libLLVMAMDGPUCodeGen.a ../../lib/libLLVMAMDGPUAsmParser.a ../../lib/libLLVMAMDGPUDisassembler.a ../../lib/libLLVMAMDGPUDesc.a ../../lib/libLLVMAMDGPUInfo.a ../../lib/libLLVMAMDGPUUtils.a ../../lib/libLLVMARMCodeGen.a ../../lib/libLLVMARMAsmParser.a ../../lib/libLLVMARMDisassembler.a ../../lib/libLLVMARMDesc.a ../../lib/libLLVMARMInfo.a ../../lib/libLLVMARMUtils.a ../../lib/libLLVMAVRCodeGen.a ../../lib/libLLVMAVRAsmParser.a ../../lib/libLLVMAVRDisassembler.a ../../lib/libLLVMAVRDesc.a ../../lib/libLLVMAVRInfo.a ../../lib/libLLVMBPFCodeGen.a ../../lib/libLLVMBPFAsmParser.a ../../lib/libLLVMBPFDisassembler.a ../../lib/libLLVMBPFDesc.a ../../lib/libLLVMBPFInfo.a ../../lib/libLLVMHexagonCodeGen.a ../../lib/libLLVMHexagonAsmParser.a ../../lib/libLLVMHexagonDisassembler.a ../../lib/libLLVMHexagonDesc.a ../../lib/libLLVMHexagonInfo.a ../../lib/libLLVMLanaiCodeGen.a ../../lib/libLLVMLanaiAsmParser.a ../../lib/libLLVMLanaiDisassembler.a ../../lib/libLLVMLanaiDesc.a ../../lib/libLLVMLanaiInfo.a ../../lib/libLLVMMipsCodeGen.a ../../lib/libLLVMMipsAsmParser.a ../../lib/libLLVMMipsDisassembler.a ../../lib/libLLVMMipsDesc.a ../../lib/libLLVMMipsInfo.a ../../lib/libLLVMMSP430CodeGen.a ../../lib/libLLVMMSP430Desc.a ../../lib/libLLVMMSP430Info.a ../../lib/libLLVMMSP430AsmParser.a ../../lib/libLLVMMSP430Disassembler.a ../../lib/libLLVMNVPTXCodeGen.a ../../lib/libLLVMNVPTXDesc.a ../../lib/libLLVMNVPTXInfo.a ../../lib/libLLVMPowerPCCodeGen.a ../../lib/libLLVMPowerPCAsmParser.a ../../lib/libLLVMPowerPCDisassembler.a ../../lib/libLLVMPowerPCDesc.a ../../lib/libLLVMPowerPCInfo.a ../../lib/libLLVMRISCVCodeGen.a ../../lib/libLLVMRISCVAsmParser.a ../../lib/libLLVMRISCVDisassembler.a ../../lib/libLLVMRISCVDesc.a ../../lib/libLLVMRISCVInfo.a ../../lib/libLLVMSparcCodeGen.a ../../lib/libLLVMSparcAsmParser.a ../../lib/libLLVMSparcDisassembler.a ../../lib/libLLVMSparcDesc.a ../../lib/libLLVMSparcInfo.a ../../lib/libLLVMSystemZCodeGen.a ../../lib/libLLVMSystemZAsmParser.a ../../lib/libLLVMSystemZDisassembler.a ../../lib/libLLVMSystemZDesc.a ../../lib/libLLVMSystemZInfo.a ../../lib/libLLVMWebAssemblyCodeGen.a ../../lib/libLLVMWebAssemblyAsmParser.a ../../lib/libLLVMWebAssemblyDisassembler.a ../../lib/libLLVMWebAssemblyDesc.a ../../lib/libLLVMWebAssemblyInfo.a ../../lib/libLLVMWebAssemblyUtils.a ../../lib/libLLVMX86CodeGen.a ../../lib/libLLVMX86AsmParser.a ../../lib/libLLVMX86Disassembler.a ../../lib/libLLVMX86Desc.a ../../lib/libLLVMX86Info.a ../../lib/libLLVMXCoreCodeGen.a ../../lib/libLLVMXCoreDisassembler.a ../../lib/libLLVMXCoreDesc.a ../../lib/libLLVMXCoreInfo.a ../../lib/libLLVMM68kCodeGen.a ../../lib/libLLVMM68kInfo.a ../../lib/libLLVMM68kDesc.a ../../lib/libLLVMM68kAsmParser.a ../../lib/libLLVMM68kDisassembler.a ../../lib/libLLVMAsmParser.a ../../lib/libLLVMLineEditor.a ../../lib/libLLVMProfileData.a ../../lib/libLLVMCoverage.a ../../lib/libLLVMPasses.a ../../lib/libLLVMTextAPI.a ../../lib/libLLVMDlltoolDriver.a ../../lib/libLLVMLibDriver.a ../../lib/libLLVMXRay.a ../../lib/libLLVMWindowsManifest.a -Wl,--no-whole-archive ../../lib/libLLVMExtensions.a ../../lib/libPolly.a ../../lib/libPollyISL.a ../../lib/libLLVMDebugInfoPDB.a /usr/lib/s390x-linux-gnu/libffi.so ../../lib/libLLVMJITLink.a ../../lib/libLLVMExecutionEngine.a ../../lib/libLLVMOrcTargetProcess.a ../../lib/libLLVMOrcShared.a ../../lib/libLLVMRuntimeDyld.a ../../lib/libLLVMMIRParser.a ../../lib/libLLVMPasses.a ../../lib/libLLVMObjCARCOpts.a ../../lib/libLLVMCoroutines.a ../../lib/libLLVMMSP430Desc.a ../../lib/libLLVMMSP430Info.a ../../lib/libLLVMipo.a ../../lib/libLLVMIRReader.a ../../lib/libLLVMAsmParser.a ../../lib/libLLVMFrontendOpenMP.a ../../lib/libLLVMInstrumentation.a ../../lib/libLLVMLinker.a ../../lib/libLLVMVectorize.a ../../lib/libLLVMCFGuard.a ../../lib/libLLVMM68kCodeGen.a ../../lib/libLLVMAsmPrinter.a ../../lib/libLLVMDebugInfoDWARF.a ../../lib/libLLVMDebugInfoMSF.a ../../lib/libLLVMGlobalISel.a ../../lib/libLLVMSelectionDAG.a ../../lib/libLLVMCodeGen.a ../../lib/libLLVMBitWriter.a ../../lib/libLLVMScalarOpts.a ../../lib/libLLVMAggressiveInstCombine.a ../../lib/libLLVMInstCombine.a ../../lib/libLLVMTransformUtils.a ../../lib/libLLVMTarget.a ../../lib/libLLVMAnalysis.a ../../lib/libLLVMM68kDesc.a ../../lib/libLLVMMCDisassembler.a ../../lib/libLLVMM68kInfo.a -ledit ../../lib/libLLVMProfileData.a ../../lib/libLLVMOption.a ../../lib/libLLVMObject.a ../../lib/libLLVMBitReader.a ../../lib/libLLVMCore.a ../../lib/libLLVMRemarks.a ../../lib/libLLVMBitstreamReader.a ../../lib/libLLVMMCParser.a ../../lib/libLLVMMC.a ../../lib/libLLVMDebugInfoCodeView.a ../../lib/libLLVMTextAPI.a ../../lib/libLLVMBinaryFormat.a ../../lib/libLLVMSupport.a ../../lib/libLLVMDemangle.a -lrt -ldl -lpthread -lm /usr/lib/s390x-linux-gnu/libz.so /usr/lib/s390x-linux-gnu/libtinfo.so 
> /usr/bin/ld: ../../lib/libLLVMM68kCodeGen.a(M68kSubtarget.cpp.o): in function `llvm::M68kGenRegisterBankInfo::M68kGenRegisterBankInfo()':
> ./build-llvm/lib/Target/M68k/./llvm/include/llvm/ADT/SmallVector.h:580: multiple definition of `llvm::M68kGenRegisterBankInfo::M68kGenRegisterBankInfo()'; ../../lib/libLLVMM68kCodeGen.a(M68kRegisterBankInfo.cpp.o):./build-llvm/lib/Target/M68k/./build-llvm/lib/Target/M68k/M68kGenRegisterBank.inc:49: first defined here
> /usr/bin/ld: ../../lib/libLLVMM68kCodeGen.a(M68kSubtarget.cpp.o): in function `llvm::M68kGenRegisterBankInfo::M68kGenRegisterBankInfo()':
> ./build-llvm/lib/Target/M68k/./llvm/include/llvm/ADT/SmallVector.h:580: multiple definition of `llvm::M68kGenRegisterBankInfo::M68kGenRegisterBankInfo()'; ../../lib/libLLVMM68kCodeGen.a(M68kRegisterBankInfo.cpp.o):./build-llvm/lib/Target/M68k/./build-llvm/lib/Target/M68k/M68kGenRegisterBank.inc:49: first defined here
> /usr/bin/ld: ../../lib/libLLVMM68kCodeGen.a(M68kSubtarget.cpp.o): in function `llvm::M68kRegisterBankInfo::M68kRegisterBankInfo(llvm::TargetRegisterInfo const&)':
> ./build-llvm/lib/Target/M68k/./llvm/include/llvm/ADT/SmallVector.h:254: multiple definition of `llvm::M68kRegisterBankInfo::M68kRegisterBankInfo(llvm::TargetRegisterInfo const&)'; ../../lib/libLLVMM68kCodeGen.a(M68kRegisterBankInfo.cpp.o):./build-llvm/lib/Target/M68k/./llvm/lib/Target/M68k/GlSel/M68kRegisterBankInfo.cpp:26: first defined here
> /usr/bin/ld: ../../lib/libLLVMM68kCodeGen.a(M68kSubtarget.cpp.o): in function `llvm::M68kRegisterBankInfo::M68kRegisterBankInfo(llvm::TargetRegisterInfo const&)':
> ./build-llvm/lib/Target/M68k/./llvm/include/llvm/ADT/SmallVector.h:254: multiple definition of `llvm::M68kRegisterBankInfo::M68kRegisterBankInfo(llvm::TargetRegisterInfo const&)'; ../../lib/libLLVMM68kCodeGen.a(M68kRegisterBankInfo.cpp.o):./build-llvm/lib/Target/M68k/./llvm/lib/Target/M68k/GlSel/M68kRegisterBankInfo.cpp:26: first defined here
> /usr/bin/ld: ../../lib/libLLVMM68kCodeGen.a(M68kSubtarget.cpp.o):(.data.rel.local._ZN4llvm23M68kGenRegisterBankInfo8RegBanksE+0x0): multiple definition of `llvm::M68kGenRegisterBankInfo::RegBanks'; ../../lib/libLLVMM68kCodeGen.a(M68kRegisterBankInfo.cpp.o):(.data.rel.local._ZN4llvm23M68kGenRegisterBankInfo8RegBanksE+0x0): first defined here
> /usr/bin/ld: ../../lib/libLLVMM68kCodeGen.a(M68kSubtarget.cpp.o):(.bss._ZN4llvm4M68k10GPRRegBankE+0x0): multiple definition of `llvm::M68k::GPRRegBank'; ../../lib/libLLVMM68kCodeGen.a(M68kRegisterBankInfo.cpp.o):(.bss._ZN4llvm4M68k10GPRRegBankE+0x0): first defined here

Could you please have a look?

I think this change broke apt.llvm.org

Confirmed: reverting this change fixed the link issue

modimo added a comment.EditedJun 20 2021, 5:08 PM

I think this change broke apt.llvm.org

Confirmed: reverting this change fixed the link issue

What build command/Cmake setting repros this? M68kSubtarget.cpp is completely untouched by this change I'm surprised that reverting this fixes it. Did you bisect it down to this commit?