[PATCH] Allow blocks to be merged when one has an undef input to a phi.

Mark Lacey mark.lacey at apple.com
Mon Jun 17 10:41:23 PDT 2013


Hi All,

This is a relatively small patch I re-submitted last week which seems to have gotten lost in the shuffle. 

Can someone take a look and commit if everything looks good?

Thanks,

Mark


TryToSimplifyUncondBranchFromEmptyBlock was checking that any common
predecessors of the two blocks it is attempting to merge supply the
same incoming values to any phi in the successor block. This change
allows merging in the case where there is one or more incoming values
that are undef. The undef values are rewritten to match the non-undef
value that flows from the other edge.

Merged the tests from
- test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll
into
- test/Transforms/SimplifyCFG/EqualPHIEdgeBlockMerge.ll
and also added tests to this file for the situation addressed by this
patch.

<rdar://problem/12801861>
---
lib/Transforms/Utils/Local.cpp                     |  76 ++++++-
.../SimplifyCFG/2008-05-16-PHIBlockMerge.ll        | 131 -----------
.../SimplifyCFG/EqualPHIEdgeBlockMerge.ll          | 240 ++++++++++++++++++++-
3 files changed, 307 insertions(+), 140 deletions(-)
delete mode 100644 test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-blocks-to-be-merged-when-one-has-an-undef-inpu.patch
Type: text/x-patch
Size: 16602 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130617/c7bb8136/attachment.bin>


More information about the llvm-commits mailing list