[PATCH] [SROA] Fold a PHI node if all its incoming values are the same

Jingyue Wu jingyue at google.com
Mon Jul 28 18:41:05 PDT 2014


To avoid redundancy, use SimplifyInstruction to fold PHI nodes and select instructions. One tricky case is when clobbering one operand in 
```
select undef, a, b
```
we need to have the select always return the other operand by setting the condition "undef" to 0 or 1; otherwise, the transformation of clobbering dead operands may introduce new undefined behavior. Added test @simplify_undef in phi-and-select.ll to cover this case. 

Updated basictest.ll per this change.

http://reviews.llvm.org/D4659

Files:
  lib/Transforms/Scalar/SROA.cpp
  test/Transforms/SROA/basictest.ll
  test/Transforms/SROA/phi-and-select.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4659.11968.patch
Type: text/x-patch
Size: 9626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140729/1fa778af/attachment.bin>


More information about the llvm-commits mailing list