[PATCH] D103694: [AMDGPU] Simplify handleAddressTakenFunctions. NFC.

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 02:58:47 PDT 2021


foad marked an inline comment as done.
foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp:244
+  for (CallGraphNode *CGN : Reachable) {
+    if (Function *F = CGN->getFunction())
+      Changed |= removeAttributes(F);
----------------
madhur13490 wrote:
> Please move this check inside the function otherwise every caller will have to do this check.
I disagree. "Remove attributes from F" is a simpler API than "remove attributes from F, except if F is null". I have changed removeAttributes to take a reference to make it more obvious that F must be a function.

Also, there is only one caller, and even before my patch there were two callers but only one of them had to cope with F possibly being null. This is caused by a quirk of the CallGraph which contains artificial nodes for external callers/callees, where getFunction returns null.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103694



More information about the llvm-commits mailing list