File: pr145363.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.4-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,236,516 kB
  • sloc: cpp: 7,619,569; ansic: 1,433,956; asm: 1,058,748; python: 252,181; f90: 94,671; objc: 70,753; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,585; awk: 3,523; javascript: 2,272; xml: 892; fortran: 770
file content (40 lines) | stat: -rw-r--r-- 1,277 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=riscv64 | FileCheck %s

; These two loads will CSE, we need to conservatively combine the range
; metadata. The final assembly should not contain an OR.
define i32 @f(ptr %p) {
; CHECK-LABEL: f:
; CHECK:       # %bb.0:
; CHECK-NEXT:    lw a0, 0(a0)
; CHECK-NEXT:    lui a1, 294471
; CHECK-NEXT:    addi a1, a1, 1064
; CHECK-NEXT:    addw a0, a0, a1
; CHECK-NEXT:    ret
  %load = load i32, ptr %p, align 4, !range !0
  %load2 = load i32, ptr %p, align 4
  %add = add i32 1206154280, %load2
  ret i32 %add
}

; The mul and getelementptr will get removed in DAGCombine causing the loads
; to CSE after they are created.
define i32 @test(ptr %p, i32 %x, ptr %q) {
; CHECK-LABEL: test:
; CHECK:       # %bb.0:
; CHECK-NEXT:    lw a1, 0(a0)
; CHECK-NEXT:    lui a0, 294471
; CHECK-NEXT:    addi a0, a0, 1064
; CHECK-NEXT:    addw a0, a1, a0
; CHECK-NEXT:    sw a1, 0(a2)
; CHECK-NEXT:    ret
  %load = load i32, ptr %p, align 4, !range !0
  %mul = mul i32 0, %x
  %a = getelementptr i32, ptr %p, i32 %mul
  %load2 = load i32, ptr %a, align 4
  %add = add i32 1206154280, %load2
  store i32 %load, ptr %q
  ret i32 %add
}

!0 = !{i32 1, i32 2, i32 3, i32 4}