Skip to content

Commit 7e56a09

Browse files
committed
[RISCV] Add a testcase for an unprofitable machine-sink issue
This corresponds to an upcoming change which will fully explain why this is a machine-sink issue.
1 parent f13b7d0 commit 7e56a09

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

llvm/test/CodeGen/RISCV/machine-sink-load-immediate.ll

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,30 @@ return: ; preds = %strdup.exit, %while
178178
}
179179

180180
declare i32 @toupper()
181+
182+
; In this example, %arg and the return value (13) have overlapping live
183+
; intervals because the ABI mandidates they both be placed in a0.
184+
define signext i32 @overlap_live_ranges(ptr %arg, i32 signext %arg1) {
185+
; CHECK-LABEL: overlap_live_ranges:
186+
; CHECK: # %bb.0: # %bb
187+
; CHECK-NEXT: li a3, 1
188+
; CHECK-NEXT: li a2, 13
189+
; CHECK-NEXT: bne a1, a3, .LBB1_2
190+
; CHECK-NEXT: # %bb.1: # %bb2
191+
; CHECK-NEXT: lw a2, 4(a0)
192+
; CHECK-NEXT: .LBB1_2: # %bb5
193+
; CHECK-NEXT: mv a0, a2
194+
; CHECK-NEXT: ret
195+
bb:
196+
%i = icmp eq i32 %arg1, 1
197+
br i1 %i, label %bb2, label %bb5
198+
199+
bb2: ; preds = %bb
200+
%i3 = getelementptr inbounds nuw i8, ptr %arg, i64 4
201+
%i4 = load i32, ptr %i3, align 4
202+
br label %bb5
203+
204+
bb5: ; preds = %bb2, %bb
205+
%i6 = phi i32 [ %i4, %bb2 ], [ 13, %bb ]
206+
ret i32 %i6
207+
}

0 commit comments

Comments
 (0)