[clang] [llvm] [CVP] Infer range return attribute (PR #99620)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 07:06:31 PDT 2024
================
@@ -1289,6 +1299,14 @@ static bool runImpl(Function &F, LazyValueInfo *LVI, DominatorTree *DT,
FnChanged |= BBChanged;
}
+ // Infer range attribute on return value.
+ if (RetRange && !RetRange->isFullSet()) {
+ Attribute RangeAttr = F.getRetAttribute(Attribute::Range);
+ if (RangeAttr.isValid())
+ RetRange = RetRange->intersectWith(RangeAttr.getRange());
+ if (!RetRange->isEmptySet() && !RetRange->isSingleElement())
+ F.addRangeRetAttr(*RetRange);
----------------
goldsteinn wrote:
Could we cause an inf loop if existing range attr is same as new one?
https://github.com/llvm/llvm-project/pull/99620
More information about the cfe-commits
mailing list