[JumpThreading] Allow duplicating a basic block into preds when its branch condition...
authorJuneyoung Lee <aqjune@gmail.com>
Fri, 31 Jul 2020 14:25:56 +0000 (23:25 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Thu, 6 Aug 2020 00:51:17 +0000 (09:51 +0900)
commit9f717d7b941fbc42bef017b84c4dd0f65ce06e7a
tree7c68f64468e44616ab018d6c551b89689c38302d
parentfd86d67b82830f1365e1e25fd138832b475bc1e7
[JumpThreading] Allow duplicating a basic block into preds when its branch condition is freeze(phi)

This is the last JumpThreading patch for getting the performance numbers shown at
https://reviews.llvm.org/D84940#2184653 .

This patch makes ProcessBlock call ProcessBranchOnPHI when the branch condition
is freeze(phi) as well (originally it calls the function when the condition is
phi only).

Since what ProcessBranchOnPHI does is to duplicate the basic block into
predecessors if profitable, it is still valid when the condition is freeze(phi)
too.

```
    p = phi [a, pred1] [b, pred2]
    p.fr = freeze p
    br p.fr, ...
=>
  pred1:
    p.fr = freeze a
    br p.fr, ...
  pred2:
    p.fr2 = freeze b
    br p.fr2, ...
```

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D85029
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/test/Transforms/JumpThreading/phi-copy-to-pred.ll