blob: c103e29f3bf346afd5a5e59426e55fcffabb5c51 [file] [log] [blame]
Chris Lattner9e3152b2009-07-14 19:49:11 +00001; LSR should hoist the load from the "Arr" stub out of the loop.
2
Dan Gohman36a09472009-09-08 23:54:48 +00003; RUN: llc < %s -relocation-model=dynamic-no-pic -mtriple=i686-apple-darwin8.7.2 | FileCheck %s
Chris Lattner9e3152b2009-07-14 19:49:11 +00004
5; CHECK: _foo:
6; CHECK: L_Arr$non_lazy_ptr
Dan Gohman9f23dee2010-04-17 16:29:15 +00007; CHECK: LBB0_1:
Chris Lattnerc635d712006-09-13 05:59:25 +00008
Tanya Lattner33eefff2008-02-21 07:42:26 +00009@Arr = external global [0 x i32] ; <[0 x i32]*> [#uses=1]
Chris Lattnerc635d712006-09-13 05:59:25 +000010
Dan Gohman04623272009-05-18 15:16:49 +000011define void @foo(i32 %N.in, i32 %x) nounwind {
Chris Lattnerc635d712006-09-13 05:59:25 +000012entry:
Tanya Lattner33eefff2008-02-21 07:42:26 +000013 %N = bitcast i32 %N.in to i32 ; <i32> [#uses=1]
14 br label %cond_true
Chris Lattnerc635d712006-09-13 05:59:25 +000015
Tanya Lattner33eefff2008-02-21 07:42:26 +000016cond_true: ; preds = %cond_true, %entry
Dan Gohman80792f32008-04-15 01:22:18 +000017 %indvar = phi i32 [ %x, %entry ], [ %indvar.next, %cond_true ] ; <i32> [#uses=2]
Tanya Lattner33eefff2008-02-21 07:42:26 +000018 %i.0.0 = bitcast i32 %indvar to i32 ; <i32> [#uses=2]
19 %tmp = getelementptr [0 x i32]* @Arr, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
20 store i32 %i.0.0, i32* %tmp
21 %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=2]
22 %exitcond = icmp eq i32 %indvar.next, %N ; <i1> [#uses=1]
23 br i1 %exitcond, label %return, label %cond_true
Chris Lattnerc635d712006-09-13 05:59:25 +000024
Tanya Lattner33eefff2008-02-21 07:42:26 +000025return: ; preds = %cond_true
26 ret void
Chris Lattnerc635d712006-09-13 05:59:25 +000027}