[clang] [llvm] [AArch64][Driver] Fix behavior of +nofeat modifier on -mcpu (PR #203458)
Tomas Matheson via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 29 01:54:38 PDT 2026
================
@@ -340,14 +340,22 @@ void AArch64::ExtensionSet::disable(ArchExtKind E) {
disable(Dep.Later);
}
+static void setEnableIfMandatory(AArch64::ExtensionSet &Exts,
+ AArch64::ExtensionInfo E) {
+ if (Exts.BaseArch->DefaultExts.test(E.ID))
+ Exts.Enabled.set(E.ID);
+}
+
void AArch64::ExtensionSet::addCPUDefaults(const CpuInfo &CPU) {
LLVM_DEBUG(llvm::dbgs() << "addCPUDefaults(" << CPU.Name << ")\n");
BaseArch = &CPU.Arch;
AArch64::ExtensionBitset CPUExtensions = CPU.getImpliedExtensions();
- for (const auto &E : Extensions)
+ for (const auto &E : Extensions) {
if (CPUExtensions.test(E.ID))
enable(E.ID);
+ setEnableIfMandatory(*this, E);
----------------
tommat01 wrote:
I think the order is important here because the bitset is tracking whether each bit gets touched, and currently the arch defaults remain "untouched" but are interleaved with the cpu defaults which are "touched" (via `enable()`). It might make more sense to set the base arch defaults before adding the cpu defaults. In a separate loop before this sloop.
https://github.com/llvm/llvm-project/pull/203458
More information about the cfe-commits
mailing list