89 lines · plain
1; RUN: opt < %s -loop-reduce -S | FileCheck %s2target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"3target triple = "x86_64-apple-macosx10.9.0"4 5; LSR shouldn't reuse IV if the resultant offset is not valid for the operand type.6; CHECK-NOT: trunc i32 %.ph to i87 8%struct.anon = type { i32, i32, i32 }9 10@c = global i32 1, align 411@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 112@b = common global i32 0, align 413@a = common global %struct.anon zeroinitializer, align 414@e = common global %struct.anon zeroinitializer, align 415@d = common global i32 0, align 416@f = common global i32 0, align 417@g = common global i32 0, align 418@h = common global i32 0, align 419 20; Function Attrs: nounwind optsize ssp uwtable21define i32 @main() #0 {22entry:23 %0 = load i32, ptr @a, align 4, !tbaa !124 %tobool7.i = icmp eq i32 %0, 025 %.promoted.i = load i32, ptr getelementptr inbounds (%struct.anon, ptr @a, i64 0, i32 2), align 4, !tbaa !626 %f.promoted.i = load i32, ptr @f, align 4, !tbaa !727 br label %for.body6.i.outer28 29for.body6.i.outer: ; preds = %entry, %lor.end.i30 %.ph = phi i32 [ %add.i, %lor.end.i ], [ 0, %entry ]31 %or1512.i.ph = phi i32 [ %or15.i, %lor.end.i ], [ %f.promoted.i, %entry ]32 %or1410.i.ph = phi i32 [ %or14.i, %lor.end.i ], [ %.promoted.i, %entry ]33 %p.addr.16.i.ph = phi i8 [ %inc10.i, %lor.end.i ], [ -128, %entry ]34 br i1 %tobool7.i, label %if.end9.i, label %lbl.loopexit.i35 36lbl.loopexit.i: ; preds = %for.body6.i.outer, %lbl.loopexit.i37 br label %lbl.loopexit.i38 39if.end9.i: ; preds = %for.body6.i.outer40 %inc10.i = add i8 %p.addr.16.i.ph, 141 %tobool12.i = icmp eq i8 %p.addr.16.i.ph, 042 br i1 %tobool12.i, label %lor.rhs.i, label %lor.end.i43 44lor.rhs.i: ; preds = %if.end9.i45 %1 = load i32, ptr @b, align 4, !tbaa !746 %dec.i = add nsw i32 %1, -147 store i32 %dec.i, ptr @b, align 4, !tbaa !748 %tobool13.i = icmp ne i32 %1, 049 br label %lor.end.i50 51lor.end.i: ; preds = %lor.rhs.i, %if.end9.i52 %2 = phi i1 [ true, %if.end9.i ], [ %tobool13.i, %lor.rhs.i ]53 %lor.ext.i = zext i1 %2 to i3254 %or14.i = or i32 %lor.ext.i, %or1410.i.ph55 %or15.i = or i32 %or14.i, %or1512.i.ph56 %add.i = add nsw i32 %.ph, 257 %cmp.i = icmp slt i32 %add.i, 2158 br i1 %cmp.i, label %for.body6.i.outer, label %fn1.exit59 60fn1.exit: ; preds = %lor.end.i61 store i32 0, ptr @g, align 4, !tbaa !762 store i32 %or14.i, ptr getelementptr inbounds (%struct.anon, ptr @a, i64 0, i32 2), align 4, !tbaa !663 store i32 %or15.i, ptr @f, align 4, !tbaa !764 store i32 %add.i, ptr getelementptr inbounds (%struct.anon, ptr @e, i64 0, i32 1), align 4, !tbaa !865 store i32 0, ptr @h, align 4, !tbaa !766 %3 = load i32, ptr @b, align 4, !tbaa !767 %call1 = tail call i32 (ptr, ...) @printf(ptr @.str, i32 %3) #268 ret i32 069}70 71; Function Attrs: nounwind optsize72declare i32 @printf(ptr nocapture readonly, ...) #173 74attributes #0 = { nounwind optsize ssp uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }75attributes #1 = { nounwind optsize "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "use-soft-float"="false" }76attributes #2 = { nounwind optsize }77 78!llvm.ident = !{!0}79 80!0 = !{!"clang version 3.5 "}81!1 = !{!2, !3, i64 0}82!2 = !{!"", !3, i64 0, !3, i64 4, !3, i64 8}83!3 = !{!"int", !4, i64 0}84!4 = !{!"omnipotent char", !5, i64 0}85!5 = !{!"Simple C/C++ TBAA"}86!6 = !{!2, !3, i64 8}87!7 = !{!3, !3, i64 0}88!8 = !{!2, !3, i64 4}89