[clang] [llvm] [CVP] Infer range return attribute (PR #99620)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 10:03:34 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:

Missing `FnChanged = true`?

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


More information about the cfe-commits mailing list