[PATCH] D129904: [Inline] Introduce function attribute to control maximum stack size of inlined functions

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 11:32:25 PDT 2022


wolfgangp added inline comments.


================
Comment at: llvm/lib/Analysis/InlineCost.cpp:164-166
 Optional<int> getStringFnAttrAsInt(CallBase &CB, StringRef AttrKind) {
-  Attribute Attr = CB.getFnAttr(AttrKind);
-  int AttrValue;
-  if (Attr.getValueAsString().getAsInteger(10, AttrValue))
-    return None;
-  return AttrValue;
+  return getStringFnAttrAsInt(CB.getFnAttr(AttrKind));
+}
----------------
kazu wrote:
> Do we need this?  It looks like your modification in `analyze()` is using `Optional<int> getStringFnAttrAsInt(Function *F, StringRef AttrKind)`, not the `CallBase &CB` variant.
> 
To me this seemed like the best way to avoid code duplication (of the code that I moved to the `Attribute` variant). 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129904/new/

https://reviews.llvm.org/D129904



More information about the llvm-commits mailing list