1 ; RUN: opt -S -indvars < %s | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-apple-macosx10.11.0"
6 ; SCEVExpander would try to RAUW %val_2 with %c.lcssa, breaking "def
9 define void @pr27232(i32 %val) {
10 ; CHECK-LABEL: @pr27232(
12 br i1 undef, label %loop_0.cond, label %for.body.us
18 %val_2 = phi i32 [ %val, %for.body.us ], [ undef, %entry ]
19 br i1 true, label %loop_0.ph, label %loop_1.ph
28 %c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val_2, %loop_1.exit ]
32 br i1 undef, label %loop_0, label %loop_1.exit
35 %d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val_2, %loop_1.ph ]
36 %t.1 = phi i32 [ %val_2, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
37 br i1 undef, label %leave, label %loop_1
44 ; @ReplaceArg_0 and @ReplaceArg_1 used to trigger a failed cast<>
45 ; assertion in SCEVExpander.
47 define void @ReplaceArg_0(i32 %val) {
48 ; CHECK-LABEL: @ReplaceArg_0(
50 br i1 undef, label %loop_0.cond, label %for.body.us
56 br i1 true, label %loop_0.ph, label %loop_1.ph
65 %c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val, %loop_1.exit ]
69 br i1 undef, label %loop_0, label %loop_1.exit
72 %d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val, %loop_1.ph ]
73 %t.1 = phi i32 [ %val, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
74 br i1 undef, label %leave, label %loop_1
80 define void @ReplaceArg_1(i32 %val) {
81 ; CHECK-LABEL: @ReplaceArg_1(
83 br i1 undef, label %loop_0.cond, label %for.body.us
89 br i1 true, label %loop_0.ph, label %loop_1.ph
98 %c.lcssa = phi i32 [ 0, %loop_0.cond ], [ %val, %loop_1.exit ]
102 br i1 undef, label %loop_0, label %loop_1.exit
105 %t.1 = phi i32 [ %val, %loop_1 ], [ %c.lcssa, %loop_1.ph ]
106 %d.1 = phi i32 [ %c.lcssa, %loop_1 ], [ %val, %loop_1.ph ]
107 br i1 undef, label %leave, label %loop_1