[PATCH] D82817: [llvm] Native size estimator for training -Oz inliner

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 9 16:26:24 PDT 2020


mtrofin added inline comments.


================
Comment at: llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp:263
+    return None;
+  auto Features = IRToNativeSizeLearning::getFunctionFeatures(
+      const_cast<Function &>(F), FAM);
----------------
davidxl wrote:
> Can we make getFunctionFeatures directly return the filled tensor -- or at least provide a wrapper? There is no need to expose the TF details with the inline sequence here.
I'm planning on reusing getFunctionFeatures for the other part of this functionality - extracting them to provide a training data set for the ir2native model.


================
Comment at: llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp:268
+  std::vector<TF_Tensor *> Output{nullptr};
+  if (!Evaluator->evaluate(Output))
+    return None;
----------------
davidxl wrote:
> Code from line 268 to 271 can probably be wrapped in a single wrapper function to hide TF details including Tensor delete
Ya, and it looks nicer - thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82817





More information about the llvm-commits mailing list