[llvm] 5b65b4d - [RISCV] Remove dead code from evaluateTargetFixup

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 30 10:39:48 PDT 2025


Author: Fangrui Song
Date: 2025-03-30T10:39:43-07:00
New Revision: 5b65b4d46412f0d5838b0d67b81b6dc03c93908f

URL: https://github.com/llvm/llvm-project/commit/5b65b4d46412f0d5838b0d67b81b6dc03c93908f
DIFF: https://github.com/llvm/llvm-project/commit/5b65b4d46412f0d5838b0d67b81b6dc03c93908f.diff

LOG: [RISCV] Remove dead code from evaluateTargetFixup

AUIPCTarget as a relocatable expression cannot have a SubSym or
@-specifier.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
index b5c66cc1e83f5..37cd79e890263 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -560,12 +560,11 @@ bool RISCVAsmBackend::evaluateTargetFixup(const MCAssembler &Asm,
   }
   }
 
-  if (!AUIPCTarget.getSymA() || AUIPCTarget.getSubSym())
+  if (!AUIPCTarget.getSymA())
     return false;
 
-  const MCSymbolRefExpr *A = AUIPCTarget.getSymA();
-  const MCSymbolELF &SA = cast<MCSymbolELF>(A->getSymbol());
-  if (getSpecifier(A) != RISCVMCExpr::VK_None || SA.isUndefined())
+  const MCSymbolELF &SA = cast<MCSymbolELF>(*AUIPCTarget.getAddSym());
+  if (SA.isUndefined())
     return false;
 
   bool IsResolved = &SA.getSection() == AUIPCDF->getParent() &&


        


More information about the llvm-commits mailing list