StructurizeCFG: simplify phi nodes when possible
authorSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>
Thu, 5 Mar 2020 03:39:46 +0000 (09:09 +0530)
committerSameer Sahasrabuddhe <sameer.sahasrabuddhe@amd.com>
Thu, 5 Mar 2020 05:03:15 +0000 (10:33 +0530)
commit42febbab913870ce43ea434f3a58937bf761bb2f
tree63508a47c9e7480a00af660afdeda3aeaa9b8e01
parent4c7c87f245c5291ed38d47983e89d69b98660008
StructurizeCFG: simplify phi nodes when possible

After structurization, some phi nodes can have a single incoming edge
and can be simplified away. This change runs a simplify query on all
phis that are either modified or added by the structurizer. This also
moves some phis closer to their use as a side benefit.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D75500
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
llvm/test/CodeGen/AMDGPU/loop_break.ll
llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll
llvm/test/Transforms/StructurizeCFG/AMDGPU/loop-subregion-misordered.ll