Page MenuHomePhabricator

Supporting -f(no)-reorder-functions flag, llvm side change
Needs ReviewPublic

Authored by twoh on Jun 28 2017, 6:05 PM.

Details

Summary

When profile data is given, .hot/.unlikely section prefix is
added to hot/cold functions for linker to improve code locality. GCC
controls this behavior with '-f(no)-reorder-functions' flag, while LLVM
uses opt tool option '-profile-guided-section-prefix=true/false'. This
patch is for LLVM to support the same driver flag with GCC. Clang side
patch with test cases will follow.

Event Timeline

twoh created this revision.Jun 28 2017, 6:05 PM
twoh added a comment.Jul 31 2017, 8:51 AM

Ping. Thanks!

davidxl added inline comments.Jul 31 2017, 9:45 AM
lib/CodeGen/CodeGenPrepare.cpp
306

Can TM be null?

twoh added a comment.Jul 31 2017, 9:55 AM

@davidxl I think it is theoretically possible, if the if branch is not taken on line 294. Did I miss something? Thanks!

Ping, plesse rebase

twoh updated this revision to Diff 170149.Oct 18 2018, 11:40 PM

Rebase. Tests are provided in the clang counterpart (D34796).