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

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 8 12:47:27 PDT 2022


kazu 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));
+}
----------------
wolfgangp wrote:
> 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). 
Oops.  Sorry, I misread your code.  I thought you were adding `getStringFnAttrAsInt(CallBase &CB, StringRef AttrKind)`, which is not the case.


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

https://reviews.llvm.org/D129904



More information about the llvm-commits mailing list