File: incorrect-phi.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (64 lines) | stat: -rw-r--r-- 2,718 bytes parent folder | download | duplicates (8)
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
; RUN: opt -passes=loop-versioning -S < %s | FileCheck %s

; Make sure all PHIs are properly updated in the exit block.  Based on
; PR28037.

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@x = external global [2 x [3 x [5 x i16]]]

; CHECK-LABEL: @phi_with_undef
define void @phi_with_undef() {
bb6.lr.ph:                                        ; preds = %bb5.preheader
  br label %bb6

bb6:                                              ; preds = %bb6.lr.ph, %bb6
  %_tmp1423 = phi i64 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ]
  %_tmp123 = getelementptr [2 x [3 x [5 x i16]]], ptr @x, i16 0, i64 undef
  %_tmp126 = getelementptr [3 x [5 x i16]], ptr %_tmp123, i16 0, i64 %_tmp1423
  %_tmp129 = getelementptr [5 x i16], ptr %_tmp126, i16 0, i64 undef
  %_tmp130 = load i16, ptr %_tmp129
  store i16 undef, ptr getelementptr ([2 x [3 x [5 x i16]]], ptr @x, i64 0, i64 undef, i64 undef, i64 undef)
  %_tmp142 = add i64 %_tmp1423, 1
  br i1 false, label %bb6, label %loop.exit

loop.exit:                                ; preds = %bb6
  %_tmp142.lcssa = phi i64 [ %_tmp142, %bb6 ]
  %split = phi i16 [ undef, %bb6 ]
; CHECK: %split.ph = phi i16 [ undef, %bb6.lver.orig ]
; CHECK: %split.ph3 = phi i16 [ undef, %bb6 ]
; CHECK: %split = phi i16 [ %split.ph, %loop.exit.loopexit ], [ %split.ph3, %loop.exit.loopexit1 ]
  br label %bb9

bb9:                                              ; preds = %bb9.loopexit, %bb1
  ret void
}

; CHECK-LABEL: @phi_with_non_loop_defined_value
define void @phi_with_non_loop_defined_value() {
bb6.lr.ph:                                        ; preds = %bb5.preheader
  %t = add i16 1, 1
  br label %bb6

bb6:                                              ; preds = %bb6.lr.ph, %bb6
  %_tmp1423 = phi i64 [ undef, %bb6.lr.ph ], [ %_tmp142, %bb6 ]
  %_tmp123 = getelementptr [2 x [3 x [5 x i16]]], ptr @x, i16 0, i64 undef
  %_tmp126 = getelementptr [3 x [5 x i16]], ptr %_tmp123, i16 0, i64 %_tmp1423
  %_tmp129 = getelementptr [5 x i16], ptr %_tmp126, i16 0, i64 undef
  %_tmp130 = load i16, ptr %_tmp129
  store i16 undef, ptr getelementptr ([2 x [3 x [5 x i16]]], ptr @x, i64 0, i64 undef, i64 undef, i64 undef)
  %_tmp142 = add i64 %_tmp1423, 1
  br i1 false, label %bb6, label %loop.exit

loop.exit:                                ; preds = %bb6
  %_tmp142.lcssa = phi i64 [ %_tmp142, %bb6 ]
  %split = phi i16 [ %t, %bb6 ]
; CHECK: %split.ph = phi i16 [ %t, %bb6.lver.orig ]
; CHECK: %split.ph3 = phi i16 [ %t, %bb6 ]
; CHECK: %split = phi i16 [ %split.ph, %loop.exit.loopexit ], [ %split.ph3, %loop.exit.loopexit1 ]
  br label %bb9

bb9:                                              ; preds = %bb9.loopexit, %bb1
  ret void
}