[PATCH] D122929: [BOLT] Fix remove double jumps peephole pass

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 15:49:49 PDT 2022


rafauler added a comment.

Thanks for fixing! I think we should probably modify MCPlusBuilder.h instead. In that way we make the AArch64 backend behave in the same way as the X86 one.



================
Comment at: bolt/lib/Passes/BinaryPasses.cpp:700
         MCInst *Branch = Pred->getLastNonPseudoInstr();
-        if (Branch && MIB->isUnconditionalBranch(*Branch)) {
-          assert(MIB->getTargetSymbol(*Branch) == BB.getLabel());
+        if (Branch && MIB->isUnconditionalBranch(*Branch) &&
+            MIB->getTargetSymbol(*Branch) == BB.getLabel()) {
----------------
This is out of sync with X86.  In X86, isUnconditionalBranch only returns true if it is also not a tail call:

  return Analysis->isBranch(Inst) && !isTailCall(Inst);

For consistency, AArch64MCPlusBuilder should probably do the same at MCPlusBuilder.h:356.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122929

STAMPS
actor(@rafauler) application(Differential) author(@yota9) herald(H45) herald(H114) herald(H428) herald(H501) herald(H576) herald(H704) herald(H765) herald(H842) herald(H844) herald(H845) herald(H847) herald(H855) herald(H864) monogram(D122929) object-type(DREV) phid(PHID-DREV-mpcqgdjgytwl6igt4gh3) reviewer(@Amir) reviewer(@maksfb) reviewer(@rafauler) revision-repository(rG) revision-status(needs-review) subscriber(@ayermolo) subscriber(@llvm-commits) tag(#all) tag(#llvm) via(web)



More information about the llvm-commits mailing list