1 ; RUN: opt -passes=indvars,loop-idiom,loop-deletion -S < %s | FileCheck %s
3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-unknown-linux-gnu"
8 define void @f(ptr %a, i1 %arg) {
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, ptr %a, i64 %idxprom
18 br i1 %arg, label %for.cond, label %for.inc
20 for.inc: ; preds = %for.cond
21 br i1 %arg, label %for.cond, label %for.end
23 for.end: ; preds = %for.inc