Page MenuHomePhabricator

[CallPromotionUtils] Add tryPromoteCall.

Authored by yamauchi on Dec 10 2019, 3:25 PM.



It attempts to devirtualize a call on alloca through vtable loads.

Diff Detail

Event Timeline

yamauchi created this revision.Dec 10 2019, 3:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 10 2019, 3:25 PM

This is split off of D69591.

Any comment?

davidxl added inline comments.Jan 9 2020, 12:22 PM

nit: VTableLoad --> VTablePointerLoad


VTable --> VTablePtr


Is this possible?

yamauchi updated this revision to Diff 238606.Jan 16 2020, 1:51 PM
yamauchi marked 4 inline comments as done.

Address comments and rebase.


I think so. It's possible that some ill-formed vtable or the entry contains a null (function) pointer.

davidxl accepted this revision.Jan 16 2020, 3:09 PM


This revision is now accepted and ready to land.Jan 16 2020, 3:09 PM

This depends on D71307 and wouldn't work without it. Can you take a look at that again?

yamauchi updated this revision to Diff 241579.Thu, Jan 30, 2:06 PM

Rebase past D71307.

davidxl added inline comments.Thu, Jan 30, 2:14 PM

Can you also add a negative test case?

yamauchi updated this revision to Diff 241851.Fri, Jan 31, 5:16 PM
yamauchi marked an inline comment as done.

Address comment.

Add negative tests.

Also add a new test is derived from
clang/test/CodeGenCXX/member-function-pointer-calls.cpp which this change
combined with D69591 enables nice inlining/simplification.

This revision was automatically updated to reflect the committed changes.