1; RUN: opt %loadNPMPolly -pass-remarks-missed="polly-detect" -polly-detect-track-failures '-passes=print<polly-detect>' -disable-output < %s 2>&1| FileCheck %s 2 3; void f(int A[]) { 4; for(int i=0; i<42; ++i) 5; A[i*i] = 0; 6; } 7 8 9; CHECK: remark: ReportNonAffineAccess-01.c:2:7: The following errors keep this region from being a Scop. 10; CHECK: remark: ReportNonAffineAccess-01.c:3:5: The array subscript of "A" is not affine 11; CHECK: remark: ReportNonAffineAccess-01.c:3:5: Invalid Scop candidate ends here. 12 13target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 14 15define void @f(ptr %A) !dbg !4 { 16entry: 17 br label %entry.split 18 19entry.split: ; preds = %entry 20 tail call void @llvm.dbg.value(metadata ptr %A, i64 0, metadata !13, metadata !DIExpression()), !dbg !14 21 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !DIExpression()), !dbg !18 22 br label %for.body, !dbg !19 23 24for.body: ; preds = %entry.split, %for.body 25 %0 = phi i32 [ 0, %entry.split ], [ %1, %for.body ], !dbg !20 26 %mul = mul nsw i32 %0, %0, !dbg !20 27 %idxprom1 = zext i32 %mul to i64, !dbg !20 28 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %idxprom1, !dbg !20 29 store i32 0, ptr %arrayidx, align 4, !dbg !20 30 %1 = add nsw i32 %0, 1, !dbg !21 31 tail call void @llvm.dbg.value(metadata i32 %1, i64 0, metadata !16, metadata !DIExpression()), !dbg !18 32 %exitcond = icmp ne i32 %1, 42, !dbg !19 33 br i1 %exitcond, label %for.body, label %for.end, !dbg !19 34 35for.end: ; preds = %for.body 36 ret void, !dbg !22 37} 38 39declare void @llvm.dbg.declare(metadata, metadata, metadata) 40 41declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 42 43attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 44attributes #1 = { nounwind readnone } 45 46!llvm.dbg.cu = !{!0} 47!llvm.module.flags = !{!10, !11} 48!llvm.ident = !{!12} 49 50!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) 51!1 = !DIFile(filename: "ReportNonAffineAccess-01.c", directory: "test/ScopDetectionDiagnostic/") 52!2 = !{} 53!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) 54!5 = !DIFile(filename: "ReportNonAffineAccess-01.c", directory: "test/ScopDetectionDiagnostic/") 55!6 = !DISubroutineType(types: !7) 56!7 = !{null, !8} 57!8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9) 58!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 59!10 = !{i32 2, !"Dwarf Version", i32 4} 60!11 = !{i32 2, !"Debug Info Version", i32 3} 61!12 = !{!"clang version 3.6.0 "} 62!13 = !DILocalVariable(name: "A", line: 1, arg: 1, scope: !4, file: !5, type: !8) 63!14 = !DILocation(line: 1, column: 12, scope: !4) 64!15 = !{i32 0} 65!16 = !DILocalVariable(name: "i", line: 2, scope: !17, file: !5, type: !9) 66!17 = distinct !DILexicalBlock(line: 2, column: 3, file: !1, scope: !4) 67!18 = !DILocation(line: 2, column: 11, scope: !17) 68!19 = !DILocation(line: 2, column: 7, scope: !17) 69!20 = !DILocation(line: 3, column: 5, scope: !17) 70!21 = !DILocation(line: 2, column: 22, scope: !17) 71!22 = !DILocation(line: 4, column: 1, scope: !4) 72