[llvm] 506e936 - [LoongArch] Fix wrong VariantKind for MO_GOT_PC_{HI/LO} flags
Weining Lu via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 15 03:03:46 PDT 2022
Author: wanglei
Date: 2022-10-15T17:45:08+08:00
New Revision: 506e93687140a1be054a825ae08f512d3ebbdbf8
URL: https://github.com/llvm/llvm-project/commit/506e93687140a1be054a825ae08f512d3ebbdbf8
DIFF: https://github.com/llvm/llvm-project/commit/506e93687140a1be054a825ae08f512d3ebbdbf8.diff
LOG: [LoongArch] Fix wrong VariantKind for MO_GOT_PC_{HI/LO} flags
Differential Revision: https://reviews.llvm.org/D135946
Added:
Modified:
llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
llvm/test/CodeGen/LoongArch/global-address.ll
llvm/test/CodeGen/LoongArch/tls-models.ll
Removed:
################################################################################
diff --git a/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp b/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
index 40c98148ff79c..64f08e2603812 100644
--- a/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchMCInstLower.cpp
@@ -48,10 +48,10 @@ static MCOperand lowerSymbolOperand(const MachineOperand &MO, MCSymbol *Sym,
Kind = LoongArchMCExpr::VK_LoongArch_PCALA_LO12;
break;
case LoongArchII::MO_GOT_PC_HI:
- Kind = LoongArchMCExpr::VK_LoongArch_GOT_HI20;
+ Kind = LoongArchMCExpr::VK_LoongArch_GOT_PC_HI20;
break;
case LoongArchII::MO_GOT_PC_LO:
- Kind = LoongArchMCExpr::VK_LoongArch_GOT_LO12;
+ Kind = LoongArchMCExpr::VK_LoongArch_GOT_PC_LO12;
break;
case LoongArchII::MO_LE_HI:
Kind = LoongArchMCExpr::VK_LoongArch_TLS_LE_HI20;
diff --git a/llvm/test/CodeGen/LoongArch/global-address.ll b/llvm/test/CodeGen/LoongArch/global-address.ll
index 56ab2ab27de32..258c4e8691567 100644
--- a/llvm/test/CodeGen/LoongArch/global-address.ll
+++ b/llvm/test/CodeGen/LoongArch/global-address.ll
@@ -10,8 +10,8 @@
define void @foo() nounwind {
; LA32NOPIC-LABEL: foo:
; LA32NOPIC: # %bb.0:
-; LA32NOPIC-NEXT: pcalau12i $a0, %got_hi20(G)
-; LA32NOPIC-NEXT: ld.w $a0, $a0, %got_lo12(G)
+; LA32NOPIC-NEXT: pcalau12i $a0, %got_pc_hi20(G)
+; LA32NOPIC-NEXT: ld.w $a0, $a0, %got_pc_lo12(G)
; LA32NOPIC-NEXT: ld.w $a0, $a0, 0
; LA32NOPIC-NEXT: pcalau12i $a0, %pc_hi20(g)
; LA32NOPIC-NEXT: addi.w $a0, $a0, %pc_lo12(g)
@@ -20,8 +20,8 @@ define void @foo() nounwind {
;
; LA32PIC-LABEL: foo:
; LA32PIC: # %bb.0:
-; LA32PIC-NEXT: pcalau12i $a0, %got_hi20(G)
-; LA32PIC-NEXT: ld.w $a0, $a0, %got_lo12(G)
+; LA32PIC-NEXT: pcalau12i $a0, %got_pc_hi20(G)
+; LA32PIC-NEXT: ld.w $a0, $a0, %got_pc_lo12(G)
; LA32PIC-NEXT: ld.w $a0, $a0, 0
; LA32PIC-NEXT: pcalau12i $a0, %pc_hi20(.Lg$local)
; LA32PIC-NEXT: addi.w $a0, $a0, %pc_lo12(.Lg$local)
@@ -30,8 +30,8 @@ define void @foo() nounwind {
;
; LA64NOPIC-LABEL: foo:
; LA64NOPIC: # %bb.0:
-; LA64NOPIC-NEXT: pcalau12i $a0, %got_hi20(G)
-; LA64NOPIC-NEXT: ld.d $a0, $a0, %got_lo12(G)
+; LA64NOPIC-NEXT: pcalau12i $a0, %got_pc_hi20(G)
+; LA64NOPIC-NEXT: ld.d $a0, $a0, %got_pc_lo12(G)
; LA64NOPIC-NEXT: ld.w $a0, $a0, 0
; LA64NOPIC-NEXT: pcalau12i $a0, %pc_hi20(g)
; LA64NOPIC-NEXT: addi.d $a0, $a0, %pc_lo12(g)
@@ -40,8 +40,8 @@ define void @foo() nounwind {
;
; LA64PIC-LABEL: foo:
; LA64PIC: # %bb.0:
-; LA64PIC-NEXT: pcalau12i $a0, %got_hi20(G)
-; LA64PIC-NEXT: ld.d $a0, $a0, %got_lo12(G)
+; LA64PIC-NEXT: pcalau12i $a0, %got_pc_hi20(G)
+; LA64PIC-NEXT: ld.d $a0, $a0, %got_pc_lo12(G)
; LA64PIC-NEXT: ld.w $a0, $a0, 0
; LA64PIC-NEXT: pcalau12i $a0, %pc_hi20(.Lg$local)
; LA64PIC-NEXT: addi.d $a0, $a0, %pc_lo12(.Lg$local)
diff --git a/llvm/test/CodeGen/LoongArch/tls-models.ll b/llvm/test/CodeGen/LoongArch/tls-models.ll
index 1128532668e63..d973cd45da012 100644
--- a/llvm/test/CodeGen/LoongArch/tls-models.ll
+++ b/llvm/test/CodeGen/LoongArch/tls-models.ll
@@ -21,7 +21,7 @@ define ptr @f1() nounwind {
; LA32PIC-NEXT: addi.w $sp, $sp, -16
; LA32PIC-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
; LA32PIC-NEXT: pcalau12i $a0, %gd_pc_hi20(unspecified)
-; LA32PIC-NEXT: addi.w $a0, $a0, %got_lo12(unspecified)
+; LA32PIC-NEXT: addi.w $a0, $a0, %got_pc_lo12(unspecified)
; LA32PIC-NEXT: bl %plt(__tls_get_addr)
; LA32PIC-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
; LA32PIC-NEXT: addi.w $sp, $sp, 16
@@ -32,7 +32,7 @@ define ptr @f1() nounwind {
; LA64PIC-NEXT: addi.d $sp, $sp, -16
; LA64PIC-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
; LA64PIC-NEXT: pcalau12i $a0, %gd_pc_hi20(unspecified)
-; LA64PIC-NEXT: addi.d $a0, $a0, %got_lo12(unspecified)
+; LA64PIC-NEXT: addi.d $a0, $a0, %got_pc_lo12(unspecified)
; LA64PIC-NEXT: bl %plt(__tls_get_addr)
; LA64PIC-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
; LA64PIC-NEXT: addi.d $sp, $sp, 16
@@ -63,7 +63,7 @@ define ptr @f2() nounwind {
; LA32PIC-NEXT: addi.w $sp, $sp, -16
; LA32PIC-NEXT: st.w $ra, $sp, 12 # 4-byte Folded Spill
; LA32PIC-NEXT: pcalau12i $a0, %ld_pc_hi20(ld)
-; LA32PIC-NEXT: addi.w $a0, $a0, %got_lo12(ld)
+; LA32PIC-NEXT: addi.w $a0, $a0, %got_pc_lo12(ld)
; LA32PIC-NEXT: bl %plt(__tls_get_addr)
; LA32PIC-NEXT: ld.w $ra, $sp, 12 # 4-byte Folded Reload
; LA32PIC-NEXT: addi.w $sp, $sp, 16
@@ -74,7 +74,7 @@ define ptr @f2() nounwind {
; LA64PIC-NEXT: addi.d $sp, $sp, -16
; LA64PIC-NEXT: st.d $ra, $sp, 8 # 8-byte Folded Spill
; LA64PIC-NEXT: pcalau12i $a0, %ld_pc_hi20(ld)
-; LA64PIC-NEXT: addi.d $a0, $a0, %got_lo12(ld)
+; LA64PIC-NEXT: addi.d $a0, $a0, %got_pc_lo12(ld)
; LA64PIC-NEXT: bl %plt(__tls_get_addr)
; LA64PIC-NEXT: ld.d $ra, $sp, 8 # 8-byte Folded Reload
; LA64PIC-NEXT: addi.d $sp, $sp, 16
More information about the llvm-commits
mailing list