Skip to content

Commit 490d7bb

Browse files
committed
Xtensa: Remove unneeded XtensaMCExpr::create calls
MCSpecifierExpr and its subclasses should only be used with the relocation specifier is not zero.
1 parent 72de33a commit 490d7bb

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ bool XtensaAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
393393
case Xtensa::L32R: {
394394
const MCSymbolRefExpr *OpExpr =
395395
static_cast<const MCSymbolRefExpr *>(Inst.getOperand(1).getExpr());
396-
XtensaMCExpr::Specifier Kind = XtensaMCExpr::VK_None;
397-
const MCExpr *NewOpExpr = XtensaMCExpr::create(OpExpr, Kind, getContext());
398-
Inst.getOperand(1).setExpr(NewOpExpr);
396+
Inst.getOperand(1).setExpr(OpExpr);
399397
break;
400398
}
401399
case Xtensa::MOVI: {
@@ -413,10 +411,8 @@ bool XtensaAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
413411
const MCExpr *Value = MCConstantExpr::create(ImmOp64, getContext());
414412
MCSymbol *Sym = getContext().createTempSymbol();
415413
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, getContext());
416-
const MCExpr *OpExpr =
417-
XtensaMCExpr::create(Expr, XtensaMCExpr::VK_None, getContext());
418414
TmpInst.addOperand(Inst.getOperand(0));
419-
MCOperand Op1 = MCOperand::createExpr(OpExpr);
415+
MCOperand Op1 = MCOperand::createExpr(Expr);
420416
TmpInst.addOperand(Op1);
421417
TS.emitLiteral(Sym, Value, true, IDLoc);
422418
Inst = TmpInst;
@@ -428,10 +424,8 @@ bool XtensaAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
428424
const MCExpr *Value = Inst.getOperand(1).getExpr();
429425
MCSymbol *Sym = getContext().createTempSymbol();
430426
const MCExpr *Expr = MCSymbolRefExpr::create(Sym, getContext());
431-
const MCExpr *OpExpr =
432-
XtensaMCExpr::create(Expr, XtensaMCExpr::VK_None, getContext());
433427
TmpInst.addOperand(Inst.getOperand(0));
434-
MCOperand Op1 = MCOperand::createExpr(OpExpr);
428+
MCOperand Op1 = MCOperand::createExpr(Expr);
435429
TmpInst.addOperand(Op1);
436430
Inst = TmpInst;
437431
TS.emitLiteral(Sym, Value, true, IDLoc);

llvm/lib/Target/Xtensa/XtensaAsmPrinter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ XtensaAsmPrinter::LowerSymbolOperand(const MachineOperand &MO,
257257
}
258258

259259
const MCExpr *ME = MCSymbolRefExpr::create(Symbol, OutContext);
260-
ME = XtensaMCExpr::create(ME, Kind, OutContext);
261260

262261
if (Offset) {
263262
// Assume offset is never negative.

0 commit comments

Comments
 (0)