Skip to content

Commit 775d2f3

Browse files
authored
[LoongArch][MC] Support to get the FixupKind for BL (#72938)
Previously, bolt could not get FixupKind for BL correctly, because bolt cannot get target-flags for BL. Here just add support in MCCodeEmitter. Fixes llvm/llvm-project#72826.
1 parent ead3556 commit 775d2f3

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCCodeEmitter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
259259
FixupKind = LoongArch::fixup_loongarch_b21;
260260
break;
261261
case LoongArch::B:
262+
case LoongArch::BL:
262263
FixupKind = LoongArch::fixup_loongarch_b26;
263264
break;
264265
}

llvm/test/CodeGen/LoongArch/test_bl_fixupkind.mir

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
## Tagged as "Expectedly Failed" until the following patch fix it
2-
# XFAIL: *
31
# RUN: llc --mtriple=loongarch64 --filetype=obj %s -o - | \
42
# RUN: llvm-objdump -d - | FileCheck %s
53

64
# REQUIRES: asserts
75

8-
## Check that bl can get fixupkind correctly.
9-
## When BL has target-flags(loongarch-call), there is no error. But without
10-
## this flag, an assertion error will appear:
11-
## Assertion `FixupKind != LoongArch::fixup_loongarch_invalid && "Unhandled expression!"' failed.
6+
## Check that bl can get fixupkind correctly, whether BL contains
7+
## target-flags(loongarch-call) or not.
128

139
--- |
1410
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"

0 commit comments

Comments
 (0)