================
@@ -363,6 +363,14 @@ void NVPTXInstPrinter::printMemOperand(const MCInst *MI, 
int OpNum,
   }
 }
 
+void NVPTXInstPrinter::printOffseti32imm(const MCInst *MI, int OpNum,
+                                         raw_ostream &O, const char *Modifier) 
{
+  if (auto &Op = MI->getOperand(OpNum); Op.isImm() && Op.getImm() == 0)
+    return; // don't print '+0'
+  O << "+";
+  printOperand(MI, OpNum, O);
----------------
Artem-B wrote:

Nit: No need for the early return here. Also, instead of just ignoring 
non-immediate operands, we should probablly assert it, as that should never 
happen.

```
  auto &Op = MI->getOperand(OpNum); 
  assert(Op.isImm() && "Invalid operand");
  if (Op.getImm() != 0)) {
    O << "+";
    printOperand(MI, OpNum, O);
  }
```

https://github.com/llvm/llvm-project/pull/113017
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to