[all-commits] [llvm/llvm-project] 99c0a3: [RISCV] Enable target attribute when invoked throu...
Philip Reames via All-commits
all-commits at lists.llvm.org
Mon Dec 11 08:55:35 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 99c0a3ea98724798361c8ef72d07d9646dcb64ee
https://github.com/llvm/llvm-project/commit/99c0a3ea98724798361c8ef72d07d9646dcb64ee
Author: Philip Reames <preames at rivosinc.com>
Date: 2023-12-11 (Mon, 11 Dec 2023)
Changed paths:
M clang/lib/Basic/Targets/RISCV.cpp
M clang/test/CodeGen/RISCV/riscv-func-attr-target.c
Log Message:
-----------
[RISCV] Enable target attribute when invoked through clang driver (#74889)
d80e46d added support for the target function attribute. However, it
turns out that commit has a nasty bug/oversight. As the tests in that
revision show, everything works if clang -cc1 is directly invoked. I was
suprised to learn this morning that compiling with clang (i.e. the
typical user workflow) did not work.
The bug is that if a set of explicit negative extensions is passed to
cc1 at the command line (as the clang driver always does), we were
copying these negative extensions to the end of the rewritten extension
list. When this was later parsed, this had the effect of turning back
off any extension that the target attribute had enabled.
This patch updates the logic to only propagate the features from the
input which don't appear in the rewritten form in either positive or
negative form.
Note that this code structure is still highly suspect. In particular I'm
fairly sure that mixing extension versions with this code will result in
odd results. However, I figure its better to have something which mostly
works than something which doesn't work at all.
More information about the All-commits
mailing list