1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -passes=loop-load-elim %s | FileCheck %s 3 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 and 6; 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 4 11 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 i64 19; 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 4 26; CHECK-NEXT: br i1 true, label [[COND_END_FOR_COND_CLEANUP_LOOPEXIT_CRIT_EDGE]], label [[FOR_BODY]] 27; 28entry: 29 br label %for.cond3 30 31for.cond3: ; preds = %cond.end.for.cond.cleanup.loopexit_crit_edge, %entry 32 %h.0 = phi i8 [ 0, %entry ], [ %add, %cond.end.for.cond.cleanup.loopexit_crit_edge ] 33 %idxprom11 = sext i8 %h.0 to i64 34 %arrayidx27 = getelementptr inbounds [1 x i32], ptr @a, i64 0, i64 %idxprom11 35 br label %for.body 36 37cond.end.for.cond.cleanup.loopexit_crit_edge: ; preds = %for.body 38 %add = add i8 %h.0, %inc 39 br label %for.cond3 40 41for.body: ; preds = %for.body, %for.cond3 42 store i32 0, ptr %arrayidx27, align 4 43 br i1 true, label %cond.end.for.cond.cleanup.loopexit_crit_edge, label %for.body 44} 45