Skip to content

Commit 181be8d

Browse files
committed
Fix Operand Issue
1 parent 386a497 commit 181be8d

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ void RISCVDAGToDAGISel::Select(SDNode *Node) {
18561856

18571857
SDValue Base, Offset;
18581858
SDValue Chain = MemNode->getChain();
1859-
SDValue Addr = MemNode->getBasePtr();
1859+
SDValue Addr = Node->getOperand(3);
18601860
SelectAddrRegImm(Addr, Base, Offset);
18611861

18621862
SDValue Lo = Node->getOperand(1);

llvm/test/CodeGen/RISCV/zilsd.ll

Lines changed: 20 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ define i64 @load_align4(ptr %a) nounwind {
4545
define void @store(ptr %a, i64 %b) nounwind {
4646
; CHECK-LABEL: store:
4747
; CHECK: # %bb.0:
48-
; CHECK-NEXT: sw a1, 0(a1)
49-
; CHECK-NEXT: sw a2, 4(a1)
48+
; CHECK-NEXT: sw a1, 0(a0)
49+
; CHECK-NEXT: sw a2, 4(a0)
50+
; CHECK-NEXT: sw a1, 88(a0)
51+
; CHECK-NEXT: sw a2, 92(a0)
5052
; CHECK-NEXT: ret
5153
store i64 %b, ptr %a
5254
%1 = getelementptr i64, ptr %a, i32 11
@@ -55,23 +57,11 @@ define void @store(ptr %a, i64 %b) nounwind {
5557
}
5658

5759
define void @store_align4(ptr %a, i64 %b) nounwind {
58-
; SLOW-LABEL: store_align4:
59-
; SLOW: # %bb.0:
60-
; SLOW-NEXT: sw a1, 88(a0)
61-
; SLOW-NEXT: sw a2, 92(a0)
62-
; SLOW-NEXT: ret
63-
;
64-
; FAST-LABEL: store_align4:
65-
; FAST: # %bb.0:
66-
; FAST-NEXT: sw a1, 0(a1)
67-
; FAST-NEXT: sw a2, 4(a1)
68-
; FAST-NEXT: ret
69-
;
70-
; 4BYTEALIGN-LABEL: store_align4:
71-
; 4BYTEALIGN: # %bb.0:
72-
; 4BYTEALIGN-NEXT: sw a1, 0(a1)
73-
; 4BYTEALIGN-NEXT: sw a2, 4(a1)
74-
; 4BYTEALIGN-NEXT: ret
60+
; CHECK-LABEL: store_align4:
61+
; CHECK: # %bb.0:
62+
; CHECK-NEXT: sw a1, 88(a0)
63+
; CHECK-NEXT: sw a2, 92(a0)
64+
; CHECK-NEXT: ret
7565
%1 = getelementptr i64, ptr %a, i32 11
7666
store i64 %b, ptr %1, align 4
7767
ret void
@@ -155,8 +145,8 @@ define void @store_unaligned(ptr %p, i64 %v) {
155145
;
156146
; FAST-LABEL: store_unaligned:
157147
; FAST: # %bb.0:
158-
; FAST-NEXT: sw a1, 0(a1)
159-
; FAST-NEXT: sw a2, 4(a1)
148+
; FAST-NEXT: sw a1, 0(a0)
149+
; FAST-NEXT: sw a2, 4(a0)
160150
; FAST-NEXT: ret
161151
;
162152
; 4BYTEALIGN-LABEL: store_unaligned:
@@ -196,7 +186,8 @@ entry:
196186
define void @store_g() nounwind {
197187
; CHECK-LABEL: store_g:
198188
; CHECK: # %bb.0: # %entyr
199-
; CHECK-NEXT: sd zero, 0(zero)
189+
; CHECK-NEXT: lui a0, %hi(g)
190+
; CHECK-NEXT: sd zero, %lo(g)(a0)
200191
; CHECK-NEXT: ret
201192
entyr:
202193
store i64 0, ptr @g
@@ -208,12 +199,13 @@ define void @large_offset(ptr nocapture %p, i64 %d) nounwind {
208199
; CHECK: # %bb.0: # %entry
209200
; CHECK-NEXT: lui a1, 4
210201
; CHECK-NEXT: add a0, a0, a1
211-
; CHECK-NEXT: ld a0, -384(a0)
212-
; CHECK-NEXT: addi a2, a0, 1
213-
; CHECK-NEXT: seqz a3, a2
214-
; CHECK-NEXT: add a1, a1, a3
215-
; CHECK-NEXT: sw a2, 1(a0)
216-
; CHECK-NEXT: sw a1, 5(a0)
202+
; CHECK-NEXT: lw a1, -384(a0)
203+
; CHECK-NEXT: lw a2, -380(a0)
204+
; CHECK-NEXT: addi a1, a1, 1
205+
; CHECK-NEXT: seqz a3, a1
206+
; CHECK-NEXT: add a2, a2, a3
207+
; CHECK-NEXT: sw a1, -384(a0)
208+
; CHECK-NEXT: sw a2, -380(a0)
217209
; CHECK-NEXT: ret
218210
entry:
219211
%add.ptr = getelementptr inbounds i64, ptr %p, i64 2000

0 commit comments

Comments
 (0)