1; RUN: llc -verify-machineinstrs < %s | FileCheck %s
2target datalayout = "e-p:64:64-i64:64-n32:64"
3target triple = "powerpc64le-linux"
4
5%struct.BSS1.0.9.28.39.43.46.47.54.56.57.64.65.69.71.144 = type <{ [220 x i8] }>
6
7@.BSS1 = external unnamed_addr global %struct.BSS1.0.9.28.39.43.46.47.54.56.57.64.65.69.71.144, align 32
8
9; Function Attrs: noinline nounwind
10define void @ety2_() #0 {
11
12; This test case used to crash because the preinc prep pass would assume that
13; if X-Y could be simplified to a constant, than so could Y-X. While not
14; desirable, we cannot actually make this guarantee.
15; CHECK-LABEL: @ety2_
16
17L.entry:
18  %0 = load i32, i32* undef, align 4
19  %1 = sext i32 %0 to i64
20  %2 = shl nsw i64 %1, 3
21  %3 = add nsw i64 %2, 8
22  br label %L.LB1_425
23
24L.LB1_425:                                        ; preds = %L.LB1_427, %L.entry
25  %4 = phi i64 [ %21, %L.LB1_427 ], [ undef, %L.entry ]
26  br i1 undef, label %L.LB1_427, label %L.LB1_816
27
28L.LB1_816:                                        ; preds = %L.LB1_425
29  switch i32 undef, label %L.LB1_432 [
30    i32 30, label %L.LB1_805
31    i32 10, label %L.LB1_451
32    i32 20, label %L.LB1_451
33  ]
34
35L.LB1_451:                                        ; preds = %L.LB1_816, %L.LB1_816
36  unreachable
37
38L.LB1_432:                                        ; preds = %L.LB1_816
39  %.in.31 = lshr i64 %4, 32
40  %5 = trunc i64 %.in.31 to i32
41  br i1 undef, label %L.LB1_769, label %L.LB1_455
42
43L.LB1_455:                                        ; preds = %L.LB1_432
44  unreachable
45
46L.LB1_769:                                        ; preds = %L.LB1_432
47  %6 = sext i32 %5 to i64
48  %7 = add nsw i64 %6, 2
49  %8 = add nsw i64 %6, -1
50  %9 = mul i64 %8, %1
51  %10 = add i64 %9, %7
52  %11 = shl i64 %10, 3
53  %12 = getelementptr i8, i8* undef, i64 %11
54  %13 = mul nsw i64 %6, %1
55  %14 = add i64 %7, %13
56  %15 = shl i64 %14, 3
57  %16 = getelementptr i8, i8* undef, i64 %15
58  br i1 undef, label %L.LB1_662, label %L.LB1_662.prol
59
60L.LB1_662.prol:                                   ; preds = %L.LB1_662.prol, %L.LB1_769
61  %indvars.iv.next20.prol = add nuw nsw i64 undef, 1
62  br i1 undef, label %L.LB1_662, label %L.LB1_662.prol
63
64L.LB1_662:                                        ; preds = %L.LB1_437.2, %L.LB1_662.prol, %L.LB1_769
65  %indvars.iv19 = phi i64 [ %indvars.iv.next20.3, %L.LB1_437.2 ], [ 0, %L.LB1_769 ], [ %indvars.iv.next20.prol, %L.LB1_662.prol ]
66  %indvars.iv.next20 = add nuw nsw i64 %indvars.iv19, 1
67  %17 = mul i64 %indvars.iv.next20, %3
68  %18 = getelementptr i8, i8* %16, i64 %17
69  %19 = bitcast i8* %18 to double*
70  store double 0.000000e+00, double* %19, align 8
71  %indvars.iv.next20.1 = add nsw i64 %indvars.iv19, 2
72  %20 = mul i64 %indvars.iv.next20.1, %3
73  br i1 undef, label %L.LB1_437.2, label %L.LB1_824.2
74
75L.LB1_427:                                        ; preds = %L.LB1_425
76  %21 = load i64, i64* bitcast (i8* getelementptr inbounds (%struct.BSS1.0.9.28.39.43.46.47.54.56.57.64.65.69.71.144, %struct.BSS1.0.9.28.39.43.46.47.54.56.57.64.65.69.71.144* @.BSS1, i64 0, i32 0, i64 8) to i64*), align 8
77  br label %L.LB1_425
78
79L.LB1_805:                                        ; preds = %L.LB1_816
80  ret void
81
82L.LB1_824.2:                                      ; preds = %L.LB1_662
83  %22 = getelementptr i8, i8* %12, i64 %20
84  %23 = bitcast i8* %22 to double*
85  store double 0.000000e+00, double* %23, align 8
86  br label %L.LB1_437.2
87
88L.LB1_437.2:                                      ; preds = %L.LB1_824.2, %L.LB1_662
89  %indvars.iv.next20.3 = add nsw i64 %indvars.iv19, 4
90  br label %L.LB1_662
91}
92
93attributes #0 = { noinline nounwind }
94
95