[llvm] 507d7dc - [LoongArch] Simplify getRelocType
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 16 00:09:12 PDT 2025
Author: Fangrui Song
Date: 2025-04-16T00:09:07-07:00
New Revision: 507d7dc651b28d8a975ba8ca6e8f5906b07e37e7
URL: https://github.com/llvm/llvm-project/commit/507d7dc651b28d8a975ba8ca6e8f5906b07e37e7
DIFF: https://github.com/llvm/llvm-project/commit/507d7dc651b28d8a975ba8ca6e8f5906b07e37e7.diff
LOG: [LoongArch] Simplify getRelocType
Added:
Modified:
llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
index c117e9a60939f..d129e0e2497e4 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
@@ -50,12 +50,6 @@ unsigned LoongArchELFObjectWriter::getRelocType(MCContext &Ctx,
const MCValue &Target,
const MCFixup &Fixup,
bool IsPCRel) const {
- // Determine the type of the relocation
- unsigned Kind = Fixup.getTargetKind();
-
- if (Kind >= FirstLiteralRelocationKind)
- return Kind - FirstLiteralRelocationKind;
-
switch (Target.getSpecifier()) {
case LoongArchMCExpr::VK_TLS_LE_HI20:
case LoongArchMCExpr::VK_TLS_IE_PC_HI20:
@@ -77,6 +71,7 @@ unsigned LoongArchELFObjectWriter::getRelocType(MCContext &Ctx,
break;
}
+ unsigned Kind = Fixup.getTargetKind();
if (Kind >= FirstRelocationKind)
return Kind - FirstRelocationKind;
switch (Kind) {
More information about the llvm-commits
mailing list