1 ; RUN: opt -indvars -S < %s | FileCheck %s
3 ; Indvars should be able to simplify simple comparisons involving
6 ; CHECK: %cond = and i1 %tobool.not, true
8 target 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"
10 @X = external global [0 x double]
12 define void @foo(i64 %n, i32* nocapture %p) nounwind {
14 %cmp9 = icmp sgt i64 %n, 0
15 br i1 %cmp9, label %pre, label %return
19 %tobool.not = icmp ne i32 %t3, 0
23 %i = phi i64 [ 0, %pre ], [ %inc, %for.inc ]
24 %cmp6 = icmp slt i64 %i, %n
25 %cond = and i1 %tobool.not, %cmp6
26 br i1 %cond, label %if.then, label %for.inc
29 %arrayidx = getelementptr [0 x double]* @X, i64 0, i64 %i
30 store double 3.200000e+00, double* %arrayidx
34 %inc = add nsw i64 %i, 1
35 %exitcond = icmp sge i64 %inc, %n
36 br i1 %exitcond, label %return, label %loop