File: intptr7.ll

package info (click to toggle)
llvm-toolchain-6.0 1:6.0-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 594,652 kB
  • sloc: cpp: 3,044,500; ansic: 595,051; asm: 271,890; python: 128,923; objc: 106,554; sh: 21,854; lisp: 10,191; pascal: 6,094; ml: 5,544; perl: 5,265; makefile: 2,214; cs: 2,027; xml: 686; php: 212; csh: 117
file content (58 lines) | stat: -rw-r--r-- 1,611 bytes parent folder | download | duplicates (16)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
; RUN: opt < %s  -instcombine -S | FileCheck %s

define void @matching_phi(i64 %a, float* %b, i1 %cond) {
; CHECK-LABEL: @matching_phi
entry:
  %cmp1 = icmp  eq i1 %cond, 0
  %add.int = add i64 %a, 1
  %add = inttoptr i64 %add.int to float *

  %addb = getelementptr inbounds float, float* %b, i64 2
  %addb.int = ptrtoint float* %addb to i64
  br i1 %cmp1, label %A, label %B
A:
  br label %C
B:
  store float 1.0e+01, float* %add, align 4
  br label %C

C:
  %a.addr.03 = phi float* [ %addb, %A ], [ %add, %B ]
  %b.addr.02 = phi i64 [ %addb.int, %A ], [ %add.int, %B ]
  %tmp = inttoptr i64 %b.addr.02 to float*
; CHECK: %a.addr.03 = phi
; CHECK-NEXT: = load
  %tmp1 = load float, float* %tmp, align 4
  %mul.i = fmul float %tmp1, 4.200000e+01
  store float %mul.i, float* %a.addr.03, align 4
  ret void
}

define void @no_matching_phi(i64 %a, float* %b, i1 %cond) {
; CHECK-LABEL: @no_matching_phi
entry:
  %cmp1 = icmp  eq i1 %cond, 0
  %add.int = add i64 %a, 1
  %add = inttoptr i64 %add.int to float *

  %addb = getelementptr inbounds float, float* %b, i64 2
  %addb.int = ptrtoint float* %addb to i64
  br i1 %cmp1, label %A, label %B
A:
  br label %C
B:
  store float 1.0e+01, float* %add, align 4
  br label %C

C:
  %a.addr.03 = phi float* [ %addb, %A ], [ %add, %B ]
  %b.addr.02 = phi i64 [ %addb.int, %B ], [ %add.int, %A ]
  %tmp = inttoptr i64 %b.addr.02 to float*
  %tmp1 = load float, float* %tmp, align 4
; CHECK: %a.addr.03 = phi
; CHECK-NEXT: %b.addr.02.ptr = phi
; CHECK-NEXT: = load
  %mul.i = fmul float %tmp1, 4.200000e+01
  store float %mul.i, float* %a.addr.03, align 4
  ret void
}