[all-commits] [llvm/llvm-project] f45b9d: [RISCV] Add canonical ISA string as Module metadat...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Feb 13 16:18:02 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f45b9d987dfc5904d4129aa006ab20614b3174e3
      https://github.com/llvm/llvm-project/commit/f45b9d987dfc5904d4129aa006ab20614b3174e3
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/test/CodeGen/RISCV/ntlh-intrinsics/riscv32-zihintntl.c
    A clang/test/CodeGen/RISCV/riscv-metadata-arch.c

  Log Message:
  -----------
  [RISCV] Add canonical ISA string as Module metadata in IR. (#80760)

In an LTO build, we don't set the ELF attributes to indicate what
extensions were compiled with. The target CPU/Attrs in
RISCVTargetMachine do not get set for an LTO build. Each function gets a
target-cpu/feature attribute, but this isn't usable to set ELF attributs
since we wouldn't know what function to use. We can't just once since it
might have been compiler with an attribute likes target_verson.

This patch adds the ISA as Module metadata so we can retrieve it in the
backend. Individual translation units can still be compiled with
different strings so we need to collect the unique set when Modules are
merged.

The backend will need to combine the unique ISA strings to produce a
single value for the ELF attributes. This will be done in a separate
patch.




More information about the All-commits mailing list