1 ; RUN: opt -loop-load-elim -S %s | FileCheck %s
2 ; RUN: opt -passes=loop-load-elim -S %s | FileCheck %s
5 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
6 target triple = "x86_64-unknown-linux-gnu"
8 ; Make sure it does not crash with assert.
15 bb1: ; preds = %bb6, %bb1, %bb
16 %tmp = phi i32 [ undef, %bb ], [ 0, %bb1 ], [ %tmp3, %bb6 ]
17 br i1 undef, label %bb1, label %bb2
20 %tmp3 = add i32 %tmp, 1
21 %tmp4 = icmp ult i32 %tmp, undef
22 br i1 %tmp4, label %bb6, label %bb5
28 br i1 undef, label %bb7, label %bb1
30 bb7: ; preds = %bb7, %bb6
31 %tmp8 = phi i32 [ %tmp15, %bb7 ], [ %tmp3, %bb6 ]
32 %tmp9 = phi i32 [ %tmp8, %bb7 ], [ %tmp, %bb6 ]
33 %tmp10 = zext i32 %tmp9 to i64
34 %tmp11 = getelementptr inbounds float, float addrspace(1)* null, i64 %tmp10
35 %tmp12 = load float, float addrspace(1)* %tmp11, align 4
36 %tmp13 = zext i32 %tmp8 to i64
37 %tmp14 = getelementptr inbounds float, float addrspace(1)* null, i64 %tmp13
38 store float 1.000000e+00, float addrspace(1)* %tmp14, align 4
39 %tmp15 = add nuw nsw i32 %tmp8, 1
40 %tmp16 = icmp sgt i32 %tmp8, 78
41 br i1 %tmp16, label %bb17, label %bb7