Skip to content

Commit

Permalink
[LoongArch][MC] Support to get the FixupKind for BL (#72938)
Browse files Browse the repository at this point in the history
Previously, bolt could not get FixupKind for BL correctly, because bolt
cannot get target-flags for BL. Here just add support in MCCodeEmitter.

Fixes #72826.
  • Loading branch information
zhaoqi5 committed Nov 21, 2023
1 parent ead3556 commit 775d2f3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ LoongArchMCCodeEmitter::getExprOpValue(const MCInst &MI, const MCOperand &MO,
FixupKind = LoongArch::fixup_loongarch_b21;
break;
case LoongArch::B:
case LoongArch::BL:
FixupKind = LoongArch::fixup_loongarch_b26;
break;
}
Expand Down
8 changes: 2 additions & 6 deletions llvm/test/CodeGen/LoongArch/test_bl_fixupkind.mir
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
## Tagged as "Expectedly Failed" until the following patch fix it
# XFAIL: *
# RUN: llc --mtriple=loongarch64 --filetype=obj %s -o - | \
# RUN: llvm-objdump -d - | FileCheck %s

# REQUIRES: asserts

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

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

0 comments on commit 775d2f3

Please sign in to comment.