This is an archive of the discontinued LLVM Phabricator instance.

[JumpThreading] Use profile data even with the new pass manager
ClosedPublic

Authored by kazu on Nov 20 2019, 1:37 PM.

Details

Summary

Without this patch, the jump threading pass ignores profiling data
whenever we invoke the pass with the new pass manager.

Specifically, JumpThreadingPass::run calls runImpl with class variable
HasProfileData always set to false. In turn, runImpl sets
HasProfileData to false again:

HasProfileData = HasProfileData_;

In the end, we don't use profiling data at all with the new pass
manager.

This patch fixes the problem by passing F.hasProfileData() to runImpl.

The bug appears to have been introduced at:

https://reviews.llvm.org/D41461

which removed local variable HasProfileData in JumpThreadingPass::run
even though there was one more use left in the same function. As a
result, the remaining use ended referring to the class variable
instead.

Note that F.hasProfileData is an extremely lightweight function, so I
don't see the need to cache its result. Once this patch is approved,
I'm planning to stop caching the result of F.hasProfileData in
runOnFunction.

Event Timeline

kazu created this revision.Nov 20 2019, 1:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2019, 1:37 PM
Herald added subscribers: jfb, hiraditya. · View Herald Transcript
efriedma accepted this revision.Nov 21 2019, 1:41 PM
efriedma added a subscriber: efriedma.

LGTM

This revision is now accepted and ready to land.Nov 21 2019, 1:41 PM
This revision was automatically updated to reflect the committed changes.