[SROA] Fold a PHI node if all its incoming values are the same
authorJingyue Wu <jingyue@google.com>
Fri, 22 Aug 2014 22:45:57 +0000 (22:45 +0000)
committerJingyue Wu <jingyue@google.com>
Fri, 22 Aug 2014 22:45:57 +0000 (22:45 +0000)
commit8be5600f0ad707b89d7f7d1c4cca202f0d3add07
treecc0edee1842e5fba8e9774168b3b7825208f2d81
parentd89c0abc0724945e3181f3aaef023b292e53baad
[SROA] Fold a PHI node if all its incoming values are the same

Summary:
Fixes PR20425.

During slice building, if all of the incoming values of a PHI node are the same, replace the PHI node with the common value. This simplification makes alloca's used by PHI nodes easier to promote.

Test Plan: Added three more tests in phi-and-select.ll

Reviewers: nlewycky, eliben, meheff, chandlerc

Reviewed By: chandlerc

Subscribers: zinovy.nis, hfinkel, baldrick, llvm-commits

Differential Revision: http://reviews.llvm.org/D4659

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216299 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/phi-and-select.ll