From afff73cb5aae41b42bb1dc8949fa21e9838e7a92 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 30 Jul 2016 13:25:37 +0000 Subject: [PATCH] [Hexagon] Perform bit arithmetic on unsigned to avoid accidentally shifting negative values. Found by ubsan. llvm-svn: 277268 --- llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp index c043f5b..8a2444a 100644 --- a/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp +++ b/llvm/lib/Target/Hexagon/HexagonConstPropagation.cpp @@ -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); -- 2.7.4