[all-commits] [llvm/llvm-project] bd4113: [clang] Use i64 for the !srcloc metadata on asm IR...

Simon Tatham via All-commits all-commits at lists.llvm.org
Thu Jul 22 02:25:16 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd41136746a0b47882914cee5a8d1ac6714288d1
      https://github.com/llvm/llvm-project/commit/bd41136746a0b47882914cee5a8d1ac6714288d1
  Author: Simon Tatham <simon.tatham at arm.com>
  Date:   2021-07-22 (Thu, 22 Jul 2021)

  Changed paths:
    M clang/lib/CodeGen/CGStmt.cpp
    M llvm/include/llvm/IR/DiagnosticInfo.h
    M llvm/include/llvm/IR/LLVMContext.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
    M llvm/lib/CodeGen/MachineInstr.cpp
    M llvm/lib/IR/LLVMContext.cpp
    M llvm/test/MC/ARM/inline-asm-srcloc.ll

  Log Message:
  -----------
  [clang] Use i64 for the !srcloc metadata on asm IR nodes.

This is part of a patch series working towards the ability to make
SourceLocation into a 64-bit type to handle larger translation units.

!srcloc is generated in clang codegen, and pulled back out by llvm
functions like AsmPrinter::emitInlineAsm that need to report errors in
the inline asm. From there it goes to LLVMContext::emitError, is
stored in DiagnosticInfoInlineAsm, and ends up back in clang, at
BackendConsumer::InlineAsmDiagHandler(), which reconstitutes a true
clang::SourceLocation from the integer cookie.

Throughout this code path, it's now 64-bit rather than 32, which means
that if SourceLocation is expanded to a 64-bit type, this error report
won't lose half of the data.

The compiler will tolerate both of i32 and i64 !srcloc metadata in
input IR without faulting. Test added in llvm/MC. (The semantic
accuracy of the metadata is another matter, but I don't know of any
situation where that matters: if you're reading an IR file written by
a previous run of clang, you don't have the SourceManager that can
relate those source locations back to the original source files.)

Original version of the patch by Mikhail Maltsev.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D105491




More information about the All-commits mailing list