[all-commits] [llvm/llvm-project] 935086: [AsmParser] Add support for reading incomplete IR ...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jan 19 07:08:28 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9350860824a8badbbfe2ba81804e163543da2173
      https://github.com/llvm/llvm-project/commit/9350860824a8badbbfe2ba81804e163543da2173
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2024-01-19 (Fri, 19 Jan 2024)

  Changed paths:
    M llvm/include/llvm/AsmParser/LLParser.h
    M llvm/include/llvm/IR/GlobalObject.h
    M llvm/include/llvm/IR/Instruction.h
    M llvm/include/llvm/IR/Metadata.h
    M llvm/include/llvm/IR/Value.h
    M llvm/lib/AsmParser/LLParser.cpp
    M llvm/lib/IR/Metadata.cpp
    A llvm/test/Assembler/incomplete-ir-metadata-unsupported.ll
    A llvm/test/Assembler/incomplete-ir-metadata.ll

  Log Message:
  -----------
  [AsmParser] Add support for reading incomplete IR (part 1) (#78421)

Add an `-allow-incomplete-ir` flag to the IR parser, which allows
reading IR with missing declarations. This is intended to produce a
best-effort interpretation of the IR, along the same lines of what we
would manually do when taking, for example, a function from
`-print-after-all` output and fixing it up to be valid IR.

This patch only supports dropping references to undeclared metadata,
either by dropping metadata attachments from instructions/functions, or
by dropping calls to certain intrinsics (like debug intrinsics). I will
implement support for inserting missing function/global declarations in
a followup patch.

We don't have real use lists for metadata, so the approach here is to
iterate over the whole IR and identify metadata that needs to be
dropped. This does not support all possible cases, but should handle
anything that's relevant for the function-only IR use case.




More information about the All-commits mailing list