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

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sun May 10 02:48:49 PDT 2026


================
@@ -5994,16 +5994,29 @@ 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);
+        if (auto AttrKind = AS.begin()->getKindAsEnum();
+            IncompatibleAttrs.contains(AttrKind)) {
----------------
andjo403 wrote:

is AttrKind not the same as Kind so it can be removed?

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


More information about the llvm-commits mailing list