Skip to content

Commit ab28e87

Browse files
committed
Apply feedback from Artem-B
1 parent ca17ab3 commit ab28e87

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,12 @@ void NVPTXInstPrinter::printMemOperand(const MCInst *MI, int OpNum,
365365

366366
void NVPTXInstPrinter::printOffseti32imm(const MCInst *MI, int OpNum,
367367
raw_ostream &O, const char *Modifier) {
368-
if (auto &Op = MI->getOperand(OpNum); Op.isImm() && Op.getImm() == 0)
369-
return; // don't print '+0'
370-
O << "+";
371-
printOperand(MI, OpNum, O);
368+
auto &Op = MI->getOperand(OpNum);
369+
assert(Op.isImm() && "Invalid operand");
370+
if (Op.getImm() != 0) {
371+
O << "+";
372+
printOperand(MI, OpNum, O);
373+
}
372374
}
373375

374376
void NVPTXInstPrinter::printProtoIdent(const MCInst *MI, int OpNum,

0 commit comments

Comments
 (0)