This is an archive of the discontinued LLVM Phabricator instance.

[BOLT] Fix creation of invalid CFG in presence of dead code
ClosedPublic

Authored by rafauler on Apr 11 2023, 2:36 PM.

Details

Summary

When there is a direct jump right after an indirect one, in
the absence of code jumpting to this direct jump, this is obviously
dead code. However, BOLT was failing to recognize that by mistakenly
placing both jmp instructions in the same basic block, and creating
wrong successor edges. Fix that, so we can safely run UCE on
that. This bug also causes validateCFG to fail and BOLT to crash if it
is running ICP on that function.

Diff Detail

Event Timeline

rafauler created this revision.Apr 11 2023, 2:36 PM
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
rafauler requested review of this revision.Apr 11 2023, 2:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 11 2023, 2:37 PM
rafauler updated this revision to Diff 512592.Apr 11 2023, 2:48 PM

Make test case run UCE to check that we are really removing the
unnecessary direct jump instruction

Amir accepted this revision.Apr 11 2023, 3:45 PM

Thanks for fixing it!

This revision is now accepted and ready to land.Apr 11 2023, 3:45 PM