This is an archive of the discontinued LLVM Phabricator instance.

[JumpThreading] Copy profile metadata on select unfolding
AbandonedPublic

Authored by rp on Nov 1 2022, 7:55 AM.

Details

Reviewers
None
Summary

When select is unfolded, copy profile metadata attached
to the select to a newly created branch

Diff Detail

Event Timeline

rp created this revision.Nov 1 2022, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 7:55 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
rp updated this revision to Diff 472309.Nov 1 2022, 8:18 AM
rp edited the summary of this revision. (Show Details)

comment text

rp added a comment.Nov 1 2022, 8:24 AM
This comment was removed by rp.
rp published this revision for review.Nov 1 2022, 8:28 AM

This patch addresses losing of the profile attribute during jump-threading, later causing not ideal block merge due to missing profile in shouldFoldCondBranchesToCommonDestination() where blocks are merged in case branch probability is unknown (and it is unknown as it was not propagated from select to br).

Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 8:28 AM

We should update BPI\BFI in a similar way as it is done in updateBlockFreqAndEdgeWeight.

rp updated this revision to Diff 474018.Nov 8 2022, 8:40 AM
rp edited the summary of this revision. (Show Details)

Added setEdgeProbability/setBlockFreq

rp updated this revision to Diff 474057.Nov 8 2022, 11:27 AM

clang-format

Looks OK, except mentioned nit.

llvm/lib/Transforms/Scalar/JumpThreading.cpp
2768

You should check sum of TrueWeight and FalseWeight is not 0

rp updated this revision to Diff 474279.Nov 9 2022, 8:02 AM

check TrueWeight and FalseWeight for division by 0

rp abandoned this revision.Nov 16 2022, 5:59 AM