Skip to content

Commit 81eb3be

Browse files
committed
Pre-commit test
1 parent 9a0a976 commit 81eb3be

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2+
; RUN: llc < %s -mtriple=riscv64 | FileCheck %s
3+
4+
; These two loads will CSE, we need to conversatively combine the range
5+
; metadata. The final assembly should not contain an OR.
6+
define i32 @f(ptr %p) {
7+
; CHECK-LABEL: f:
8+
; CHECK: # %bb.0:
9+
; CHECK-NEXT: lw a0, 0(a0)
10+
; CHECK-NEXT: lui a1, 294471
11+
; CHECK-NEXT: addi a1, a1, 1064
12+
; CHECK-NEXT: or a0, a0, a1
13+
; CHECK-NEXT: ret
14+
%load = load i32, ptr %p, align 4, !range !0
15+
%load2 = load i32, ptr %p, align 4
16+
%add = add i32 1206154280, %load2
17+
ret i32 %add
18+
}
19+
20+
; The mul and getelementptr will get removed in DAGCombine causing the loads
21+
; to CSE after they are created.
22+
define i32 @test(ptr %p, i32 %x, ptr %q) {
23+
; CHECK-LABEL: test:
24+
; CHECK: # %bb.0:
25+
; CHECK-NEXT: lw a1, 0(a0)
26+
; CHECK-NEXT: lui a0, 294471
27+
; CHECK-NEXT: addi a0, a0, 1064
28+
; CHECK-NEXT: or a0, a1, a0
29+
; CHECK-NEXT: sw a1, 0(a2)
30+
; CHECK-NEXT: ret
31+
%load = load i32, ptr %p, align 4, !range !0
32+
%mul = mul i32 0, %x
33+
%a = getelementptr i32, ptr %p, i32 %mul
34+
%load2 = load i32, ptr %a, align 4
35+
%add = add i32 1206154280, %load2
36+
store i32 %load, ptr %q
37+
ret i32 %add
38+
}
39+
40+
!0 = !{i32 1, i32 2, i32 3, i32 4}

0 commit comments

Comments
 (0)