1*cee313d2SEric Christopher; RUN: opt -S -loop-vectorize -force-vector-width=4 -force-vector-interleave=1 -dce -instcombine < %s | FileCheck %s 2*cee313d2SEric Christopher 3*cee313d2SEric Christophertarget datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" 4*cee313d2SEric Christopher 5*cee313d2SEric Christopher; PR16073 6*cee313d2SEric Christopher 7*cee313d2SEric Christopher; Because we were caching value pointers across a function call that could RAUW 8*cee313d2SEric Christopher; we would generate an undefined value store below: 9*cee313d2SEric Christopher; SCEVExpander::expandCodeFor would change a value (the start value of an 10*cee313d2SEric Christopher; induction) that we cached in the induction variable list. 11*cee313d2SEric Christopher 12*cee313d2SEric Christopher; CHECK-LABEL: @test_vh( 13*cee313d2SEric Christopher; CHECK-NOT: store <4 x i8> undef 14*cee313d2SEric Christopher 15*cee313d2SEric Christopherdefine void @test_vh(i32* %ptr265, i32* %ptr266, i32 %sub267) { 16*cee313d2SEric Christopherentry: 17*cee313d2SEric Christopher br label %loop 18*cee313d2SEric Christopher 19*cee313d2SEric Christopherloop: 20*cee313d2SEric Christopher %inc = phi i32 [ %sub267, %entry ], [ %add, %loop] 21*cee313d2SEric Christopher %ext.inc = sext i32 %inc to i64 22*cee313d2SEric Christopher %add.ptr265 = getelementptr inbounds i32, i32* %ptr265, i64 %ext.inc 23*cee313d2SEric Christopher %add.ptr266 = getelementptr inbounds i32, i32* %ptr266, i64 %ext.inc 24*cee313d2SEric Christopher %add = add i32 %inc, 9 25*cee313d2SEric Christopher %cmp = icmp slt i32 %add, 140 26*cee313d2SEric Christopher br i1 %cmp, label %block1, label %loop 27*cee313d2SEric Christopher 28*cee313d2SEric Christopherblock1: 29*cee313d2SEric Christopher %sub267.lcssa = phi i32 [ %add, %loop ] 30*cee313d2SEric Christopher %add.ptr266.lcssa = phi i32* [ %add.ptr266, %loop ] 31*cee313d2SEric Christopher %add.ptr265.lcssa = phi i32* [ %add.ptr265, %loop ] 32*cee313d2SEric Christopher %tmp29 = bitcast i32* %add.ptr265.lcssa to i8* 33*cee313d2SEric Christopher %tmp30 = bitcast i32* %add.ptr266.lcssa to i8* 34*cee313d2SEric Christopher br label %do.body272 35*cee313d2SEric Christopher 36*cee313d2SEric Christopherdo.body272: 37*cee313d2SEric Christopher %row_width.5 = phi i32 [ %sub267.lcssa, %block1 ], [ %dec, %do.body272 ] 38*cee313d2SEric Christopher %sp.4 = phi i8* [ %tmp30, %block1 ], [ %incdec.ptr273, %do.body272 ] 39*cee313d2SEric Christopher %dp.addr.4 = phi i8* [ %tmp29, %block1 ], [ %incdec.ptr274, %do.body272 ] 40*cee313d2SEric Christopher %incdec.ptr273 = getelementptr inbounds i8, i8* %sp.4, i64 1 41*cee313d2SEric Christopher %tmp31 = load i8, i8* %sp.4, align 1 42*cee313d2SEric Christopher %incdec.ptr274 = getelementptr inbounds i8, i8* %dp.addr.4, i64 1 43*cee313d2SEric Christopher store i8 %tmp31, i8* %dp.addr.4, align 1 44*cee313d2SEric Christopher %dec = add i32 %row_width.5, -1 45*cee313d2SEric Christopher %cmp276 = icmp eq i32 %dec, 0 46*cee313d2SEric Christopher br i1 %cmp276, label %loop.exit, label %do.body272 47*cee313d2SEric Christopher 48*cee313d2SEric Christopherloop.exit: 49*cee313d2SEric Christopher ret void 50*cee313d2SEric Christopher} 51