Fix the undefined behaviour introduced by my previous patch r353865 (left
shifting a potentially negative value), which was caught by the bots that run
UBSan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@353874
91177308-0d34-0410-b5e6-
96231b3b80d8
// Branches can take an immediate operand. This is used by the branch
// selection pass to print .+8, an eight byte displacement from the PC.
O << ".";
- int32_t Imm = MI->getOperand(OpNo).getImm() << 2;
+ int32_t Imm = SignExtend32<32>((unsigned)MI->getOperand(OpNo).getImm() << 2);
if (Imm >= 0)
O << "+";
O << Imm;