[llvm] [Verifier] Reject incorrect types in assume operand bundles (PR #196446)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 09:02:51 PDT 2026


================
@@ -5994,11 +5994,28 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
               Call);
         continue;
       }
-      Check(Elem.Tag->getKey() == "ignore" ||
-                Attribute::isExistingAttribute(Elem.Tag->getKey()),
+      if (Elem.Tag->getKey() == "ignore")
+        break;
+      Check(Attribute::isExistingAttribute(Elem.Tag->getKey()),
             "tags must be valid attribute names", Call);
       Attribute::AttrKind Kind =
           Attribute::getAttrKindFromName(Elem.Tag->getKey());
+
+      // Reject assume bundles with incorrect types
+      if (Elem.Begin != Elem.End) {
+        AttributeSet AS = AttributeSet().addAttribute(Context, Kind);
+        AttributeMask IncompatibleAttrs = AttributeFuncs::typeIncompatible(
+            Call.getOperand(Elem.Begin)->getType(), AS);
+        for (Attribute Attr : AS) {
+          if (!Attr.isStringAttribute() &&
----------------
nikic wrote:

Can't be a string attribute, as we put in an enum attribute.

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


More information about the llvm-commits mailing list