Introduce a cost interface which determines whether internalizing a function is worthwhile.
Diff Detail
Event Timeline
For now the patch only contains the interface and is still WIP. I will update it with more detailed algorithm later.
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
145 | Make the names more descriptive and add plenty doxygen documentation for all of them. Maybe put them all in a struct so the user could modify the values by changing the struct members. | |
llvm/lib/Transforms/IPO/Attributor.cpp | ||
2212 | I somehow think the method called here should be "shouldInternalize" or something. The problem here is that it "looks" like we internalize if there is an associated cost, e.g., the cost is not zero. |
- Cache the InternalizeCost for every function
What I am thinking is that we need to calculate the cost after all dependencies between
AAs become clear. So I think we need to do the cost analysis after the fix point
iteration (or after the first update is done).
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
145 | Sure, I will add docs once I figure out the when to do such cost analysis and what |
llvm/include/llvm/Transforms/IPO/Attributor.h | ||
---|---|---|
195 | There is no need for dynamic allocation here. Let's just return a value, it's only 16 bytes on most systems so easy to copy and with the advantage that we don't leak memory ;) |
Make the names more descriptive and add plenty doxygen documentation for all of them. Maybe put them all in a struct so the user could modify the values by changing the struct members.