1*cee313d2SEric Christopher; RUN: opt < %s -indvars -S | FileCheck %s
2*cee313d2SEric Christopher
3*cee313d2SEric Christophertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4*cee313d2SEric Christopher
5*cee313d2SEric Christopher; PR25372
6*cee313d2SEric Christopher; We can compute the expression of %phi0 and that is a SCEV
7*cee313d2SEric Christopher; constant. However, instcombine can't deduce this, so we can
8*cee313d2SEric Christopher; potentially end up trying to handle a constant when replacing
9*cee313d2SEric Christopher; congruent IVs.
10*cee313d2SEric Christopher
11*cee313d2SEric Christopher; CHECK-LABEL: crash
12*cee313d2SEric Christopherdefine void @crash() {
13*cee313d2SEric Christopherentry:
14*cee313d2SEric Christopher  br i1 false, label %not_taken, label %pre
15*cee313d2SEric Christopher
16*cee313d2SEric Christophernot_taken:
17*cee313d2SEric Christopher  br label %pre
18*cee313d2SEric Christopher
19*cee313d2SEric Christopherpre:
20*cee313d2SEric Christopher; %phi0.pre and %phi1.pre are evaluated by SCEV to constant 0.
21*cee313d2SEric Christopher  %phi0.pre = phi i32 [ 0, %entry ], [ 2, %not_taken ]
22*cee313d2SEric Christopher  %phi1.pre = phi i32 [ 0, %entry ], [ 1, %not_taken ]
23*cee313d2SEric Christopher  br label %loop
24*cee313d2SEric Christopher
25*cee313d2SEric Christopherloop:
26*cee313d2SEric Christopher; %phi0 and %phi1 are evaluated by SCEV to constant 0.
27*cee313d2SEric Christopher  %phi0 = phi i32 [ 0, %loop ], [ %phi0.pre, %pre ]
28*cee313d2SEric Christopher  %phi1 = phi i32 [ 0, %loop ], [ %phi1.pre, %pre ]
29*cee313d2SEric Christopher  br i1 undef, label %exit, label %loop
30*cee313d2SEric Christopher
31*cee313d2SEric Christopherexit:
32*cee313d2SEric Christopher  ret void
33*cee313d2SEric Christopher}
34