brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.9 KiB · e844aea Raw
103 lines · plain
1; RUN: opt %loadNPMPolly -pass-remarks-missed=polly-detect -polly-detect-track-failures -polly-allow-nonaffine-loops=false '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=REJECTNONAFFINELOOPS2; RUN: opt %loadNPMPolly -pass-remarks-missed=polly-detect -polly-detect-track-failures -polly-allow-nonaffine-loops=true '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINELOOPS3; RUN: opt %loadNPMPolly -pass-remarks-missed=polly-detect -polly-process-unprofitable=false -polly-detect-track-failures -polly-allow-nonaffine-loops=true -polly-allow-nonaffine '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s --check-prefix=ALLOWNONAFFINEALL4 5; void f(int A[], int n) {6;   for (int i = 0; i < A[n+i]; i++)7;     A[i] = 0;8; }9 10; If we reject non-affine loops the non-affine loop bound will be reported:11;12; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:2:8: The following errors keep this region from being a Scop.13; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:2:8: Failed to derive an affine function from the loop bounds.14; REJECTNONAFFINELOOPS: remark: ReportLoopBound-01.c:3:5: Invalid Scop candidate ends here.15 16; If we allow non-affine loops the non-affine access will be reported:17;18; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:2:8: The following errors keep this region from being a Scop.19; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:3:5: The array subscript of "A" is not affine20; ALLOWNONAFFINELOOPS: remark: ReportLoopBound-01.c:3:5: Invalid Scop candidate ends here.21 22; If we allow non-affine loops and non-affine accesses the region will be reported as not profitable:23;24; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:2:8: The following errors keep this region from being a Scop.25; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:2:8: No profitable polyhedral optimization found26; ALLOWNONAFFINEALL: remark: ReportLoopBound-01.c:3:5: Invalid Scop candidate ends here.27 28target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"29 30define void @f(ptr %A, i32 %n) !dbg !4 {31entry:32  br label %entry.split33 34entry.split:                                      ; preds = %entry35  tail call void @llvm.dbg.value(metadata ptr %A, i64 0, metadata !13, metadata !DIExpression()), !dbg !1436  tail call void @llvm.dbg.value(metadata ptr %A, i64 0, metadata !13, metadata !DIExpression()), !dbg !1437  tail call void @llvm.dbg.value(metadata i32 %n, i64 0, metadata !15, metadata !DIExpression()), !dbg !1638  tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !18, metadata !DIExpression()), !dbg !2039  %idxprom = sext i32 %n to i64, !dbg !2140  %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom, !dbg !2141  %0 = load i32, ptr %arrayidx, align 4, !dbg !2142  %cmp3 = icmp sgt i32 %0, 0, !dbg !2143  br i1 %cmp3, label %for.body.lr.ph, label %for.end, !dbg !2144 45for.body.lr.ph:                                   ; preds = %entry.split46  br label %for.body, !dbg !2247 48for.body:                                         ; preds = %for.body.lr.ph, %for.body49  %indvar = phi i64 [ 0, %for.body.lr.ph ], [ %indvar.next, %for.body ]50  %arrayidx2 = getelementptr i32, ptr %A, i64 %indvar, !dbg !2451  %1 = add i64 %indvar, 1, !dbg !2452  %inc = trunc i64 %1 to i32, !dbg !2153  store i32 0, ptr %arrayidx2, align 4, !dbg !2454  tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !18, metadata !DIExpression()), !dbg !2055  %arrayidx3 = getelementptr inbounds i32, ptr %arrayidx, i64 %indvar, !dbg !2156  %2 = load i32, ptr %arrayidx3, align 4, !dbg !2157  %cmp = icmp slt i32 %inc, %2, !dbg !2158  %indvar.next = add i64 %indvar, 1, !dbg !2159  br i1 %cmp, label %for.body, label %for.cond.for.end_crit_edge, !dbg !2160 61for.cond.for.end_crit_edge:                       ; preds = %for.body62  br label %for.end, !dbg !2563 64for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry.split65  ret void, !dbg !2766}67 68declare void @llvm.dbg.declare(metadata, metadata, metadata)69 70declare void @llvm.dbg.value(metadata, i64, metadata, metadata)71 72!llvm.dbg.cu = !{!0}73!llvm.module.flags = !{!10, !11}74!llvm.ident = !{!12}75 76!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)77!1 = !DIFile(filename: "ReportLoopBound-01.c", directory: "test/ScopDetectionDiagnostic/")78!2 = !{}79!4 = distinct !DISubprogram(name: "f", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 1, file: !1, scope: !5, type: !6, retainedNodes: !2)80!5 = !DIFile(filename: "ReportLoopBound-01.c", directory: "test/ScopDetectionDiagnostic/")81!6 = !DISubroutineType(types: !7)82!7 = !{null, !8, !9}83!8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9)84!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)85!10 = !{i32 2, !"Dwarf Version", i32 4}86!11 = !{i32 2, !"Debug Info Version", i32 3}87!12 = !{!"clang version 3.6.0 "}88!13 = !DILocalVariable(name: "A", line: 1, arg: 1, scope: !4, file: !5, type: !8)89!14 = !DILocation(line: 1, column: 12, scope: !4)90!15 = !DILocalVariable(name: "n", line: 1, arg: 2, scope: !4, file: !5, type: !9)91!16 = !DILocation(line: 1, column: 21, scope: !4)92!17 = !{i32 0}93!18 = !DILocalVariable(name: "i", line: 2, scope: !19, file: !5, type: !9)94!19 = distinct !DILexicalBlock(line: 2, column: 3, file: !1, scope: !4)95!20 = !DILocation(line: 2, column: 12, scope: !19)96!21 = !DILocation(line: 2, column: 8, scope: !19)97!22 = !DILocation(line: 2, column: 8, scope: !23)98!23 = distinct !DILexicalBlock(line: 2, column: 8, file: !1, scope: !19)99!24 = !DILocation(line: 3, column: 5, scope: !19)100!25 = !DILocation(line: 2, column: 8, scope: !26)101!26 = distinct !DILexicalBlock(line: 2, column: 8, file: !1, scope: !19)102!27 = !DILocation(line: 4, column: 1, scope: !4)103