llvm.org GIT mirror llvm / 1347623
PR9218: SimplifyDemandedVectorElts can return a non-null value that is not the instruction passed in. Make sure to account for this correctly, instead of looping infinitely. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126058 91177308-0d34-0410-b5e6-96231b3b80d8 Eli Friedman 8 years ago
2 changed file(s) with 18 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
425425 unsigned VWidth = cast(VecOp->getType())->getNumElements();
426426 APInt UndefElts(VWidth, 0);
427427 APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
428 if (SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts))
428 if (Value *V = SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts)) {
429 if (V != &IE)
430 return ReplaceInstUsesWith(IE, V);
429431 return &IE;
432 }
430433
431434 return 0;
432435 }
450453
451454 APInt UndefElts(VWidth, 0);
452455 APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
453 if (SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) {
456 if (Value *V = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) {
457 if (V != &SVI)
458 return ReplaceInstUsesWith(SVI, V);
454459 LHS = SVI.getOperand(0);
455460 RHS = SVI.getOperand(1);
456461 MadeChange = true;
0 ; RUN: opt < %s -instcombine -S | FileCheck %s
1 ; PR9218
2
3 %vec2x2 = type { <2 x double>, <2 x double> }
4
5 define %vec2x2 @split(double) nounwind alwaysinline {
6 ; CHECK: @split
7 ; CHECK: ret %vec2x2 undef
8 %vba = insertelement <2 x double> undef, double %0, i32 2
9 ret <2 x double> %vba, <2 x double> %vba
10 }