[llvm] [Verifier] Add checks for loop metadata nodes (PR #182252)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 05:47:14 PDT 2026


================
@@ -1145,6 +1146,60 @@ void Verifier::visitMDNode(const MDNode &MD, AreDebugLocsAllowed AllowLocs) {
   Check(MD.isResolved(), "All nodes should be resolved!", &MD);
 }
 
+// Loop attributes that require exactly two operands (name + i1).
+static const StringRef LoopBooleanAttributeNames[] = {
+    "llvm.loop.distribute.enable",
+    "llvm.loop.vectorize.enable",
+};
+
+// Loop attributes that allow only a single operand (just the name).
+// TODO: This is not an exhaustive list and can also include attributes
+//       like llvm.loop.licm_versioning.disable.
+static const StringRef LoopSingleOperandAttributeNames[] = {
+    "llvm.loop.unroll.disable",
+    "llvm.loop.unroll.enable",
+    "llvm.loop.unroll.full",
+    "llvm.loop.unroll_and_jam.enable",
+    "llvm.loop.unroll_and_jam.disable",
+};
----------------
arsenm wrote:

> For the one-operand versions, what is the difference between false and "absent attribute"? 

This is one of the issues with storing a pointless boolean value. There cannot be a difference, there needs to be a default value. And an the existence of an explicit false value is just a meaningless representation 

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


More information about the llvm-commits mailing list