-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LoongArch] Avoid scheduling tls-desc code sequence in large code model #121541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-loongarch Author: ZhaoQi (zhaoqi5) ChangesFull diff: https://github.com/llvm/llvm-project/pull/121541.diff 2 Files Affected:
diff --git a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
index 7d0e4f9d58a16d..4b142f43359d88 100644
--- a/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchInstrInfo.cpp
@@ -406,6 +406,11 @@ bool LoongArchInstrInfo::isSchedulingBoundary(const MachineInstr &MI,
// lu32i.d $a1, %ie64_pc_lo20(s)
// lu52i.d $a1, $a1, %ie64_pc_hi12(s)
//
+ // * pcalau12i $a0, %desc_pc_hi20(s)
+ // addi.d $a1, $zero, %desc_pc_lo12(s)
+ // lu32i.d $a1, %desc64_pc_lo20(s)
+ // lu52i.d $a1, $a1, %desc64_pc_hi12(s)
+ //
// For simplicity, only pcalau12i and lu52i.d are marked as scheduling
// boundaries, and the instructions between them are guaranteed to be
// ordered according to data dependencies.
@@ -430,12 +435,15 @@ bool LoongArchInstrInfo::isSchedulingBoundary(const MachineInstr &MI,
if (MO0 == LoongArchII::MO_IE_PC_HI && MO1 == LoongArchII::MO_IE_PC_LO &&
MO2 == LoongArchII::MO_IE_PC64_LO)
return true;
+ if (MO0 == LoongArchII::MO_DESC_PC_HI && MO1 == LoongArchII::MO_DESC_PC_LO &&
+ MO2 == LoongArchII::MO_DESC64_PC_LO)
+ return true;
break;
}
case LoongArch::LU52I_D: {
auto MO = MI.getOperand(2).getTargetFlags();
if (MO == LoongArchII::MO_PCREL64_HI || MO == LoongArchII::MO_GOT_PC64_HI ||
- MO == LoongArchII::MO_IE_PC64_HI)
+ MO == LoongArchII::MO_IE_PC64_HI || MO == LoongArchII::MO_DESC64_PC_HI)
return true;
break;
}
diff --git a/llvm/test/CodeGen/LoongArch/psabi-restricted-scheduling.ll b/llvm/test/CodeGen/LoongArch/psabi-restricted-scheduling.ll
index 1773b8e0149974..3390f7fe14ae67 100644
--- a/llvm/test/CodeGen/LoongArch/psabi-restricted-scheduling.ll
+++ b/llvm/test/CodeGen/LoongArch/psabi-restricted-scheduling.ll
@@ -252,8 +252,8 @@ define void @baz() nounwind {
; LARGEDESC_SCH: # %bb.0:
; LARGEDESC_SCH-NEXT: addi.d $sp, $sp, -16
; LARGEDESC_SCH-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
-; LARGEDESC_SCH-NEXT: addi.d $a1, $zero, %desc_pc_lo12(gd)
; LARGEDESC_SCH-NEXT: pcalau12i $a0, %desc_pc_hi20(gd)
+; LARGEDESC_SCH-NEXT: addi.d $a1, $zero, %desc_pc_lo12(gd)
; LARGEDESC_SCH-NEXT: lu32i.d $a1, %desc64_pc_lo20(gd)
; LARGEDESC_SCH-NEXT: lu52i.d $a1, $a1, %desc64_pc_hi12(gd)
; LARGEDESC_SCH-NEXT: add.d $a0, $a0, $a1
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/55/builds/5004 Here is the relevant piece of the build log for the reference
|
No description provided.