Commit r331416 breaks the big-endian PPC bot. On the big endian build, we

actually encounter constants wider than 64-bits. Add the guard to prevent
tripping the assert.

llvm-svn: 331420
This commit is contained in:
Nemanja Ivanovic 2018-05-03 01:04:13 +00:00
parent b082a8790c
commit 61ffbf21cd
1 changed files with 3 additions and 0 deletions

View File

@ -13984,6 +13984,9 @@ isMaskAndCmp0FoldingBeneficial(const Instruction &AndI) const {
const Value *Mask = AndI.getOperand(1);
// If the mask is suitable for andi. or andis. we should sink the and.
if (const ConstantInt *CI = dyn_cast<ConstantInt>(Mask)) {
// Can't handle constants wider than 64-bits.
if (CI->getBitWidth() > 64)
return false;
int64_t ConstVal = CI->getZExtValue();
return isUInt<16>(ConstVal) ||
(isUInt<16>(ConstVal >> 16) && !(ConstVal & 0xFFFF));