This is an archive of the discontinued LLVM Phabricator instance.

[PartialInliner] Do not do partial inlining for functions with non-call references
ClosedPublic

Authored by davidxl on Apr 21 2017, 2:07 PM.

Details

Summary

This patch fixes another bug found when enabling partial inlining. The partial inliner does not check if the use of the function is a call use or not and blindly replace uses and forces inlining (of the wrong target). It can cause crashes during compile (e.g. with the test case)

Diff Detail

Repository
rL LLVM

Event Timeline

davidxl created this revision.Apr 21 2017, 2:07 PM
davide accepted this revision.Apr 21 2017, 2:19 PM

Yes, I was reducing the same. Some comments, but I had the same fix.
Are you running with -O3 or LTO? Where are you putting the inliner?

lib/Transforms/IPO/PartialInlining.cpp
89 ↗(On Diff #96226)

SmallVector<> maybe? (up to you)

96–97 ↗(On Diff #96226)

Is this bit needed?
I assume the invariant F != nullptr should always hold, at which point if we don't set Callee, so Callee != F is always true and we return false.
Does it make sense to you?

This revision is now accepted and ready to land.Apr 21 2017, 2:19 PM
This revision was automatically updated to reflect the committed changes.
efriedma added inline comments.
llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
104

Can you just call Function::hasAddressTaken instead?