[PATCH] D132450: StructurizeCFG: Set Undef for non-predecessors in setPhiValues()
Ruiling, Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 01:39:48 PDT 2022
ruiling created this revision.
ruiling added reviewers: foad, critson, sameerds, nhaehnle.
Herald added subscribers: kosarev, kerbowa, hiraditya, jvesely.
Herald added a project: All.
ruiling requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
During structurization process, we may place non-predecessor blocks
between the predecessors of a block in the structurized CFG. Take
the typical while-break case as an example:
|
/---A(v=...)
| / \ |
|
^ B C
| \ / |
|
\---L |
\ /
E (r=phi (v:C)...)
After structurization, the CFG would be look like:
|
/---A
| | \ |
| | C |
| | / |
| F1 <https://reviews.llvm.org/F1> |
|
^ |\
| | B |
| | / |
| F2 <https://reviews.llvm.org/F2> |
| | \ |
| | L |
|
\ |/
\--F3
|
E
We can see that block B is placed between the predecessors(C/L) of E.
During phi reconstruction, to achieve the same sematics as before, we
are reconstructing the PHIs as:
F1: v1 = phi (v:C), (undef:A)
F3: r = phi (v1:F2), ...
But this is also saying that `v1` would be live through B, which is not
quite necessary. The idea in the change is to say the incoming value
from B is Undef for the PHI in E. With this change, the reconstructed
PHI would be:
F1: v1 = phi (v:C), (undef:A)
F2: v2 = phi (v1:F1), (undef:B)
F3: r = phi (v2:F2), ...
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D132450
Files:
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
llvm/test/CodeGen/AMDGPU/multilevel-break.ll
llvm/test/CodeGen/AMDGPU/while-break.ll
llvm/test/Transforms/StructurizeCFG/workarounds/needs-fr-ule.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132450.454742.patch
Type: text/x-patch
Size: 11157 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220823/66d6b88c/attachment.bin>
More information about the llvm-commits
mailing list