Index: llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp =================================================================== --- llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp +++ llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp @@ -857,7 +857,7 @@ // A loaded value compared with 0 with multiple users becomes Load and // Test. The load is then not foldable, so return 0 cost for the ICmp. unsigned ScalarBits = ValTy->getScalarSizeInBits(); - if (I != nullptr && ScalarBits >= 32) + if (I != nullptr && ScalarBits >= 32 && ScalarBits <= 64) if (LoadInst *Ld = dyn_cast<LoadInst>(I->getOperand(0))) if (const ConstantInt *C = dyn_cast<ConstantInt>(I->getOperand(1))) if (!Ld->hasOneUse() && Ld->getParent() == I->getParent() && @@ -1020,7 +1020,7 @@ // Comparison between memory and immediate. if (UserI->getOpcode() == Instruction::ICmp) if (ConstantInt *CI = dyn_cast<ConstantInt>(UserI->getOperand(1))) - if (isUInt<16>(CI->getZExtValue())) + if (CI->getBitWidth() <= 64 && isUInt<16>(CI->getZExtValue())) return true; return (LoadOrTruncBits == 32 || LoadOrTruncBits == 64); break;