Skip to content

Commit 6de2378

Browse files
author
git apple-llvm automerger
committed
Merge commit 'cc25748d07b0' from llvm.org/main into next
2 parents 5828356 + cc25748 commit 6de2378

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ class MCAsmBackend {
5353

5454
const llvm::endianness Endian;
5555

56-
/// Fixup kind used for linker relaxation. Currently only used by RISC-V.
56+
/// Fixup kind used for linker relaxation. Currently only used by RISC-V
57+
/// and LoongArch.
5758
const unsigned RelaxFixupKind;
59+
bool allowLinkerRelaxation() const { return RelaxFixupKind != MaxFixupKind; }
5860

5961
/// Return true if this target might automatically pad instructions and thus
6062
/// need to emit padding enable/disable directives around sensative code.

llvm/lib/MC/MCExpr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,7 @@ static void AttemptToFoldSymbolOffsetDifference(
627627
// .size/.fill), disable the fast path.
628628
bool Layout = Asm->hasLayout();
629629
if (Layout && (InSet || !SecA.hasInstructions() ||
630-
!(Asm->getContext().getTargetTriple().isRISCV() ||
631-
Asm->getContext().getTargetTriple().isLoongArch()))) {
630+
!Asm->getBackend().allowLinkerRelaxation())) {
632631
// If both symbols are in the same fragment, return the difference of their
633632
// offsets. canGetFragmentOffset(FA) may be false.
634633
if (FA == FB && !SA.isVariable() && !SB.isVariable()) {

0 commit comments

Comments
 (0)