File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,11 @@ static cl::opt<bool>
57
57
cl::desc (" Enable the loop data prefetch pass" ),
58
58
cl::init(false ));
59
59
60
+ static cl::opt<bool >
61
+ EnableMergeBaseOffset (" loongarch-enable-merge-offset" ,
62
+ cl::desc (" Enable the merge base offset pass" ),
63
+ cl::init(true ), cl::Hidden);
64
+
60
65
static Reloc::Model getEffectiveRelocModel (const Triple &TT,
61
66
std::optional<Reloc::Model> RM) {
62
67
return RM.value_or (Reloc::Static);
@@ -214,7 +219,7 @@ void LoongArchPassConfig::addMachineSSAOptimization() {
214
219
215
220
void LoongArchPassConfig::addPreRegAlloc () {
216
221
addPass (createLoongArchPreRAExpandPseudoPass ());
217
- if (TM->getOptLevel () != CodeGenOptLevel::None)
222
+ if (TM->getOptLevel () != CodeGenOptLevel::None && EnableMergeBaseOffset )
218
223
addPass (createLoongArchMergeBaseOffsetOptPass ());
219
224
}
220
225
Original file line number Diff line number Diff line change
1
+ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
+ ; RUN: llc --mtriple=loongarch64 -mattr=+d --relocation-model=static -O1 \
3
+ ; RUN: < %s | FileCheck %s --check-prefix=MERGE
4
+ ; RUN: llc --mtriple=loongarch64 -mattr=+d --relocation-model=static -O1 \
5
+ ; RUN: --loongarch-enable-merge-offset=false < %s | FileCheck %s --check-prefix=NO_MERGE
6
+
7
+ @g = dso_local global i32 zeroinitializer , align 4
8
+
9
+ define void @foo () nounwind {
10
+ ; MERGE-LABEL: foo:
11
+ ; MERGE: # %bb.0:
12
+ ; MERGE-NEXT: pcalau12i $a0, %pc_hi20(g)
13
+ ; MERGE-NEXT: ld.w $zero, $a0, %pc_lo12(g)
14
+ ; MERGE-NEXT: ret
15
+ ;
16
+ ; NO_MERGE-LABEL: foo:
17
+ ; NO_MERGE: # %bb.0:
18
+ ; NO_MERGE-NEXT: pcalau12i $a0, %pc_hi20(g)
19
+ ; NO_MERGE-NEXT: addi.d $a0, $a0, %pc_lo12(g)
20
+ ; NO_MERGE-NEXT: ld.w $zero, $a0, 0
21
+ ; NO_MERGE-NEXT: ret
22
+ %v = load volatile i32 , ptr @g
23
+ ret void
24
+ }
You can’t perform that action at this time.
0 commit comments