45 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=loop-load-elim %s | FileCheck %s3 4; The backedge taken count of this loop is an i1 type, and the IV is i8.5; The math in LoopAccessAnalysis was rounding the type sizes to bytes and6; believing them equal, causing a size mismatch.7 8target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"9 10@a = external dso_local local_unnamed_addr global [1 x i32], align 411 12define dso_local void @test(i8 %inc) local_unnamed_addr {13; CHECK-LABEL: @test(14; CHECK-NEXT: entry:15; CHECK-NEXT: br label [[FOR_COND3:%.*]]16; CHECK: for.cond3:17; CHECK-NEXT: [[H_0:%.*]] = phi i8 [ 0, [[ENTRY:%.*]] ], [ [[ADD:%.*]], [[COND_END_FOR_COND_CLEANUP_LOOPEXIT_CRIT_EDGE:%.*]] ]18; CHECK-NEXT: [[IDXPROM11:%.*]] = sext i8 [[H_0]] to i6419; CHECK-NEXT: [[ARRAYIDX27:%.*]] = getelementptr inbounds [1 x i32], ptr @a, i64 0, i64 [[IDXPROM11]]20; CHECK-NEXT: br label [[FOR_BODY:%.*]]21; CHECK: cond.end.for.cond.cleanup.loopexit_crit_edge:22; CHECK-NEXT: [[ADD]] = add i8 [[H_0]], [[INC:%.*]]23; CHECK-NEXT: br label [[FOR_COND3]]24; CHECK: for.body:25; CHECK-NEXT: store i32 0, ptr [[ARRAYIDX27]], align 426; CHECK-NEXT: br i1 true, label [[COND_END_FOR_COND_CLEANUP_LOOPEXIT_CRIT_EDGE]], label [[FOR_BODY]]27;28entry:29 br label %for.cond330 31for.cond3: ; preds = %cond.end.for.cond.cleanup.loopexit_crit_edge, %entry32 %h.0 = phi i8 [ 0, %entry ], [ %add, %cond.end.for.cond.cleanup.loopexit_crit_edge ]33 %idxprom11 = sext i8 %h.0 to i6434 %arrayidx27 = getelementptr inbounds [1 x i32], ptr @a, i64 0, i64 %idxprom1135 br label %for.body36 37cond.end.for.cond.cleanup.loopexit_crit_edge: ; preds = %for.body38 %add = add i8 %h.0, %inc39 br label %for.cond340 41for.body: ; preds = %for.body, %for.cond342 store i32 0, ptr %arrayidx27, align 443 br i1 true, label %cond.end.for.cond.cleanup.loopexit_crit_edge, label %for.body44}45