[PATCH] D148514: [BranchFolding] Remove redundant conditional branch.

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 17 20:30:58 PDT 2023


skatkov added inline comments.


================
Comment at: llvm/lib/CodeGen/BranchFolding.cpp:1684
+      if (CurTBB && IsBranchOnlyBlock(MBB) &&
+          AreOperandsIdentical(CurCond, PriorCond) && !MBB->hasAddressTaken() &&
+          !MBB->isEHPad()) {
----------------
goldstein.w.n wrote:
> Does this take into account comparisons against memory? The pointer (operand) stays the same but value in memory is modified in BB1?
BB1 is a predecessor or MBB? For MBB we check that it is IsBranchOnlyBlock(MBB).

you mean that predecessor may contains store AFTER conditional branch and conditional branch itself may reference memory?



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

https://reviews.llvm.org/D148514



More information about the llvm-commits mailing list