[PATCH] D83875: [XCOFF][AIX] Enable -ffunction-sections

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 12:04:17 PDT 2020


jasonliu marked 2 inline comments as done.
jasonliu added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2167
+  // XTY_ER property anyway.
+  if (TM.getFunctionSections() && !Func->isDeclaration() &&
+      isa<Function>(Func)) {
----------------
DiggerLin wrote:
> change  Func->isDeclaration() to Func->isDeclarationForLinker() ?
Sometimes I would get confused myself which query should be used. 
As far as I understand, isDelcarationForLinker includes linkage that's "AvailableExternally". But when does it actually matter for a function? In other words, what would go wrong if `isDeclaration()` is used here? 


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:2169
+      isa<Function>(Func)) {
+    XCOFF::StorageClass SC =
+        TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(Func);
----------------
DiggerLin wrote:
> SC only use  once.
Yes, but without this named variable, the return below would get extremely long, and harder to read. 


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

https://reviews.llvm.org/D83875





More information about the llvm-commits mailing list