[PATCH] D88293: [ControlDependentDCE] Add Control Dependent DCE pass

Masaki Arai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 20:51:25 PDT 2020


masakiarai added a comment.

> That said, I still am not convinced this is best implemented in a new pass. Isn't the idea here that we have the value of a branch condition available for a subset of the incoming paths? That sounds like it would compose well with other ways through which we can know the value of a conditional for a subset of the incoming paths w/o having multiple branches with the same condition:

I'm sorry that the explanation of the purpose of this pass is not clear.

By classifying the values that reach a basic block's entry, you can generally apply optimization by duplicating the basic block and deleting the conditional branch instruction.
If you use the variables referenced by the comparison instruction instead of the condition code, you will have more optimization opportunities than in this version of the implementation.
I think GVN should implement such optimizations.

The following cases may be beyond the functionality of GVN-related passes.

    Ba
   / \
  X   Y
   \ /
    R
    |\
    | \
    B
   / \
  T   F

In this case, by duplicating R, there is an opportunity to delete B's conditional branch instruction.
R may not be a single basic block, but a code region containing loops.
If it's better to create a version that includes this implementation before proposing, I'll update the patch with code that includes it.

I released this revision because I confirmed that this had been applied to test-suite benchmarks in the case of hundreds or more.


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

https://reviews.llvm.org/D88293



More information about the llvm-commits mailing list