mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
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
This commit is contained in:
@ -426,8 +426,11 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
|
||||
unsigned VWidth = cast<VectorType>(VecOp->getType())->getNumElements();
|
||||
APInt UndefElts(VWidth, 0);
|
||||
APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
|
||||
if (SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts))
|
||||
if (Value *V = SimplifyDemandedVectorElts(&IE, AllOnesEltMask, UndefElts)) {
|
||||
if (V != &IE)
|
||||
return ReplaceInstUsesWith(IE, V);
|
||||
return &IE;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -451,7 +454,9 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
|
||||
|
||||
APInt UndefElts(VWidth, 0);
|
||||
APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
|
||||
if (SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) {
|
||||
if (Value *V = SimplifyDemandedVectorElts(&SVI, AllOnesEltMask, UndefElts)) {
|
||||
if (V != &SVI)
|
||||
return ReplaceInstUsesWith(SVI, V);
|
||||
LHS = SVI.getOperand(0);
|
||||
RHS = SVI.getOperand(1);
|
||||
MadeChange = true;
|
||||
|
Reference in New Issue
Block a user