This is an archive of the discontinued LLVM Phabricator instance.

Migrate WholeProgramDevirt to new Optimization Remark API
ClosedPublic

Authored by lenary on Aug 20 2017, 2:42 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

lenary created this revision.Aug 20 2017, 2:42 PM

This patch segfaults in the following three tests:

LLVM :: Transforms/WholeProgramDevirt/devirt-single-impl-check.ll
LLVM :: Transforms/WholeProgramDevirt/devirt-single-impl.ll
LLVM :: Transforms/WholeProgramDevirt/virtual-const-prop-check.ll

Unfortunately I'm right at the edge of my C++ abilities, and can't actually work out how to make this work. The segfault is in computeHotness which uses the BFI code. I think it could be because a unique_ptr is being dropped, maybe? Any help would be greatly appreciated.

anemet added inline comments.Aug 20 2017, 7:22 PM
lib/Transforms/IPO/WholeProgramDevirt.cpp
523–526 ↗(On Diff #111908)

OwnedORE is freed here after the function returns and you're returning a pointer off of it.

I am not sure if we have any better options than just passing nullptr for OREGetter from the old PM path and build ORE at the use site if OREGetter is not set.

lenary updated this revision to Diff 111925.Aug 20 2017, 10:39 PM

No more Segfaults!

lenary edited the summary of this revision. (Show Details)Aug 20 2017, 10:54 PM
anemet accepted this revision.Aug 21 2017, 8:51 AM

LGTM with the nits below. We're done migrating!!!! Thanks for your work on this!

lib/Transforms/IPO/WholeProgramDevirt.cpp
1439 ↗(On Diff #111925)

Remove this line.

1441–1448 ↗(On Diff #111925)

A comment would be good, explaining the strategy with old vs new PM.

This revision is now accepted and ready to land.Aug 21 2017, 8:51 AM
lenary updated this revision to Diff 112008.Aug 21 2017, 9:56 AM

Add comments, remove unused code

lenary marked 2 inline comments as done.Aug 21 2017, 9:57 AM
This revision was automatically updated to reflect the committed changes.