[AArch64][Driver] +nofeat modifier on -mcpu is ineffective when feat is an implied mandatory feature
After the fix in #78270, there are cases where the +nofeat modifier on -mcpu has no effect. For example, Neoverse V2 does not directly enable FEAT_SB in its definition, but the feature is automatically implied because it is mandatory in Armv9. For such features, specifying -mcpu=neoverse-v2+nosb fails to disable FEAT_SB.
Reproducer: https://godbolt.org/z/48Y7dbKeP
Before #78270, "-target-feature" "-sb" was emitted, but after the patch it is no longer emitted.
The following code ignores a +nofeat modifier when the feature was not enabled in the first place. It appears that mandatory features implied by the base architecture are not included in the default feature set.
https://github.com/llvm/llvm-project/blob/c9f09d305b555d0312cc76e665ba919be2d78236/llvm/lib/TargetParser/AArch64TargetParser.cpp#L329-L330
Should the fix either include such implied mandatory features in the defaults, or always pass through a negative feature when the user explicitly specifies +nofeat?
@llvm/issue-subscribers-backend-aarch64
Author: Yuta Mukai (ytmukai)
Reproducer: https://godbolt.org/z/48Y7dbKeP
Before #78270, "-target-feature" "-sb" was emitted, but after the patch it is no longer emitted.
The following code ignores a +nofeat modifier when the feature was not enabled in the first place. It appears that mandatory features implied by the base architecture are not included in the default feature set.
https://github.com/llvm/llvm-project/blob/c9f09d305b555d0312cc76e665ba919be2d78236/llvm/lib/TargetParser/AArch64TargetParser.cpp#L329-L330
Should the fix either include such implied mandatory features in the defaults, or always pass through a negative feature when the user explicitly specifies +nofeat?
@llvm/issue-subscribers-clang-driver
Author: Yuta Mukai (ytmukai)
Reproducer: https://godbolt.org/z/48Y7dbKeP
Before #78270, "-target-feature" "-sb" was emitted, but after the patch it is no longer emitted.
The following code ignores a +nofeat modifier when the feature was not enabled in the first place. It appears that mandatory features implied by the base architecture are not included in the default feature set.
https://github.com/llvm/llvm-project/blob/c9f09d305b555d0312cc76e665ba919be2d78236/llvm/lib/TargetParser/AArch64TargetParser.cpp#L329-L330
Should the fix either include such implied mandatory features in the defaults, or always pass through a negative feature when the user explicitly specifies +nofeat?
Hi, I'm working on this issue. Could you assign it to me?