[llvm] [IR][Verifier] Verification for `target-features` attribute (PR #173119)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 21 00:39:07 PST 2025


================
@@ -2613,6 +2613,17 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
     Check(FirstArgIdx > 0 && FirstArgIdx <= UpperBound,
           "modular-format attribute first arg index is out of bounds", V);
   }
+
+  if (auto A = Attrs.getFnAttr("target-features"); A.isValid()) {
+    StringRef S = A.getValueAsString();
+    SmallVector<StringRef> Args;
+    S.split(Args, ',', -1, false);
+    for (auto FeatureFlag : Args) {
----------------
nikic wrote:

```suggestion
    for (auto FeatureFlag : split(S, ',')) {
```
There's an iterator variant of this that does not require creating an intermediate vector.

https://github.com/llvm/llvm-project/pull/173119


More information about the llvm-commits mailing list