[llvm] r245047 - Centralize the information about which object format we are using.

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 14 08:06:12 PDT 2015


Hi Rafael -

I'm getting 2 'make check' failures on Darwin after this commit:

FAIL: LLVM :: CodeGen/MSP430/indirectbr.ll (3223 of 14474)
******************** TEST 'LLVM :: CodeGen/MSP430/indirectbr.ll' FAILED
********************
Script:
--
/Users/spatel/thellvm/cmake_all/./bin/llc -march=msp430 <
/Users/spatel/thellvm/llvm/test/CodeGen/MSP430/indirectbr.ll
--
Exit Code: 132

Command Output (stderr):
--
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"), function cast, file
/Users/spatel/thellvm/llvm/include/llvm/Support/Casting.h, line 237.
0  llc                      0x000000010beb9c9e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  llc                      0x000000010bebb569
PrintStackTraceSignalHandler(void*) + 25
2  llc                      0x000000010beb8259
llvm::sys::RunSignalHandlers() + 425
3  llc                      0x000000010bebb8ee SignalHandler(int) + 366
4  libsystem_platform.dylib 0x00007fff9195bf1a _sigtramp + 26
5  libsystem_platform.dylib 0x0000000000000002 _sigtramp + 1852457218
6  llc                      0x000000010bebb58b raise + 27
7  llc                      0x000000010bebb642 abort + 18
8  llc                      0x000000010bebb621 __assert_rtn + 129
9  llc                      0x000000010a75b53e
llvm::cast_retty<llvm::MCSymbolELF, llvm::MCSymbol*>::ret_type
llvm::cast<llvm::MCSymbolELF, llvm::MCSymbol>(llvm::MCSymbol*) + 110
10 llc                      0x000000010b042faf
llvm::AsmPrinter::EmitGlobalVariable(llvm::GlobalVariable const*) + 5535
11 llc                      0x000000010b0472a8
llvm::AsmPrinter::doFinalization(llvm::Module&) + 248
12 llc                      0x000000010b7afa2c
llvm::FPPassManager::doFinalization(llvm::Module&) + 92
13 llc                      0x000000010b7b052a (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 1946
14 llc                      0x000000010b7afba6
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 310
15 llc                      0x000000010b7b0a81
llvm::legacy::PassManager::run(llvm::Module&) + 33
16 llc                      0x0000000109f48cf3 compileModule(char**,
llvm::LLVMContext&) + 10755
17 llc                      0x0000000109f46286 main + 230
18 libdyld.dylib            0x00007fff8af5e5c9 start + 1
Stack dump:
0.    Program arguments: /Users/spatel/thellvm/cmake_all/./bin/llc
-march=msp430
/Users/spatel/thellvm/cmake_all/test/CodeGen/MSP430/Output/indirectbr.ll.script:
line 1: 74403 Illegal instruction: 4
/Users/spatel/thellvm/cmake_all/./bin/llc -march=msp430 <
/Users/spatel/thellvm/llvm/test/CodeGen/MSP430/indirectbr.ll

--

********************
FAIL: LLVM :: CodeGen/MSP430/indirectbr2.ll (3257 of 14474)
******************** TEST 'LLVM :: CodeGen/MSP430/indirectbr2.ll' FAILED
********************
Script:
--
/Users/spatel/thellvm/cmake_all/./bin/llc -march=msp430 <
/Users/spatel/thellvm/llvm/test/CodeGen/MSP430/indirectbr2.ll |
/Users/spatel/thellvm/cmake_all/./bin/FileCheck
/Users/spatel/thellvm/llvm/test/CodeGen/MSP430/indirectbr2.ll
--
Exit Code: 2

Command Output (stderr):
--
Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"), function cast, file
/Users/spatel/thellvm/llvm/include/llvm/Support/Casting.h, line 237.
0  llc                      0x000000010c03dc9e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  llc                      0x000000010c03f569
PrintStackTraceSignalHandler(void*) + 25
2  llc                      0x000000010c03c259
llvm::sys::RunSignalHandlers() + 425
3  llc                      0x000000010c03f8ee SignalHandler(int) + 366
4  libsystem_platform.dylib 0x00007fff9195bf1a _sigtramp + 26
5  libsystem_platform.dylib 0x0000000000000002 _sigtramp + 1852457218
6  llc                      0x000000010c03f58b raise + 27
7  llc                      0x000000010c03f642 abort + 18
8  llc                      0x000000010c03f621 __assert_rtn + 129
9  llc                      0x000000010a8df53e
llvm::cast_retty<llvm::MCSymbolELF, llvm::MCSymbol*>::ret_type
llvm::cast<llvm::MCSymbolELF, llvm::MCSymbol>(llvm::MCSymbol*) + 110
10 llc                      0x000000010b1c6faf
llvm::AsmPrinter::EmitGlobalVariable(llvm::GlobalVariable const*) + 5535
11 llc                      0x000000010b1cb2a8
llvm::AsmPrinter::doFinalization(llvm::Module&) + 248
12 llc                      0x000000010b933a2c
llvm::FPPassManager::doFinalization(llvm::Module&) + 92
13 llc                      0x000000010b93452a (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 1946
14 llc                      0x000000010b933ba6
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 310
15 llc                      0x000000010b934a81
llvm::legacy::PassManager::run(llvm::Module&) + 33
16 llc                      0x000000010a0cccf3 compileModule(char**,
llvm::LLVMContext&) + 10755
17 llc                      0x000000010a0ca286 main + 230
18 libdyld.dylib            0x00007fff8af5e5c9 start + 1
Stack dump:
0.    Program arguments: /Users/spatel/thellvm/cmake_all/./bin/llc
-march=msp430
FileCheck error: '-' is empty.

--

********************
                                                      -- Testing: 14474
tests, 8 threads --
Testing Time: 416.03s
********************
Failing Tests (2):
    LLVM :: CodeGen/MSP430/indirectbr.ll
    LLVM :: CodeGen/MSP430/indirectbr2.ll

  Expected Passes    : 14282
  Expected Failures  : 111
  Unsupported Tests  : 79
  Unexpected Failures: 2

On Fri, Aug 14, 2015 at 7:31 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Fri Aug 14 08:31:17 2015
> New Revision: 245047
>
> URL: http://llvm.org/viewvc/llvm-project?rev=245047&view=rev
> Log:
> Centralize the information about which object format we are using.
>
> Other than some places that were handling unknown as ELF, this should
> have no change. The test updates are because we were detecting
> arm-coff or x86_64-win64-coff as ELF targets before.
>
> It is not clear if the enum should live on the Triple. At least now it
> lives
> in a single location and should be easier to move somewhere else.
>
> Removed:
>     llvm/trunk/test/MC/COFF/ARM/directive-type-diagnostics.s
> Modified:
>     llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
>     llvm/trunk/lib/MC/MCContext.cpp
>     llvm/trunk/lib/MC/MCObjectFileInfo.cpp
>     llvm/trunk/lib/MC/MCParser/AsmParser.cpp
>     llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
>     llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
>     llvm/trunk/test/CodeGen/X86/statepoint-stackmap-format.ll
>
> Modified: llvm/trunk/include/llvm/MC/MCObjectFileInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectFileInfo.h?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/MC/MCObjectFileInfo.h (original)
> +++ llvm/trunk/include/llvm/MC/MCObjectFileInfo.h Fri Aug 14 08:31:17 2015
> @@ -331,13 +331,9 @@ public:
>      return EHFrameSection;
>    }
>
> -  enum Environment { IsMachO, IsELF, IsCOFF };
> -  Environment getObjectFileType() const { return Env; }
> -
>    Reloc::Model getRelocM() const { return RelocM; }
>
>  private:
> -  Environment Env;
>    Reloc::Model RelocM;
>    CodeModel::Model CMModel;
>    MCContext *Ctx;
>
> Modified: llvm/trunk/lib/MC/MCContext.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCContext.cpp (original)
> +++ llvm/trunk/lib/MC/MCContext.cpp Fri Aug 14 08:31:17 2015
> @@ -162,13 +162,15 @@ MCSymbol *MCContext::getOrCreateLSDASymb
>  MCSymbol *MCContext::createSymbolImpl(const StringMapEntry<bool> *Name,
>                                        bool IsTemporary) {
>    if (MOFI) {
> -    switch (MOFI->getObjectFileType()) {
> -    case MCObjectFileInfo::IsCOFF:
> +    switch (MOFI->getTargetTriple().getObjectFormat()) {
> +    case Triple::COFF:
>        return new (Name, *this) MCSymbolCOFF(Name, IsTemporary);
> -    case MCObjectFileInfo::IsELF:
> +    case Triple::ELF:
>        return new (Name, *this) MCSymbolELF(Name, IsTemporary);
> -    case MCObjectFileInfo::IsMachO:
> +    case Triple::MachO:
>        return new (Name, *this) MCSymbolMachO(Name, IsTemporary);
> +    case Triple::UnknownObjectFormat:
> +      break;
>      }
>    }
>    return new (Name, *this) MCSymbol(MCSymbol::SymbolKindUnset, Name,
>
> Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
> +++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Fri Aug 14 08:31:17 2015
> @@ -767,25 +767,19 @@ void MCObjectFileInfo::InitMCObjectFileI
>
>    TT = TheTriple;
>
> -  Triple::ArchType Arch = TT.getArch();
> -  // FIXME: Checking for Arch here to filter out bogus triples such as
> -  // cellspu-apple-darwin. Perhaps we should fix in Triple?
> -  if ((Arch == Triple::x86 || Arch == Triple::x86_64 ||
> -       Arch == Triple::arm || Arch == Triple::thumb ||
> -       Arch == Triple::aarch64 ||
> -       Arch == Triple::ppc || Arch == Triple::ppc64 ||
> -       Arch == Triple::UnknownArch) &&
> -      TT.isOSBinFormatMachO()) {
> -    Env = IsMachO;
> +  Triple::ObjectFormatType Format = TT.getObjectFormat();
> +  switch (Format) {
> +  case Triple::MachO:
>      initMachOMCObjectFileInfo(TT);
> -  } else if ((Arch == Triple::x86 || Arch == Triple::x86_64 ||
> -              Arch == Triple::arm || Arch == Triple::thumb) &&
> -             (TT.isOSWindows() && TT.getObjectFormat() == Triple::COFF)) {
> -    Env = IsCOFF;
> +    break;
> +  case Triple::COFF:
>      initCOFFMCObjectFileInfo(TT);
> -  } else {
> -    Env = IsELF;
> +    break;
> +  case Triple::ELF:
>      initELFMCObjectFileInfo(TT);
> +    break;
> +  case Triple::UnknownObjectFormat:
> +    break;
>    }
>  }
>
> @@ -801,7 +795,9 @@ MCSection *MCObjectFileInfo::getDwarfTyp
>  }
>
>  void MCObjectFileInfo::InitEHFrameSection() {
> -  if (Env == IsMachO)
> +  Triple::ObjectFormatType Format = TT.getObjectFormat();
> +  switch (Format) {
> +  case Triple::MachO:
>      EHFrameSection =
>        Ctx->getMachOSection("__TEXT", "__eh_frame",
>                             MachO::S_COALESCED |
> @@ -809,14 +805,20 @@ void MCObjectFileInfo::InitEHFrameSectio
>                             MachO::S_ATTR_STRIP_STATIC_SYMS |
>                             MachO::S_ATTR_LIVE_SUPPORT,
>                             SectionKind::getReadOnly());
> -  else if (Env == IsELF)
> +    break;
> +  case Triple::ELF:
>      EHFrameSection =
>          Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags);
> -  else
> +    break;
> +  case Triple::COFF:
>      EHFrameSection =
>        Ctx->getCOFFSection(".eh_frame",
>                            COFF::IMAGE_SCN_CNT_INITIALIZED_DATA |
>                            COFF::IMAGE_SCN_MEM_READ |
>                            COFF::IMAGE_SCN_MEM_WRITE,
>                            SectionKind::getDataRel());
> +    break;
> +  case Triple::UnknownObjectFormat:
> +    break;
> +  }
>  }
>
> Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
> +++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Fri Aug 14 08:31:17 2015
> @@ -513,17 +513,19 @@ AsmParser::AsmParser(SourceMgr &SM, MCCo
>    Lexer.setBuffer(SrcMgr.getMemoryBuffer(CurBuffer)->getBuffer());
>
>    // Initialize the platform / file format parser.
> -  switch (Ctx.getObjectFileInfo()->getObjectFileType()) {
> -  case MCObjectFileInfo::IsCOFF:
> +  switch (Ctx.getObjectFileInfo()->getTargetTriple().getObjectFormat()) {
> +  case Triple::COFF:
>      PlatformParser.reset(createCOFFAsmParser());
>      break;
> -  case MCObjectFileInfo::IsMachO:
> +  case Triple::MachO:
>      PlatformParser.reset(createDarwinAsmParser());
>      IsDarwin = true;
>      break;
> -  case MCObjectFileInfo::IsELF:
> +  case Triple::ELF:
>      PlatformParser.reset(createELFAsmParser());
>      break;
> +  case Triple::UnknownObjectFormat:
> +    break;
>    }
>
>    PlatformParser->Initialize(*this);
>
> Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Fri Aug
> 14 08:31:17 2015
> @@ -4055,10 +4055,10 @@ bool AArch64AsmParser::MatchAndEmitInstr
>
>  /// ParseDirective parses the arm specific directives
>  bool AArch64AsmParser::ParseDirective(AsmToken DirectiveID) {
> -  const MCObjectFileInfo::Environment Format =
> -    getContext().getObjectFileInfo()->getObjectFileType();
> -  bool IsMachO = Format == MCObjectFileInfo::IsMachO;
> -  bool IsCOFF = Format == MCObjectFileInfo::IsCOFF;
> +  Triple::ObjectFormatType Format =
> +
> getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
> +  bool IsMachO = Format == Triple::MachO;
> +  bool IsCOFF = Format == Triple::COFF;
>
>    StringRef IDVal = DirectiveID.getIdentifier();
>    SMLoc Loc = DirectiveID.getLoc();
>
> Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Aug 14
> 08:31:17 2015
> @@ -5173,18 +5173,11 @@ bool ARMAsmParser::parsePrefix(ARMMCExpr
>      return true;
>    }
>
> -  enum {
> -    COFF = (1 << MCObjectFileInfo::IsCOFF),
> -    ELF = (1 << MCObjectFileInfo::IsELF),
> -    MACHO = (1 << MCObjectFileInfo::IsMachO)
> -  };
>    static const struct PrefixEntry {
>      const char *Spelling;
>      ARMMCExpr::VariantKind VariantKind;
> -    uint8_t SupportedFormats;
>    } PrefixEntries[] = {
> -    { "lower16", ARMMCExpr::VK_ARM_LO16, COFF | ELF | MACHO },
> -    { "upper16", ARMMCExpr::VK_ARM_HI16, COFF | ELF | MACHO },
> +      {"lower16", ARMMCExpr::VK_ARM_LO16}, {"upper16",
> ARMMCExpr::VK_ARM_HI16},
>    };
>
>    StringRef IDVal = Parser.getTok().getIdentifier();
> @@ -5199,25 +5192,6 @@ bool ARMAsmParser::parsePrefix(ARMMCExpr
>      return true;
>    }
>
> -  uint8_t CurrentFormat;
> -  switch (getContext().getObjectFileInfo()->getObjectFileType()) {
> -  case MCObjectFileInfo::IsMachO:
> -    CurrentFormat = MACHO;
> -    break;
> -  case MCObjectFileInfo::IsELF:
> -    CurrentFormat = ELF;
> -    break;
> -  case MCObjectFileInfo::IsCOFF:
> -    CurrentFormat = COFF;
> -    break;
> -  }
> -
> -  if (~Prefix->SupportedFormats & CurrentFormat) {
> -    Error(Parser.getTok().getLoc(),
> -          "cannot represent relocation in the current file format");
> -    return true;
> -  }
> -
>    RefKind = Prefix->VariantKind;
>    Parser.Lex();
>
> @@ -8691,10 +8665,10 @@ bool ARMAsmParser::MatchAndEmitInstructi
>
>  /// parseDirective parses the arm specific directives
>  bool ARMAsmParser::ParseDirective(AsmToken DirectiveID) {
> -  const MCObjectFileInfo::Environment Format =
> -    getContext().getObjectFileInfo()->getObjectFileType();
> -  bool IsMachO = Format == MCObjectFileInfo::IsMachO;
> -  bool IsCOFF = Format == MCObjectFileInfo::IsCOFF;
> +  Triple::ObjectFormatType Format =
> +
> getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
> +  bool IsMachO = Format == Triple::MachO;
> +  bool IsCOFF = Format == Triple::COFF;
>
>    StringRef IDVal = DirectiveID.getIdentifier();
>    if (IDVal == ".word")
> @@ -8859,8 +8833,9 @@ void ARMAsmParser::onLabelParsed(MCSymbo
>  ///  ::= .thumbfunc symbol_name
>  bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
>    MCAsmParser &Parser = getParser();
> -  const auto Format =
> getContext().getObjectFileInfo()->getObjectFileType();
> -  bool IsMachO = Format == MCObjectFileInfo::IsMachO;
> +  Triple::ObjectFormatType Format =
> +
> getContext().getObjectFileInfo()->getTargetTriple().getObjectFormat();
> +  bool IsMachO = Format == Triple::MachO;
>
>    // Darwin asm has (optionally) function name after .thumb_func direction
>    // ELF doesn't
>
> Modified: llvm/trunk/test/CodeGen/X86/statepoint-stackmap-format.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/statepoint-stackmap-format.ll?rev=245047&r1=245046&r2=245047&view=diff
>
> ==============================================================================
> --- llvm/trunk/test/CodeGen/X86/statepoint-stackmap-format.ll (original)
> +++ llvm/trunk/test/CodeGen/X86/statepoint-stackmap-format.ll Fri Aug 14
> 08:31:17 2015
> @@ -1,5 +1,5 @@
>  ; RUN: llc < %s -mtriple="x86_64-pc-linux-gnu" | FileCheck %s
> -; RUN: llc < %s -mtriple="x86_64-pc-win64-coff" | FileCheck %s
> +; RUN: llc < %s -mtriple="x86_64-pc-unknown-elf" | FileCheck %s
>
>  ; This test is a sanity check to ensure statepoints are generating
> StackMap
>  ; sections correctly.  This is not intended to be a rigorous test of the
>
> Removed: llvm/trunk/test/MC/COFF/ARM/directive-type-diagnostics.s
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/COFF/ARM/directive-type-diagnostics.s?rev=245046&view=auto
>
> ==============================================================================
> --- llvm/trunk/test/MC/COFF/ARM/directive-type-diagnostics.s (original)
> +++ llvm/trunk/test/MC/COFF/ARM/directive-type-diagnostics.s (removed)
> @@ -1,10 +0,0 @@
> -// RUN: not llvm-mc -triple arm-coff -filetype asm -o /dev/null %s 2>&1 |
> FileCheck %s
> -// RUN: not llvm-mc -triple armeb-coff -filetype asm -o /dev/null %s 2>&1
> | FileCheck %s
> -// RUN: not llvm-mc -triple thumb-coff -filetype asm -o /dev/null %s 2>&1
> | FileCheck %s
> -// RUN: not llvm-mc -triple thumbeb-coff -filetype asm -o /dev/null %s
> 2>&1 | FileCheck %s
> -
> -        .type symbol 32
> -// CHECK: error: expected STT_<TYPE_IN_UPPER_CASE>, '#<type>', '%<type>'
> or "<type>"
> -// CHECK: .type symbol 32
> -// CHECK:              ^
> -
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150814/9956e129/attachment.html>


More information about the llvm-commits mailing list