1 ; RUN: opt -indvars -loop-idiom -loop-deletion -S < %s | FileCheck %s 2 3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 4 target triple = "x86_64-unknown-linux-gnu" 5 6 ; Checking for a crash 7 8 define void @f(i32* %a) { 9 ; CHECK-LABEL: @f( 10 entry: 11 br label %for.cond 12 13 for.cond: ; preds = %for.inc, %for.cond, %entry 14 %iv = phi i32 [ 0, %entry ], [ %add, %for.inc ], [ %iv, %for.cond ] 15 %add = add nsw i32 %iv, 1 16 %idxprom = sext i32 %add to i64 17 %arrayidx = getelementptr inbounds i32, i32* %a, i64 %idxprom 18 br i1 undef, label %for.cond, label %for.inc 19 20 for.inc: ; preds = %for.cond 21 br i1 undef, label %for.cond, label %for.end 22 23 for.end: ; preds = %for.inc 24 ret void 25 } 26