[PATCH] D104059: [WIP][Attributor] Derive AACallEdges attribute
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 13 10:46:08 PDT 2021
jdoerfert added inline comments.
================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:3881
+ friend AttributorCallGraph;
+};
+
----------------
Maybe call it AACallEdgeIterator?
================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:3935
+ /// Reference to Attributor needed for GraphTraits implementation.
+ Attributor &A;
+ friend CallEdgeIterator;
----------------
Don't store the Attributor instance, let the user pass it where needed.
================
Comment at: llvm/include/llvm/Transforms/IPO/Attributor.h:3961
+
+ Attributor &A;
+};
----------------
Same as above.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:8177
+ if (Fn && !A.isAssumedDead(IRPosition::value(*Val), this, &LivenessAA))
+ AddCalledFunction(Fn);
+ }
----------------
Rather than asking for liveness, use a generic value traversal to visit all potential values of Val. Each of which is a potential callee. Also make sure to handle the case where a callee is not known, e.g., a function pointer call. We need to add them to the call graph as unknown callees too.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:8182
+ // Visit all callable instructions.
+ A.checkForAllInstructions(ProcessCallInst, *this, Opcodes);
+
----------------
`checkForAllCallLikeInstructions`
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:8193
+ // TODO: Be more informative.
+ return "CallEdges";
+ }
----------------
Return at least the number as well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104059/new/
https://reviews.llvm.org/D104059
More information about the llvm-commits
mailing list