[PATCH] D157061: [SampleProfile] Potential use after move in SampleProfileLoader::promoteMergeNotInlinedContextSamples

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 22:06:14 PDT 2023


davidxl added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:1632
+        } else
+          NewFunctionSamples.emplace_back(Callee, *FS);
       }
----------------
is it enough to just use a flag to indicate insertion happens (instead of using a vector)? The getOrCreateSamples can set the flag.


================
Comment at: llvm/lib/Transforms/IPO/SampleProfile.cpp:1648
+  // existing FunctionSamples, so we need to update any fields with them.
+  if (NewFunctionSamples.size() > 0) {
+    updateFunctionSamplesPointers(F);
----------------
insertion does not mean rehashing happens. Is there a better way to avoid the unncessary update?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157061



More information about the llvm-commits mailing list