forked from OSchip/llvm-project
[InstCombine] remove unnecessary shuffle undef folding
Add a test for constant folding to show that (shuffle undef, undef, mask) should already be handled via instsimplify. llvm-svn: 340926
This commit is contained in:
parent
f6db5bcd38
commit
7a05641fa8
|
@ -1379,13 +1379,6 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
|
|||
// Canonicalize shuffle(x ,x,mask) -> shuffle(x, undef,mask')
|
||||
// Canonicalize shuffle(undef,x,mask) -> shuffle(x, undef,mask').
|
||||
if (LHS == RHS || isa<UndefValue>(LHS)) {
|
||||
if (isa<UndefValue>(LHS) && LHS == RHS) {
|
||||
// shuffle(undef,undef,mask) -> undef.
|
||||
Value *Result = (VWidth == LHSWidth)
|
||||
? LHS : UndefValue::get(SVI.getType());
|
||||
return replaceInstUsesWith(SVI, Result);
|
||||
}
|
||||
|
||||
// Remap any references to RHS to use LHS.
|
||||
SmallVector<Constant*, 16> Elts;
|
||||
for (unsigned i = 0, e = LHSWidth; i != VWidth; ++i) {
|
||||
|
|
|
@ -59,3 +59,11 @@ define <3 x float> @fadd_commute() {
|
|||
ret <3 x float> %c
|
||||
}
|
||||
|
||||
define <4 x i32> @shuffle_of_undefs(<4 x i32> %v1, <4 x i32> %v2) {
|
||||
; CHECK-LABEL: @shuffle_of_undefs(
|
||||
; CHECK-NEXT: ret <4 x i32> undef
|
||||
;
|
||||
%r = shufflevector <4 x i32> undef, <4 x i32> undef, <4 x i32> <i32 5, i32 1, i32 2, i32 3>
|
||||
ret <4 x i32> %r
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue