[llvm] 687854a - [MC] Remove unneeded VK_None argument from MCSymbolRefExpr::create. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 6 00:00:11 PST 2025


Author: Fangrui Song
Date: 2025-03-06T00:00:05-08:00
New Revision: 687854aea8fdb20525af749069cf19bf612eaf2b

URL: https://github.com/llvm/llvm-project/commit/687854aea8fdb20525af749069cf19bf612eaf2b
DIFF: https://github.com/llvm/llvm-project/commit/687854aea8fdb20525af749069cf19bf612eaf2b.diff

LOG: [MC] Remove unneeded VK_None argument from MCSymbolRefExpr::create. NFC

Added: 
    

Modified: 
    llvm/lib/MC/MCDwarf.cpp
    llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
    llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
    llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
    llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
    llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp
index c17e9151ee487..2525ff02878e4 100644
--- a/llvm/lib/MC/MCDwarf.cpp
+++ b/llvm/lib/MC/MCDwarf.cpp
@@ -916,8 +916,7 @@ static void EmitGenDwarfAranges(MCStreamer *MCOS,
     assert(StartSymbol && "StartSymbol must not be NULL");
     assert(EndSymbol && "EndSymbol must not be NULL");
 
-    const MCExpr *Addr = MCSymbolRefExpr::create(
-      StartSymbol, MCSymbolRefExpr::VK_None, context);
+    const MCExpr *Addr = MCSymbolRefExpr::create(StartSymbol, context);
     const MCExpr *Size =
         makeEndMinusStartExpr(context, *StartSymbol, *EndSymbol, 0);
     MCOS->emitValue(Addr, AddrSize);
@@ -1018,13 +1017,11 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
     assert(EndSymbol && "EndSymbol must not be NULL");
 
     // AT_low_pc, the first address of the default .text section.
-    const MCExpr *Start = MCSymbolRefExpr::create(
-        StartSymbol, MCSymbolRefExpr::VK_None, context);
+    const MCExpr *Start = MCSymbolRefExpr::create(StartSymbol, context);
     MCOS->emitValue(Start, AddrSize);
 
     // AT_high_pc, the last address of the default .text section.
-    const MCExpr *End = MCSymbolRefExpr::create(
-      EndSymbol, MCSymbolRefExpr::VK_None, context);
+    const MCExpr *End = MCSymbolRefExpr::create(EndSymbol, context);
     MCOS->emitValue(End, AddrSize);
   }
 
@@ -1091,8 +1088,7 @@ static void EmitGenDwarfInfo(MCStreamer *MCOS,
     MCOS->emitInt32(Entry.getLineNumber());
 
     // AT_low_pc, start address of the label.
-    const MCExpr *AT_low_pc = MCSymbolRefExpr::create(Entry.getLabel(),
-                                             MCSymbolRefExpr::VK_None, context);
+    const auto *AT_low_pc = MCSymbolRefExpr::create(Entry.getLabel(), context);
     MCOS->emitValue(AT_low_pc, AddrSize);
   }
 
@@ -1124,8 +1120,8 @@ static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
     for (MCSection *Sec : Sections) {
       const MCSymbol *StartSymbol = Sec->getBeginSymbol();
       const MCSymbol *EndSymbol = Sec->getEndSymbol(context);
-      const MCExpr *SectionStartAddr = MCSymbolRefExpr::create(
-          StartSymbol, MCSymbolRefExpr::VK_None, context);
+      const MCExpr *SectionStartAddr =
+          MCSymbolRefExpr::create(StartSymbol, context);
       const MCExpr *SectionSize =
           makeEndMinusStartExpr(context, *StartSymbol, *EndSymbol, 0);
       MCOS->emitInt8(dwarf::DW_RLE_start_length);
@@ -1143,8 +1139,8 @@ static MCSymbol *emitGenDwarfRanges(MCStreamer *MCOS) {
       const MCSymbol *EndSymbol = Sec->getEndSymbol(context);
 
       // Emit a base address selection entry for the section start.
-      const MCExpr *SectionStartAddr = MCSymbolRefExpr::create(
-          StartSymbol, MCSymbolRefExpr::VK_None, context);
+      const MCExpr *SectionStartAddr =
+          MCSymbolRefExpr::create(StartSymbol, context);
       MCOS->emitFill(AddrSize, 0xFF);
       MCOS->emitValue(SectionStartAddr, AddrSize);
 

diff  --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
index 4a4ad712e304d..a34bdb7335ee9 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -1007,9 +1007,7 @@ void AMDGPUTargetELFStreamer::EmitAmdhsaKernelDescriptor(
       MCBinaryExpr::createSub(
           MCSymbolRefExpr::create(KernelCodeSymbol,
                                   MCSymbolRefExpr::VK_AMDGPU_REL64, Context),
-          MCSymbolRefExpr::create(KernelDescriptorSymbol,
-                                  MCSymbolRefExpr::VK_None, Context),
-          Context),
+          MCSymbolRefExpr::create(KernelDescriptorSymbol, Context), Context),
       sizeof(amdhsa::kernel_descriptor_t::kernel_code_entry_byte_offset));
   for (uint32_t i = 0; i < sizeof(amdhsa::kernel_descriptor_t::reserved1); ++i)
     Streamer.emitInt8(0u);

diff  --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index ba58c10c3515a..d6a586e1f247b 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -9066,7 +9066,6 @@ bool ARMAsmParser::processInstruction(MCInst &Inst,
       Out.emitLabel(Dot);
       const MCExpr *OpExpr = Inst.getOperand(2).getExpr();
       const MCExpr *InstPC = MCSymbolRefExpr::create(Dot,
-                                                     MCSymbolRefExpr::VK_None,
                                                      getContext());
       const MCExpr *Const8 = MCConstantExpr::create(8, getContext());
       const MCExpr *ReadPC = MCBinaryExpr::createAdd(InstPC, Const8,

diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 2a448d987f297..cd0704cad2462 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -1010,7 +1010,6 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
       const MCExpr *Exp = MCSymbolRefExpr::create(PICOffset, OutContext);
       const MCExpr *PB =
         MCSymbolRefExpr::create(MF->getPICBaseSymbol(),
-                                MCSymbolRefExpr::VK_None,
                                 OutContext);
       const MCOperand TR = TmpInst.getOperand(1);
       const MCOperand PICR = TmpInst.getOperand(0);
@@ -1404,16 +1403,12 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
   case PPC::PPC32GOT: {
     MCSymbol *GOTSymbol =
         OutContext.getOrCreateSymbol(StringRef("_GLOBAL_OFFSET_TABLE_"));
-    const MCExpr *SymGotTlsL =
-        PPCMCExpr::create(PPCMCExpr::VK_PPC_LO,
-                          MCSymbolRefExpr::create(
-                              GOTSymbol, MCSymbolRefExpr::VK_None, OutContext),
-                          OutContext);
-    const MCExpr *SymGotTlsHA =
-        PPCMCExpr::create(PPCMCExpr::VK_PPC_HA,
-                          MCSymbolRefExpr::create(
-                              GOTSymbol, MCSymbolRefExpr::VK_None, OutContext),
-                          OutContext);
+    const MCExpr *SymGotTlsL = PPCMCExpr::create(
+        PPCMCExpr::VK_PPC_LO, MCSymbolRefExpr::create(GOTSymbol, OutContext),
+        OutContext);
+    const MCExpr *SymGotTlsHA = PPCMCExpr::create(
+        PPCMCExpr::VK_PPC_HA, MCSymbolRefExpr::create(GOTSymbol, OutContext),
+        OutContext);
     EmitToStreamer(*OutStreamer, MCInstBuilder(PPC::LI)
                                  .addReg(MI->getOperand(0).getReg())
                                  .addExpr(SymGotTlsL));

diff  --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index 589dd8b634125..448753fa43dc1 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -86,7 +86,6 @@ static const MCSymbolRefExpr *getTLSGetOffset(MCContext &Context) {
 static const MCSymbolRefExpr *getGlobalOffsetTable(MCContext &Context) {
   StringRef Name = "_GLOBAL_OFFSET_TABLE_";
   return MCSymbolRefExpr::create(Context.getOrCreateSymbol(Name),
-                                 MCSymbolRefExpr::VK_None,
                                  Context);
 }
 

diff  --git a/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp b/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
index 55f783d6da063..58953a2e51b42 100644
--- a/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
+++ b/llvm/lib/Target/Xtensa/AsmParser/XtensaAsmParser.cpp
@@ -410,8 +410,7 @@ bool XtensaAsmParser::processInstruction(MCInst &Inst, SMLoc IDLoc,
         TmpInst.setOpcode(Xtensa::L32R);
         const MCExpr *Value = MCConstantExpr::create(ImmOp64, getContext());
         MCSymbol *Sym = getContext().createTempSymbol();
-        const MCExpr *Expr = MCSymbolRefExpr::create(
-            Sym, MCSymbolRefExpr::VK_None, getContext());
+        const MCExpr *Expr = MCSymbolRefExpr::create(Sym, getContext());
         const MCExpr *OpExpr = XtensaMCExpr::create(
             Expr, XtensaMCExpr::VK_Xtensa_None, getContext());
         TmpInst.addOperand(Inst.getOperand(0));


        


More information about the llvm-commits mailing list