File: bbi-63564.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (58 lines) | stat: -rw-r--r-- 2,183 bytes parent folder | download | duplicates (4)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes='loop-mssa(indvars,indvars)' -S < %s | FileCheck %s

target triple = "x86_64-unknown-linux-gnu"

@c = external global i16, align 1
@a = external global i16, align 1

; When we delete %c.promoted, we need to ensure we clear the getSCEVAtScope
; cache or we'll crash trying to access loop disposition of the exit value
; for the remaining IV.
define void @f() {
; CHECK-LABEL: @f(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[FOR_COND:%.*]]
; CHECK:       for.cond:
; CHECK-NEXT:    br i1 false, label [[FOR_BODY:%.*]], label [[FOR_END4:%.*]]
; CHECK:       for.body:
; CHECK-NEXT:    br label [[FOR_BODY2:%.*]]
; CHECK:       for.body2:
; CHECK-NEXT:    [[INC2:%.*]] = phi i16 [ undef, [[FOR_BODY]] ], [ [[INC:%.*]], [[FOR_BODY2]] ]
; CHECK-NEXT:    [[INC]] = add nsw i16 [[INC2]], 1
; CHECK-NEXT:    store i16 [[INC]], i16* undef, align 1
; CHECK-NEXT:    br i1 true, label [[FOR_BODY2]], label [[CRIT_EDGE:%.*]]
; CHECK:       crit_edge:
; CHECK-NEXT:    [[INC_LCSSA:%.*]] = phi i16 [ [[INC]], [[FOR_BODY2]] ]
; CHECK-NEXT:    store i16 [[INC_LCSSA]], i16* @a, align 1
; CHECK-NEXT:    unreachable
; CHECK:       for.end4:
; CHECK-NEXT:    ret void
;
entry:
  br label %for.cond

for.cond:                                         ; preds = %entry
  br i1 false, label %for.body, label %for.end4

for.body:                                         ; preds = %for.cond
  %c.promoted = load i16, i16* @c, align 1
  br label %for.body2

for.body2:                                        ; preds = %for.body2, %for.body
  %inc33 = phi i16 [ %c.promoted, %for.body ], [ %inc3, %for.body2 ]
  %inc2 = phi i16 [ undef, %for.body ], [ %inc, %for.body2 ]
  %inc = add nsw i16 %inc2, 1
  store i16 %inc, i16* undef, align 1
  %inc3 = add nsw i16 %inc33, 1
  %tobool = icmp ne i16 %inc3, 0
  br i1 %tobool, label %for.body2, label %crit_edge

crit_edge:                                        ; preds = %for.body2
  %inc.lcssa = phi i16 [ %inc, %for.body2 ]
  store i16 %inc.lcssa, i16* @a, align 1
  unreachable

for.end4:                                         ; preds = %for.cond
  ret void
}