[PATCH] D118364: [BOLT] Remove peephole useless-branches pass

Vladislav Khmelevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 29 13:50:40 PST 2022


yota9 added a comment.

@Amir Hello! Yes, you're right, there are 256 bytes mismatch in .text.cold between binaries. But the fixBranches not only removed the useless condition branches, it also removed the useless unconditional branches. The example you can see in small function "00000000038bd9c4 <_ZN4llvm11InstVisitorINS_26PGOIndirectCallSiteVisitorEvE16delegateCallInstERNS_8CallInstE>:"

Previously after-bolt we had:
38bd9e5:	eb f3                	jmp    38bd9da <_ZN4llvm11InstVisitorINS_26PGOIndirectCallSiteVisitorEvE16delegateCallInstERNS_8CallInstE+0x16>
38bd9e7:	eb f1                	jmp    38bd9da <_ZN4llvm11InstVisitorINS_26PGOIndirectCallSiteVisitorEvE16delegateCallInstERNS_8CallInstE+0x16>

And now:
38bd9e5:	eb f3                	jmp    38bd9da <_ZN4llvm11InstVisitorINS_26PGOIndirectCallSiteVisitorEvE16delegateCallInstERNS_8CallInstE+0x16>
38bd9e7:	90                   	nop

The second jump was emitted since previously we didn't run eraseInvalidBBs() after peephole pass, although in fact this instruction (which is in separate BB) becomes unreachable.
Although the binaries are not identical, but it seems to be reasonable change :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118364/new/

https://reviews.llvm.org/D118364



More information about the llvm-commits mailing list