[MLIR][LLVM] Preserve unknown function metadata on import
Import representable non-debug function metadata without a kind-specific
dialect conversion into `LLVMFuncOp` `function_metadata`. Preserve repeated
metadata kinds through the generic carrier so LLVM IR import and export can
round-trip the supported generic metadata subset.
Warn and drop attachments outside that subset while continuing to import the
function.
[MLIR][LLVM] Translate LLVMFuncOp function metadata
Materialize LLVMFuncOp function_metadata through ModuleTranslation metadata conversion. Attach function metadata after module-level symbols are mapped so metadata references to functions, globals, aliases, and ifuncs can be resolved.
[MLIR][LLVM] Add function metadata to LLVMFuncOp
Add a generic LLVM dialect carrier for LLVM IR function metadata on LLVMFuncOp.
Represent attachments as an ordered list so repeated metadata kinds, such as
multiple type metadata attachments, can be preserved while keeping metadata names
language-agnostic.
[MLIR][LLVM] Preserve global value metadata operands on import (#203017)
Import metadata operands that refer to an `llvm::GlobalValue` as
`#llvm.md_global_value` attributes. Resolve each reference to the MLIR
symbol assigned during module import, retaining synthesized names for
nameless globals.
Report unsupported metadata when an operand has no symbol-backed
representation in the imported module. This covers local values,
intrinsics with dedicated import conversions, and `llvm.global_ctors` or
`llvm.global_dtors`.
[RISCV][NFC] Move RISCVCodeGenPrepare Declarations
This change moves them into their own header, as has been done for the
other NewPM passes.
Assisted-by: AI
[RISCV][NFC] Move ZacasABIFix Pass Declaration
This change moves them into their own header, as has been done for the
other NewPM passes.
Assisted-by: AI
[clang][bytecode] Clean up SourceMapper related code (#215528)
Instead of having different `SourceMapper` implementations, just ask the
`Function` directly if we have one, and fall back to the `SourceMapper`
otherwise.
We now only have one `SourceMapper` implementation though:
`EvalEmitter`. And the only reason we have this is so we don't have a
circular dependency between `InterpState` and `EvalEmitter`.
[DebugInfo][NFC] Add typed DIExpression operand views (#215682)
DIExpression users check an opcode and then read its arguments with
numbered getArg() calls. Add typed views for the operations with
repeated raw accesses and use their named accessors in those consumers.
The views reuse ExprOperand's pointer storage and LLVM's cast helpers. A
failed dyn_cast returns an empty view, so conditional matches don't need
an optional wrapper. Reading one is a bug, so getOp() and getArg() now
assert the operand is there rather than dereferencing null.
The only interesting change is that getActiveBits loses the fallthrough
from its extract case into its fragment case. The two shared one read
because both opcodes keep their size in the same argument; now each
names its own through its view and they share a lambda for
the narrowing. A unit test covers both paths.
Overall a bit more code, but quite a bit more readable IMO.
[2 lines not shown]
[WebAssembly][DAGCombine] Avoid scalarizing v8i8 to v8f16 conversions (#213636)
WebAssembly FP16 can convert `v8i16` to `v8f16`, but direct `v8i8` to
`v8f16` conversions were scalarized during SelectionDAG type
legalization.
This results in lane extractions, scalar conversions, calls to
`__truncsfhf2`, and reconstruction of the result vector.
We should extend `v8i8` to `v8i16` in `performVectorExtendToFPCombine`
before type legalization. This allows the existing WebAssembly combines
to select:
- `i16x8.extend_low_i8x16_{s,u}`
- `f16x8.convert_i16x8_s`
[mlir][NFC] Remove internal linkage from core header function templates (#214756)
These are more of the cases fixed alongside #208001, which enabled
-Wunused-template under -Wall. Each template is `static` in a widely
included header, so clang warns in every TU that includes it without
instantiating it. Dropping `static` gives them vague linkage and
silences the warning.
[mlir][NFC] Remove internal linkage from reshape op helper templates (#214759)
Another case of the cleanup done for #208001, which enabled
-Wunused-template under -Wall. Both helpers are `static` in
ReshapeOpsUtils.h, which reaches many TUs via Linalg.h, Tensor.h and
MemRef.h, so clang warns wherever they are not instantiated. Dropping
`static` gives them vague linkage.
[RISCV][NFC] Move ZacasABIFix Pass Declaration
This change moves them into their own header, as has been done for the
other NewPM passes.
Assisted-by: AI
[RISCV][NFC] Move RISCVCodeGenPrepare Declarations
This change moves them into their own header, as has been done for the
other NewPM passes.
Assisted-by: AI
[Perf2bolt] Support multi-PID filtering for multiple perf inputs (#215541)
#199324 added support for multiple perf inputs in perf2bolt. Building on
that, this patch additionally supports filtering by multiple PIDs via
--pid=pid1,pid2...