[llvm] Add the 'initializes' attribute langref and support (PR #84803)
Jan Voung via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 06:53:58 PDT 2024
================
@@ -2032,6 +2033,30 @@ void Verifier::verifyParameterAttrs(AttributeSet Attrs, Type *Ty,
}
}
+ if (Attrs.hasAttribute(Attribute::Initializes)) {
+ auto Inits = Attrs.getAttribute(Attribute::Initializes)
+ .getValueAsConstantRangeList();
+ Check(!Inits.isEmptySet(),
+ "Attribute 'initializes' does not support empty list", V);
+ Check(!Inits.isFullSet(),
+ "Attribute 'initializes' does not support full list", V);
+
+ Check(Inits.getRange(0).getLower().slt(Inits.getRange(0).getUpper()),
+ "Attribute 'initializes' requires interval lower less than upper", V);
+ for (size_t i = 1; i < Inits.size(); i++) {
+ auto Previous = Inits.getRange(i - 1);
+ auto Current = Inits.getRange(i);
+ Check(Current.getLower().slt(Current.getUpper()),
+ "Attribute 'initializes' requires interval lower less than upper",
+ V);
+ Check(Current.getLower().sge(Previous.getLower()),
+ "Attribute 'initializes' requires intervals in ascending order!",
+ V);
+ Check(Current.getLower().sge(Previous.getUpper()),
----------------
jvoung wrote:
should this be sgt ?
https://github.com/llvm/llvm-project/pull/84803
More information about the llvm-commits
mailing list