[PATCH] D105911: [CallGraphSection] Introduce CGSectionFuncComdatCreator pass

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 18 14:05:07 PDT 2021


MaskRay added inline comments.


================
Comment at: clang/lib/CodeGen/BackendUtil.cpp:1420
+
+    if (CodeGenOpts.CallGraphSection) {
+      MPM.addPass(CGSectionFuncComdatCreatorPass());
----------------
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements


================
Comment at: llvm/lib/Transforms/Utils/CGSectionFuncComdatCreator.cpp:64
+         F.hasAddressTaken(nullptr,
+                           /* IgnoreCallbackUses */ true,
+                           /* IgnoreAssumeLikeCalls */ true,
----------------
clang-format prefers `/*IgnoreCallbackUses=*/true`


================
Comment at: llvm/lib/Transforms/Utils/CGSectionFuncComdatCreator.cpp:91
+  ModuleCGSectionFuncComdatCreator ModuleCG;
+  if (ModuleCG.instrumentModule(M)) {
+    return PreservedAnalyses::none();
----------------
delete braces


================
Comment at: llvm/test/Transforms/Util/create-function-comdats.ll:1
+; Tests that we create function comdats properly and only for those with no
+; comdats.
----------------
This should be within a call-graph-section specific directory.

Use `test/Instrumentation/InstrProfiling/comdat.ll` as a reference


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105911



More information about the cfe-commits mailing list