[SimplifyCFG] Don't create unnecessary PHIs
authorJames Molloy <james.molloy@arm.com>
Wed, 16 Dec 2015 14:12:44 +0000 (14:12 +0000)
committerJames Molloy <james.molloy@arm.com>
Wed, 16 Dec 2015 14:12:44 +0000 (14:12 +0000)
commitf75627aa1c8c16e91d97377a7f790e24c1da723e
tree3519316102c17aed9df36cec2b01d0e7055f24c8
parent445afdff54f7e61dcfde73e1cdc438891951a503
[SimplifyCFG] Don't create unnecessary PHIs

In conditional store merging, we were creating PHIs when we didn't
need to. If the value to be predicated isn't defined in the block
we're predicating, then it doesn't need a PHI at all (because we only
deal with triangles and diamonds, any value not in the predicated BB
must dominate the predicated BB).

This fixes a large code size increase in some benchmarks in a popular embedded benchmark suite.

Now with a fix (and fixed tests) for the conformance issue seen in Chromium.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255767 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/merge-cond-stores-2.ll [new file with mode: 0644]