[all-commits] [llvm/llvm-project] 069e9b: [RISCV] Overwrite cpu target features for full arc...

Luke Lau via All-commits all-commits at lists.llvm.org
Tue Jan 16 22:32:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 069e9b44954cad452eb6be4d1e3b924e7dda8de0
      https://github.com/llvm/llvm-project/commit/069e9b44954cad452eb6be4d1e3b924e7dda8de0
  Author: Luke Lau <luke at igalia.com>
  Date:   2024-01-17 (Wed, 17 Jan 2024)

  Changed paths:
    M clang/lib/Basic/Targets/RISCV.cpp
    M clang/test/CodeGen/RISCV/riscv-func-attr-target.c

  Log Message:
  -----------
  [RISCV] Overwrite cpu target features for full arch string in target attribute (#77426)

This patch reworks RISCVTargetInfo::initFeatureMap to fix the issue
described
in
https://github.com/llvm/llvm-project/pull/74889#pullrequestreview-1773445559
(and is an alternative to #75804)

When a full arch string is specified, a "full" list of extensions is now
passed
after the __RISCV_TargetAttrNeedOverride marker feature, which includes
any
negative features that disable ISA extensions.

In initFeatureMap, there are now two code paths:

1. If the arch string was overriden, use the "full" list of override
features,
only adding back any non-isa features that were specified.

Using the full list of positive and negative features will mean that the
target-cpu will have no effect on the final arch, e.g.
__attribute__((target("arch=rv64i"))) with -mcpu=sifive-x280 will have
the
features for rv64i, not a mix of both.

2. Otherwise, parse and *append* the list of implied features. By
appending, we
turn back on any features that might have been disabled by a negative
extension, i.e. this handles the case fixed in #74889.




More information about the All-commits mailing list