File: loadpre-missed-opportunity.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (104 lines) | stat: -rw-r--r-- 3,390 bytes parent folder | download | duplicates (14)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=gvn -gvn-max-block-speculations=1 -S | FileCheck -check-prefix=PRE %s
; RUN: opt < %s -passes=gvn -gvn-max-block-speculations=0 -S | FileCheck -check-prefix=CHECK %s

define i32 @loadpre_opportunity(ptr %arg, i1 %arg1, i1 %arg2, i1 %arg3) {
; PRE-LABEL: @loadpre_opportunity(
; PRE-NEXT:  bb:
; PRE-NEXT:    [[I:%.*]] = load ptr, ptr [[ARG:%.*]], align 8
; PRE-NEXT:    [[I6:%.*]] = call i32 @use(ptr [[I]])
; PRE-NEXT:    br label [[BB11:%.*]]
; PRE:       bb7:
; PRE-NEXT:    [[I8:%.*]] = phi ptr [ [[I8_PRE:%.*]], [[BB17_BB7_CRIT_EDGE:%.*]] ], [ [[I81:%.*]], [[BB11]] ]
; PRE-NEXT:    [[I10:%.*]] = call i32 @use(ptr [[I8]])
; PRE-NEXT:    br label [[BB11]]
; PRE:       bb11:
; PRE-NEXT:    [[I81]] = phi ptr [ [[I]], [[BB:%.*]] ], [ [[I8]], [[BB7:%.*]] ]
; PRE-NEXT:    [[I12:%.*]] = phi i32 [ [[I6]], [[BB]] ], [ [[I10]], [[BB7]] ]
; PRE-NEXT:    br i1 [[ARG1:%.*]], label [[BB7]], label [[BB13:%.*]]
; PRE:       bb13:
; PRE-NEXT:    call void @somecall()
; PRE-NEXT:    br i1 [[ARG2:%.*]], label [[BB14:%.*]], label [[BB17:%.*]]
; PRE:       bb14:
; PRE-NEXT:    br label [[BB15:%.*]]
; PRE:       bb15:
; PRE-NEXT:    br i1 [[ARG3:%.*]], label [[BB16:%.*]], label [[BB15]]
; PRE:       bb16:
; PRE-NEXT:    br label [[BB17]]
; PRE:       bb17:
; PRE-NEXT:    [[I18:%.*]] = call i1 @cond()
; PRE-NEXT:    br i1 [[I18]], label [[BB17_BB7_CRIT_EDGE]], label [[BB19:%.*]]
; PRE:       bb17.bb7_crit_edge:
; PRE-NEXT:    [[I8_PRE]] = load ptr, ptr [[ARG]], align 8
; PRE-NEXT:    br label [[BB7]]
; PRE:       bb19:
; PRE-NEXT:    ret i32 [[I12]]
;
; CHECK-LABEL: @loadpre_opportunity(
; CHECK-NEXT:  bb:
; CHECK-NEXT:    [[I:%.*]] = load ptr, ptr [[ARG:%.*]], align 8
; CHECK-NEXT:    [[I6:%.*]] = call i32 @use(ptr [[I]])
; CHECK-NEXT:    br label [[BB11:%.*]]
; CHECK:       bb7:
; CHECK-NEXT:    [[I8:%.*]] = load ptr, ptr [[ARG]], align 8
; CHECK-NEXT:    [[I10:%.*]] = call i32 @use(ptr [[I8]])
; CHECK-NEXT:    br label [[BB11]]
; CHECK:       bb11:
; CHECK-NEXT:    [[I12:%.*]] = phi i32 [ [[I6]], [[BB:%.*]] ], [ [[I10]], [[BB7:%.*]] ]
; CHECK-NEXT:    br i1 [[ARG1:%.*]], label [[BB7]], label [[BB13:%.*]]
; CHECK:       bb13:
; CHECK-NEXT:    call void @somecall()
; CHECK-NEXT:    br i1 [[ARG2:%.*]], label [[BB14:%.*]], label [[BB17:%.*]]
; CHECK:       bb14:
; CHECK-NEXT:    br label [[BB15:%.*]]
; CHECK:       bb15:
; CHECK-NEXT:    br i1 [[ARG3:%.*]], label [[BB16:%.*]], label [[BB15]]
; CHECK:       bb16:
; CHECK-NEXT:    br label [[BB17]]
; CHECK:       bb17:
; CHECK-NEXT:    [[I18:%.*]] = call i1 @cond()
; CHECK-NEXT:    br i1 [[I18]], label [[BB7]], label [[BB19:%.*]]
; CHECK:       bb19:
; CHECK-NEXT:    ret i32 [[I12]]
;
bb:
  %i = load ptr, ptr %arg, align 8
  br label %bb5

bb5:
  %i6 = call i32 @use(ptr %i)
  br label %bb11

bb7:
  %i8 = load ptr, ptr %arg, align 8
  %i10 = call i32 @use(ptr %i8)
  br label %bb11

bb11:
  %i12 = phi i32 [ %i6, %bb5 ], [ %i10, %bb7 ]
  br i1 %arg1, label %bb7, label %bb13

bb13:
  call void @somecall()
  br i1 %arg2, label %bb14, label %bb17

bb14:
  br label %bb15

bb15:
  br i1 %arg3, label %bb16, label %bb15

bb16:
  br label %bb17

bb17:
  %i18 = call i1 @cond()
  br i1 %i18, label %bb7, label %bb19

bb19:
  ret i32 %i12
}

declare void @somecall()
declare i32 @use(ptr) readnone
declare i1 @cond() readnone