43 lines · plain
1; RUN: opt -S -aa-pipeline=basic-aa -passes=gvn < %s | FileCheck %s2 3target datalayout = "e-m:o-p:64:64-f64:32:64-f80:128-n8:16:32-S128"4target triple = "x86_64-apple-macosx10.6.0"5 6; The load and store address in the loop body could alias so the load7; can't be hoisted above the store and out of the loop.8 9declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i32, i1)10 11define i64 @foo(i64 %x, i64 %z, i64 %n) {12entry:13 %pool = alloca [59 x i64], align 414 call void @llvm.memset.p0.i64(ptr nonnull %pool, i8 0, i64 236, i32 4, i1 false)15 %cmp3 = icmp eq i64 %n, 016 br i1 %cmp3, label %for.end, label %for.body.lr.ph17 18for.body.lr.ph: ; preds = %entry19 %add = add i64 %z, %x20 %and = and i64 %add, 922337203685477580721 %sub = add nsw i64 %and, -922337203684481406222 %arrayidx = getelementptr inbounds [59 x i64], ptr %pool, i64 0, i64 %sub23 %arrayidx1 = getelementptr inbounds [59 x i64], ptr %pool, i64 0, i64 4224 br label %for.body25 26for.body: ; preds = %for.body.lr.ph, %for.body27 %i.04 = phi i64 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]28 store i64 %i.04, ptr %arrayidx, align 429 %tmp1 = load i64, ptr %arrayidx1, align 430 %inc = add nuw i64 %i.04, 131 %exitcond = icmp ne i64 %inc, %n32 br i1 %exitcond, label %for.body, label %for.end.loopexit33 34for.end.loopexit: ; preds = %for.body35 %lcssa = phi i64 [ %tmp1, %for.body ]36 br label %for.end37 38for.end: ; preds = %for.end.loopexit, %entry39 %s = phi i64 [ 0, %entry ], [ %lcssa, %for.end.loopexit ]40; CHECK: ret i64 %s41 ret i64 %s42}43