mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
[InstCombine] Replace an 'if' that should always be true with an assert.
The bitwidth of the operation should always be wider than the result width of the truncate since we don't recurse through any width changing operations. llvm-svn: 332055
This commit is contained in:
parent
a01ce37a7f
commit
c50865580a
@ -364,13 +364,12 @@ static bool canEvaluateTruncated(Value *V, Type *Ty, InstCombiner &IC,
|
||||
// UDiv and URem can be truncated if all the truncated bits are zero.
|
||||
uint32_t OrigBitWidth = OrigTy->getScalarSizeInBits();
|
||||
uint32_t BitWidth = Ty->getScalarSizeInBits();
|
||||
if (BitWidth < OrigBitWidth) {
|
||||
APInt Mask = APInt::getBitsSetFrom(OrigBitWidth, BitWidth);
|
||||
if (IC.MaskedValueIsZero(I->getOperand(0), Mask, 0, CxtI) &&
|
||||
IC.MaskedValueIsZero(I->getOperand(1), Mask, 0, CxtI)) {
|
||||
return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI) &&
|
||||
canEvaluateTruncated(I->getOperand(1), Ty, IC, CxtI);
|
||||
}
|
||||
assert(BitWidth < OrigBitWidth && "Unexpected bitwidths!");
|
||||
APInt Mask = APInt::getBitsSetFrom(OrigBitWidth, BitWidth);
|
||||
if (IC.MaskedValueIsZero(I->getOperand(0), Mask, 0, CxtI) &&
|
||||
IC.MaskedValueIsZero(I->getOperand(1), Mask, 0, CxtI)) {
|
||||
return canEvaluateTruncated(I->getOperand(0), Ty, IC, CxtI) &&
|
||||
canEvaluateTruncated(I->getOperand(1), Ty, IC, CxtI);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user