1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=loop-load-elim %s | FileCheck %s
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.
8 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
10 @a = external dso_local local_unnamed_addr global [1 x i32], align 4
12 define dso_local void @test(i8 %inc) local_unnamed_addr {
15 ; CHECK-NEXT: br label [[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]]
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]]
31 for.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
37 cond.end.for.cond.cleanup.loopexit_crit_edge: ; preds = %for.body
38 %add = add i8 %h.0, %inc
41 for.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