[Hexagon] Perform bit arithmetic on unsigned to avoid accidentally shifting negative values.

Found by ubsan.

llvm-svn: 277268
This commit is contained in:
Benjamin Kramer 2016-07-30 13:25:37 +00:00
parent 96cb6bfa27
commit afff73cb5a

View File

@ -2047,8 +2047,8 @@ bool HexagonConstEvaluator::evaluate(const MachineInstr &MI,
case Hexagon::A2_combineii: // combine(#s8Ext, #s8)
case Hexagon::A4_combineii: // combine(#s8, #u6Ext)
{
int64_t Hi = MI.getOperand(1).getImm();
int64_t Lo = MI.getOperand(2).getImm();
uint64_t Hi = MI.getOperand(1).getImm();
uint64_t Lo = MI.getOperand(2).getImm();
uint64_t Res = (Hi << 32) | (Lo & 0xFFFFFFFF);
IntegerType *Ty = Type::getInt64Ty(CX);
const ConstantInt *CI = ConstantInt::get(Ty, Res, false);