This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Ensure we always select the same function copy to import
ClosedPublic

Authored by tejohnson on Jul 14 2017, 1:12 PM.

Details

Summary

Check if the first eligible callee is under the instruction threshold.
Checking this on the first eligible callee ensures that we don't end
up selecting different callees to import when we invoke this routine
with different thresholds due to reaching the callee via paths that
are shallower or hotter (when there are multiple copies, i.e. with
weak or linkonce linkage). We don't want to leave the decision of which
copy to import up to the backend.

Diff Detail

Repository
rL LLVM

Event Timeline

tejohnson created this revision.Jul 14 2017, 1:12 PM
This revision is now accepted and ready to land.Jul 14 2017, 1:58 PM
This revision was automatically updated to reflect the committed changes.

Unfortunately I had to revert this in r308206. A ThinLTO bot was failing with a linker undefined reference error:
http://green.lab.llvm.org/green/job/clang-stage2-configure-Rthinlto_build/3663/

It seems unlikely that this heuristic change would directly cause that, but I don't have time to dig into it at the moment. Hopefully it is reproducible with lld or gold (this was ld64 on Darwin). I am not sure if I will have much time to spend looking into it this week, unfortunately.