54 lines · plain
1; RUN: opt %loadNPMPolly -polly-process-unprofitable -polly-invariant-load-hoisting '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s -check-prefix=SCOPS2; RUN: opt %loadNPMPolly -S '-passes=polly<no-default-opts>' -polly-process-unprofitable -polly-invariant-load-hoisting < %s | FileCheck %s -check-prefix=CODEGEN3 4target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n8:16:32-S64"5 6%S = type { i32, i32, [12 x %L] }7%L = type { i32, i32, double, i32, i32, i32, i32, i32 }8 9define void @test(ptr %cpi, i1 %b) {10; SCOPS-LABEL: Region: %if.then14---%exit11; SCOPS: Invariant Accesses: {12; SCOPS-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]13; SCOPS-NEXT: [l2, l1] -> { Stmt_for_body_i[i0] -> MemRef_cpi[0, 0] };14; SCOPS-NEXT: Execution Context: [l2, l1] -> { : }15; SCOPS-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]16; SCOPS-NEXT: [l2, l1] -> { Stmt_for_body_lr_ph_i[] -> MemRef_cpi[0, 1] };17; SCOPS-NEXT: Execution Context: [l2, l1] -> { : l2 > 0 }18; SCOPS-NEXT: }19; SCOPS: Arrays {20; SCOPS-NEXT: i32 MemRef_cpi[*][(10 * %l1)]; // Element size 421; SCOPS-NEXT: }22 23; FIXME: Figure out how to actually generate code for this loop.24; CODEGEN-LABEL: @test(25; CODEGEN: polly.preload.begin:26; CODEGEN-NEXT: br i1 false27 28entry:29 %nt = getelementptr inbounds %S, ptr %cpi, i32 0, i32 130 br i1 %b, label %if.then14, label %exit31 32if.then14:33 %l0 = load i32, ptr %cpi, align 834 %cmp12.i = icmp sgt i32 %l0, 035 br i1 %cmp12.i, label %for.body.lr.ph.i, label %exit36 37for.body.lr.ph.i:38 %l1 = load i32, ptr %nt, align 439 br label %for.body.i40 41for.body.i:42 %phi = phi i32 [ 0, %for.body.lr.ph.i ], [ %inc, %for.body.i ]43 %mul.i163 = mul nsw i32 %phi, %l144 %cv = getelementptr inbounds %S, ptr %cpi, i32 0, i32 2, i32 %mul.i163, i32 045 store i32 0, ptr %cv, align 846 %inc = add nuw nsw i32 %phi, 147 %l2 = load i32, ptr %cpi, align 848 %cmp.i164 = icmp slt i32 %inc, %l249 br i1 %cmp.i164, label %for.body.i, label %exit50 51exit:52 ret void53}54