1 ; RUN: opt -loop-reduce %s -S -o - | FileCheck %s
2 target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32"
3 target triple = "i686-pc-win32"
5 ; <rdar://problem/14199725> Assertion failed: (CurScaleCost >= 0 && "Legal addressing mode has an illegal cost!")
6 ; CHECK-LABEL: @scalingFactorCrash(
7 define void @scalingFactorCrash() {
8 br i1 undef, label %1, label %24
10 ; <label>:1 ; preds = %0
11 br i1 undef, label %2, label %24
13 ; <label>:2 ; preds = %1
14 br i1 undef, label %3, label %24
16 ; <label>:3 ; preds = %2
17 br i1 undef, label %4, label %24
19 ; <label>:4 ; preds = %3
20 br i1 undef, label %24, label %6
22 ; <label>:5 ; preds = %6
23 br i1 undef, label %24, label %7
25 ; <label>:6 ; preds = %6, %4
26 br i1 undef, label %6, label %5
28 ; <label>:7 ; preds = %9, %5
31 ; <label>:8 ; preds = %8, %7
32 br i1 undef, label %9, label %8
34 ; <label>:9 ; preds = %8
35 br i1 undef, label %7, label %10
37 ; <label>:10 ; preds = %9
38 br i1 undef, label %24, label %11
40 ; <label>:11 ; preds = %10
41 br i1 undef, label %15, label %13
43 ; <label>:12 ; preds = %14
46 ; <label>:13 ; preds = %11
49 ; <label>:14 ; preds = %14, %13
50 br i1 undef, label %14, label %12
52 ; <label>:15 ; preds = %12, %11
53 br i1 undef, label %16, label %24
55 ; <label>:16 ; preds = %16, %15
56 %17 = phi i32 [ %21, %16 ], [ undef, %15 ]
57 %18 = sub i32 %17, 1623127498
58 %19 = getelementptr inbounds i32, ptr undef, i32 %18
59 store i32 undef, ptr %19, align 4
60 %20 = add i32 %17, 1623127499
61 %21 = add i32 %20, -1623127498
62 %22 = add i32 %21, -542963121
63 %23 = icmp ult i32 %22, undef
64 br i1 undef, label %16, label %24
66 ; <label>:24 ; preds = %16, %15, %10, %5, %4, %3, %2, %1, %0