mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-11 16:37:42 +00:00
Fix ConstantFoldShuffleVectorInstruction to properly handle the case
when the result type has a different # elements than the input vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149221 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
90fb059222
commit
0cd0d81492
@ -794,15 +794,17 @@ Constant *llvm::ConstantFoldInsertElementInstruction(Constant *Val,
|
||||
Constant *llvm::ConstantFoldShuffleVectorInstruction(Constant *V1,
|
||||
Constant *V2,
|
||||
Constant *Mask) {
|
||||
unsigned MaskNumElts = Mask->getType()->getVectorNumElements();
|
||||
Type *EltTy = V1->getType()->getVectorElementType();
|
||||
|
||||
// Undefined shuffle mask -> undefined value.
|
||||
if (isa<UndefValue>(Mask)) return UndefValue::get(V1->getType());
|
||||
if (isa<UndefValue>(Mask))
|
||||
return UndefValue::get(VectorType::get(EltTy, MaskNumElts));
|
||||
|
||||
// Don't break the bitcode reader hack.
|
||||
if (isa<ConstantExpr>(Mask)) return 0;
|
||||
|
||||
unsigned MaskNumElts = Mask->getType()->getVectorNumElements();
|
||||
unsigned SrcNumElts = V1->getType()->getVectorNumElements();
|
||||
Type *EltTy = V1->getType()->getVectorElementType();
|
||||
|
||||
// Loop over the shuffle mask, evaluating each element.
|
||||
SmallVector<Constant*, 32> Result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user