This is an archive of the discontinued LLVM Phabricator instance.

Set the prof weight correctly for call instructions in DeadArgumentElimination.
ClosedPublic

Authored by danielcdh on Mar 20 2017, 11:08 AM.

Details

Summary

In DeadArgumentElimination, the call instructions will be replaced. We also need to set the prof weights so that function inlining can find the correct profile.

Event Timeline

danielcdh created this revision.Mar 20 2017, 11:08 AM
eraman added inline comments.Mar 22 2017, 2:01 PM
lib/IR/Instruction.cpp
658

Nit: "...call and invoke instructions"

659

Why is this guard needed? Is there a difference in handling an instruction with no metadata and one with a call weight of 0?

test/Transforms/DeadArgElim/prof.ll
1 ↗(On Diff #92362)

Nit: the file name is not very meaningful.

3 ↗(On Diff #92362)

reserved?

danielcdh updated this revision to Diff 92706.Mar 22 2017, 2:06 PM
danielcdh marked 4 inline comments as done.

update

danielcdh added inline comments.Mar 22 2017, 2:06 PM
lib/IR/Instruction.cpp
659

It should not be needed, removed.

eraman edited edge metadata.Mar 22 2017, 5:03 PM

LGTM after you fix the test case.

lib/IR/Instruction.cpp
658

Nit: "call and invoke instructions"

test/Transforms/DeadArgElim/call_profile.ll
7

Could you add the test case for the non va_arg case as well? There are two places in the code where a new instruction is created and you should check both the cases (or optionally refactor the code so that the new instruction creation and metadata copying is done in one helper function)

danielcdh updated this revision to Diff 92744.Mar 22 2017, 5:14 PM
danielcdh marked 2 inline comments as done.

update

eraman accepted this revision.Mar 23 2017, 4:14 PM
This revision is now accepted and ready to land.Mar 23 2017, 4:14 PM
danielcdh closed this revision.Mar 23 2017, 4:38 PM