61 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly<no-default-opts>' -polly-invariant-load-hoisting=true -S < %s | FileCheck %s2;3; Verify the preloaded %tmp0 is stored and communicated in the same alloca.4; In this case, we do not reload %ncol.load from the scalar stack slot, but5; instead use directly the preloaded value stored in GlobalMap.6;7; CHECK-NOT: alloca8; CHECK: %tmp0.preload.s2a = alloca i329; CHECK-NOT: alloca10;11; CHECK: %ncol.load = load i32, ptr @ncol12; CHECK-NEXT: store i32 %ncol.load, ptr %tmp0.preload.s2a13;14target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"15 16@ncol = external global i32, align 417 18define void @melt_data(ptr %data1, ptr %data2) {19entry:20 br label %entry.split21 22entry.split: ; preds = %entry23 %tmp0 = load i32, ptr @ncol, align 424 %tobool.2 = icmp eq i32 %tmp0, 025 br i1 %tobool.2, label %while.end, label %while.body.lr.ph26 27while.body.lr.ph: ; preds = %entry.split28 br label %while.body29 30while.body: ; preds = %while.body.lr.ph, %while.cond.backedge31 %dec3.in = phi i32 [ %tmp0, %while.body.lr.ph ], [ %dec3, %while.cond.backedge ]32 %dec3 = add nsw i32 %dec3.in, -133 %idxprom = sext i32 %dec3 to i6434 %arrayidx = getelementptr inbounds i32, ptr %data1, i64 %idxprom35 %tmp1 = load i32, ptr %arrayidx, align 436 %idxprom1 = sext i32 %dec3 to i6437 %arrayidx2 = getelementptr inbounds i32, ptr %data2, i64 %idxprom138 %tmp2 = load i32, ptr %arrayidx2, align 439 %cmp = icmp sgt i32 %tmp1, %tmp240 br i1 %cmp, label %if.then, label %while.cond.backedge41 42if.then: ; preds = %while.body43 %idxprom3 = sext i32 %dec3 to i6444 %arrayidx4 = getelementptr inbounds i32, ptr %data2, i64 %idxprom345 %tmp3 = load i32, ptr %arrayidx4, align 446 %idxprom5 = sext i32 %dec3 to i6447 %arrayidx6 = getelementptr inbounds i32, ptr %data1, i64 %idxprom548 store i32 %tmp3, ptr %arrayidx6, align 449 br label %while.cond.backedge50 51while.cond.backedge: ; preds = %if.then, %while.body52 %tobool = icmp eq i32 %dec3, 053 br i1 %tobool, label %while.cond.while.end_crit_edge, label %while.body54 55while.cond.while.end_crit_edge: ; preds = %while.cond.backedge56 br label %while.end57 58while.end: ; preds = %while.cond.while.end_crit_edge, %entry.split59 ret void60}61