This is an archive of the discontinued LLVM Phabricator instance.

Add instruction_count MD to imported functions
AbandonedPublic

Authored by Prazek on Aug 3 2016, 5:03 PM.

Details

Reviewers
tejohnson
eraman
Summary

To check what kind of functions that get imported are inlined
I need the function size, counted while importing.

Diff Detail

Event Timeline

Prazek updated this revision to Diff 66738.Aug 3 2016, 5:03 PM
Prazek retitled this revision from to Add instruction_count MD to imported functions.
Prazek updated this object.
Prazek added reviewers: eraman, tejohnson.
Prazek added a subscriber: llvm-commits.
Prazek added inline comments.Aug 3 2016, 5:05 PM
include/llvm/Transforms/IPO/FunctionImport.h
32 ↗(On Diff #66738)

This one is small change, that I don't know if you like or not, so I didn't want to push it without review.

include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h
80 ↗(On Diff #66738)

This one is should not be part of patch. I will remove it.

Prazek updated this revision to Diff 66739.Aug 3 2016, 5:06 PM

removed some line that I will post in text patch

eraman edited edge metadata.Aug 3 2016, 5:24 PM

I can imaging you wanting other summary information (callsite count, for example) too. Why not create a broader summary metadata and put everything there?

include/llvm/Transforms/IPO/FunctionImport.h
32 ↗(On Diff #66739)

It seems unnecessary to me, but if you do this change you should use ImportThresholdTy everywhere Threshold is used.

Prazek added a comment.Aug 3 2016, 5:31 PM

I can imaging you wanting other summary information (callsite count, for example) too. Why not create a broader summary metadata and put everything there?

I don't have plans right now of using such information. Do you have idea how helpful it could be? If not then YAGNI

Prazek added inline comments.Aug 3 2016, 5:32 PM
include/llvm/Transforms/IPO/FunctionImport.h
32 ↗(On Diff #66739)

ok maybe I will look for such places. I just hate to see code that is trying to say something using comments instead of just using code (like types)

eraman added a comment.Aug 3 2016, 5:57 PM

I can imaging you wanting other summary information (callsite count, for example) too. Why not create a broader summary metadata and put everything there?

I don't have plans right now of using such information. Do you have idea how helpful it could be? If not then YAGNI

Ok, fair enough, given that the importing heuristic only uses inst count currently. If and when CallGraphEdgeList is used (particularly some of callee profile counts), I would expect that it'll be useful to have that data but can be added then.

tejohnson edited edge metadata.Aug 3 2016, 5:58 PM

I can imaging you wanting other summary information (callsite count, for example) too. Why not create a broader summary metadata and put everything there?

I don't have plans right now of using such information. Do you have idea how helpful it could be? If not then YAGNI

Streaming out the module summary to LLVM assembly has been on my TODO for awhile and would probably make all of this unnecessary. But that is a larger task. I would say just add what you need for now, since we may rip it out if/when the summary streaming is done.

BTW, the description would be clearer if you change "counted while importing" to "recorded from the summary during importing". I misunderstood what the patch was doing from the description, until I looked at the changes.

include/llvm/Transforms/IPO/FunctionImport.h
32 ↗(On Diff #66739)

This is unrelated to the rest of the change and should be committed as a separate patch, if at all, but I don't think it is really necessary.

lib/Transforms/IPO/FunctionImport.cpp
604

Why did this move? I guess it makes more sense to have it before the optional EnableImportMetadata block, but could you commit that separately as an NFC patch?

618

"thinlto_inst_count" would make it clearer.

test/Transforms/FunctionImport/funcimport.ll
70

Check for !instructions_count here and elsewhere?

Prazek marked 7 inline comments as done.Aug 4 2016, 2:21 PM
Prazek added inline comments.
test/Transforms/FunctionImport/funcimport.ll
70

Can I don't match for the count?

Prazek updated this revision to Diff 66856.Aug 4 2016, 2:22 PM
Prazek marked an inline comment as done.
Prazek edited edge metadata.

Update

tejohnson accepted this revision.Aug 4 2016, 3:04 PM
tejohnson edited edge metadata.
tejohnson added inline comments.
test/Transforms/FunctionImport/funcimport.ll
70

Yeah that's fine

This revision is now accepted and ready to land.Aug 4 2016, 3:04 PM
tejohnson requested changes to this revision.Aug 4 2016, 4:05 PM
tejohnson edited edge metadata.

Let's discuss Mehdi's point about simply using the summary to get this information during inlining first.

This revision now requires changes to proceed.Aug 4 2016, 4:05 PM
Prazek abandoned this revision.Oct 8 2016, 9:17 AM