Skip to content

Commit 95e9275

Browse files
author
git apple-llvm automerger
committed
Merge commit 'be3fd6ae259d' from llvm.org/main into next
2 parents cd68a8b + be3fd6a commit 95e9275

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,10 @@ bool LoongArchAsmBackend::addReloc(const MCFragment &F, const MCFixup &Fixup,
439439
isPCRelFixupResolved(Target.getSubSym(), F))
440440
return Fallback();
441441

442-
// In SecA == SecB case. If the linker relaxation is disabled, the
442+
// In SecA == SecB case. If the section is not linker-relaxable, the
443443
// FixedValue has already been calculated out in evaluateFixup,
444444
// return true and avoid record relocations.
445-
if (&SecA == &SecB && !STI.hasFeature(LoongArch::FeatureRelax))
445+
if (&SecA == &SecB && !SecA.isLinkerRelaxable())
446446
return true;
447447
}
448448

llvm/test/CodeGen/LoongArch/fix-addsub-relocs-with-relax.ll

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
; RUN: llc --filetype=obj --mtriple=loongarch64 %s -o %t.o
22
; RUN: llvm-readobj -r %t.o | FileCheck %s
33
; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=+relax %s -o %t.r
4-
; RUN: llvm-readobj -r %t.r | FileCheck --check-prefixes=CHECK,RELAX %s
5-
6-
;; This test shows the loss of ADD/SUB relocations because relax feature
7-
;; is not available from SubtargetInfo (LoongArchAsmBackend is instantiated
8-
;; too early). ie. code generation takes the relax feature from attributes,
9-
;; but ADD/SUB relocations recording losses the relax feature.
10-
;; A later commit will fix it.
4+
; RUN: llvm-readobj -r %t.r | FileCheck %s
115

126
; CHECK: Relocations [
137
; CHECK-NEXT: Section ({{.*}}) .rela.text {
@@ -20,17 +14,17 @@
2014
; CHECK-NEXT: 0x8 R_LARCH_32 .debug_abbrev 0x0
2115
; CHECK-NEXT: 0x11 R_LARCH_32 .L0 0x0
2216
; CHECK-NEXT: 0x15 R_LARCH_32 .Lline_table_start0 0x0
23-
; RELAX-NEXT: 0x1B R_LARCH_ADD32 .L0 0x0
24-
; RELAX-NEXT: 0x1B R_LARCH_SUB32 .L0 0x0
17+
; CHECK-NEXT: 0x1B R_LARCH_ADD32 .L0 0x0
18+
; CHECK-NEXT: 0x1B R_LARCH_SUB32 .L0 0x0
2519
; CHECK-NEXT: 0x1F R_LARCH_32 .L0 0x0
26-
; RELAX-NEXT: 0x25 R_LARCH_ADD32 .L0 0x0
27-
; RELAX-NEXT: 0x25 R_LARCH_SUB32 .L0 0x0
20+
; CHECK-NEXT: 0x25 R_LARCH_ADD32 .L0 0x0
21+
; CHECK-NEXT: 0x25 R_LARCH_SUB32 .L0 0x0
2822
; CHECK-NEXT: }
2923
; CHECK: Section ({{.*}}) .rela.debug_frame {
3024
; CHECK-NEXT: 0x1C R_LARCH_32 .L0 0x0
3125
; CHECK-NEXT: 0x20 R_LARCH_64 .L0 0x0
32-
; RELAX-NEXT: 0x28 R_LARCH_ADD64 .L0 0x0
33-
; RELAX-NEXT: 0x28 R_LARCH_SUB64 .L0 0x0
26+
; CHECK-NEXT: 0x28 R_LARCH_ADD64 .L0 0x0
27+
; CHECK-NEXT: 0x28 R_LARCH_SUB64 .L0 0x0
3428
; CHECK-NEXT: 0x3F R_LARCH_ADD6 .L0 0x0
3529
; CHECK-NEXT: 0x3F R_LARCH_SUB6 .L0 0x0
3630
; CHECK-NEXT: }
@@ -39,8 +33,8 @@
3933
; CHECK-NEXT: 0x31 R_LARCH_32 .debug_line_str 0x2
4034
; CHECK-NEXT: 0x46 R_LARCH_32 .debug_line_str 0x9
4135
; CHECK-NEXT: 0x4F R_LARCH_64 .L0 0x0
42-
; RELAX-NEXT: 0x5F R_LARCH_ADD16 .L0 0x0
43-
; RELAX-NEXT: 0x5F R_LARCH_SUB16 .L0 0x0
36+
; CHECK-NEXT: 0x5F R_LARCH_ADD16 .L0 0x0
37+
; CHECK-NEXT: 0x5F R_LARCH_SUB16 .L0 0x0
4438
; CHECK-NEXT: }
4539
; CHECK-NEXT: ]
4640

0 commit comments

Comments
 (0)