Fix for PR3016: detect the tricky case, where there are
authorEli Friedman <eli.friedman@gmail.com>
Sun, 16 Aug 2009 04:23:49 +0000 (04:23 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 16 Aug 2009 04:23:49 +0000 (04:23 +0000)
commit12bb766ae9458b631e9acd97443345966788b5de
tree442c651740fa82b0b7666e8ab8ee0947b3667ffc
parent30c74a24290e7595dee4bb783b7f3e78595ae8c3
Fix for PR3016: detect the tricky case, where there are
unfoldable references to a PHI node in the block being folded, and disable
the transformation in that case.  The correct transformation of such PHI
nodes depends on whether BB dominates Succ, and dominance is expensive
to compute here.  (Alternatively, it's possible to check whether any
uses are live, but that's also essentially a dominance calculation.
Another alternative is to use reg2mem, but it probably isn't a good idea to
use that in simplifycfg.)

Also, remove some incorrect code from CanPropagatePredecessorsForPHIs
which is made unnecessary with this patch: it didn't consider the case
where a PHI node in BB has multiple uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79174 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/2009-01-18-PHIPropCrash.ll