[llvm-bugs] [Bug 34331] New: duplicate llc -mcpu=help for some architectures

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 25 15:48:23 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34331

            Bug ID: 34331
           Summary: duplicate llc -mcpu=help for some architectures
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ys114321 at gmail.com
                CC: llvm-bugs at lists.llvm.org

When adding llc -mcpu=help support to BPF, I found when the help output is
printed twice. Through some code study, I found the root cause in the below:
llvm:lib/Target/BPF/BPFTargetMachine.cpp:

BPFTargetMachine::BPFTargetMachine(const Target &T, const Triple &TT,
                                   StringRef CPU, StringRef FS,
                                   const TargetOptions &Options,
                                   Optional<Reloc::Model> RM,
                                   Optional<CodeModel::Model> CM,
                                   CodeGenOpt::Level OL, bool JIT)
    : LLVMTargetMachine(T, computeDataLayout(TT), TT, CPU, FS, Options,
                        getEffectiveRelocModel(RM), getEffectiveCodeModel(CM),
                        OL),
      TLOF(make_unique<TargetLoweringObjectFileELF>()),
      Subtarget(TT, CPU, FS, *this) {
  initAsmInfo();
}

Both Subtarget constructor and initAsmInfo will eventually create a
MCSubtargetInfo, which calls InitMCProcessorInfo.

void MCSubtargetInfo::InitMCProcessorInfo(StringRef CPU, StringRef FS) {
  FeatureBits = getFeatures(CPU, FS, ProcDesc, ProcFeatures);
  if (!CPU.empty())
    CPUSchedModel = &getSchedModelForCPU(CPU);
  else
    CPUSchedModel = &MCSchedModel::GetDefaultSchedModel();
}

If you have -mcpu=help in your command line
llc -march=<> -mcpu=help ...

The help information will be printed out twice because getFeatures will
printout
the help info if both ProcDesc and ProcFeatures are not empty.

Checked a few other architectures. X86 and ARM do not have this issue.
Lanai may have this issue as well:
LanaiTargetMachine::LanaiTargetMachine(const Target &T, const Triple &TT,
                                       StringRef Cpu, StringRef FeatureString,
                                       const TargetOptions &Options,
                                       Optional<Reloc::Model> RM,
                                       Optional<CodeModel::Model> CodeModel,
                                       CodeGenOpt::Level OptLevel, bool JIT)
    : LLVMTargetMachine(T, computeDataLayout(), TT, Cpu, FeatureString,
Options,
                        getEffectiveRelocModel(RM),
                        getEffectiveCodeModel(CodeModel), OptLevel),
      Subtarget(TT, Cpu, FeatureString, *this, Options, getCodeModel(),
                OptLevel),
      TLOF(new LanaiTargetObjectFile()) {
  initAsmInfo();
}

It is a lower priority bug as it does not really affect core functionality.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170825/2db66d1d/attachment.html>


More information about the llvm-bugs mailing list