This is an archive of the discontinued LLVM Phabricator instance.

Directly return promoted direct call instead of rely on stripPointerCast.
ClosedPublic

Authored by danielcdh on Oct 5 2017, 2:50 PM.

Details

Summary

stripPointerCast is not reliably returning the value that's being type-casted. Instead it may look further at function attributes to further propagate the value. Instead of relying on stripPOintercast, the more reliable solution is to directly use the pointer to the promoted direct call.

Event Timeline

danielcdh created this revision.Oct 5 2017, 2:50 PM
tejohnson accepted this revision.Oct 6 2017, 8:25 AM

LGTM although I have a question on test

lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
565

Suggest adding a comment above here about what CastInst vs NewInst are for clarity.

test/Transforms/SampleProfile/indirect-call.ll
100

How is it checking the returned parameter?

This revision is now accepted and ready to land.Oct 6 2017, 8:25 AM
danielcdh marked an inline comment as done.Oct 6 2017, 8:54 AM

Thanks.

test/Transforms/SampleProfile/indirect-call.ll
100

Updated the comment to make it clearer. Please let me know if that clarifies the question.

danielcdh updated this revision to Diff 118010.Oct 6 2017, 8:54 AM

update comments

tejohnson added inline comments.Oct 6 2017, 9:01 AM
test/Transforms/SampleProfile/indirect-call.ll
100

Ok thanks.

danielcdh closed this revision.Oct 6 2017, 10:06 AM