mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
fix ComputeMaskedBits handling of zext/sext/trunc to work with vectors.
This fixes PR4905 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81174 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -232,12 +232,16 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
|
||||
// FALL THROUGH and handle them the same as zext/trunc.
|
||||
case Instruction::ZExt:
|
||||
case Instruction::Trunc: {
|
||||
const Type *SrcTy = I->getOperand(0)->getType();
|
||||
|
||||
unsigned SrcBitWidth;
|
||||
// Note that we handle pointer operands here because of inttoptr/ptrtoint
|
||||
// which fall through here.
|
||||
const Type *SrcTy = I->getOperand(0)->getType();
|
||||
unsigned SrcBitWidth = TD ?
|
||||
TD->getTypeSizeInBits(SrcTy) :
|
||||
SrcTy->getScalarSizeInBits();
|
||||
if (isa<PointerType>(SrcTy))
|
||||
SrcBitWidth = TD->getTypeSizeInBits(SrcTy);
|
||||
else
|
||||
SrcBitWidth = SrcTy->getScalarSizeInBits();
|
||||
|
||||
APInt MaskIn(Mask);
|
||||
MaskIn.zextOrTrunc(SrcBitWidth);
|
||||
KnownZero.zextOrTrunc(SrcBitWidth);
|
||||
@ -265,8 +269,7 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
|
||||
}
|
||||
case Instruction::SExt: {
|
||||
// Compute the bits in the result that are not present in the input.
|
||||
const IntegerType *SrcTy = cast<IntegerType>(I->getOperand(0)->getType());
|
||||
unsigned SrcBitWidth = SrcTy->getBitWidth();
|
||||
unsigned SrcBitWidth = I->getOperand(0)->getType()->getScalarSizeInBits();
|
||||
|
||||
APInt MaskIn(Mask);
|
||||
MaskIn.trunc(SrcBitWidth);
|
||||
|
Reference in New Issue
Block a user