100 lines · plain
1; RUN: opt %loadNPMPolly -pass-remarks-missed=polly-detect -polly-detect-track-failures '-passes=polly-custom<detect>' -polly-print-detect -disable-output < %s 2>&1 | FileCheck %s2 3; struct b {4; double **b;5; };6;7; void a(struct b *A) {8; for (int i=0; i<32; i++)9; A[i].b[i] = 0;10; }11 12; The loads are currently just adds %7 to the list of required invariant loads13; and only -polly-scops checks whether it is actionally possible the be load14; hoisted. The SCoP is still rejected by -polly-detect because it may alias15; with %A and is not considered to be eligible for runtime alias checking.16 17; CHECK: remark: ReportVariantBasePtr01.c:6:8: The following errors keep this region from being a Scop.18; CHECK: remark: ReportVariantBasePtr01.c:7:5: Accesses to the arrays "A", " <unknown> " may access the same memory.19 20target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"21 22%struct.b = type { ptr }23 24define void @a(ptr nocapture readonly %A) !dbg !4 {25entry:26 br label %entry.split27 28entry.split: ; preds = %entry29 tail call void @llvm.dbg.value(metadata ptr %A, i64 0, metadata !16, metadata !DIExpression()), !dbg !2330 tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !17, metadata !DIExpression()), !dbg !2531 br label %for.body, !dbg !2732 33for.body: ; preds = %for.body, %entry.split34 %indvar4 = phi i64 [ %indvar.next, %for.body ], [ 0, %entry.split ]35 %b = getelementptr inbounds %struct.b, ptr %A, i64 %indvar4, i32 0, !dbg !2636 %0 = mul i64 %indvar4, 4, !dbg !2637 %1 = add i64 %0, 3, !dbg !2638 %2 = add i64 %0, 2, !dbg !2639 %3 = add i64 %0, 1, !dbg !2640 %4 = load ptr, ptr %b, align 8, !dbg !26, !tbaa !2841 %arrayidx = getelementptr ptr, ptr %4, i64 %0, !dbg !2642 store ptr null, ptr %arrayidx, align 8, !dbg !26, !tbaa !3343 %5 = load ptr, ptr %b, align 8, !dbg !26, !tbaa !2844 %arrayidx.1 = getelementptr ptr, ptr %5, i64 %3, !dbg !2645 store ptr null, ptr %arrayidx.1, align 8, !dbg !26, !tbaa !3346 %6 = load ptr, ptr %b, align 8, !dbg !26, !tbaa !2847 %arrayidx.2 = getelementptr ptr, ptr %6, i64 %2, !dbg !2648 store ptr null, ptr %arrayidx.2, align 8, !dbg !26, !tbaa !3349 %7 = load ptr, ptr %b, align 8, !dbg !26, !tbaa !2850 %arrayidx.3 = getelementptr ptr, ptr %7, i64 %1, !dbg !2651 store ptr null, ptr %arrayidx.3, align 8, !dbg !26, !tbaa !3352 %indvar.next = add i64 %indvar4, 1, !dbg !2753 %exitcond = icmp eq i64 %indvar.next, 8, !dbg !2754 br i1 %exitcond, label %for.end, label %for.body, !dbg !2755 56for.end: ; preds = %for.body57 ret void, !dbg !3458}59 60declare void @llvm.dbg.value(metadata, i64, metadata, metadata)61 62!llvm.dbg.cu = !{!0}63!llvm.module.flags = !{!20, !21}64!llvm.ident = !{!22}65 66!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)67!1 = !DIFile(filename: "ReportVariantBasePtr01.c", directory: "test/ScopDetectionDiagnostics")68!2 = !{}69!4 = distinct !DISubprogram(name: "a", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 5, file: !1, scope: !5, type: !6, retainedNodes: !15)70!5 = !DIFile(filename: "ReportVariantBasePtr01.c", directory: "test/ScopDetectionDiagnostics")71!6 = !DISubroutineType(types: !7)72!7 = !{null, !8}73!8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !9)74!9 = !DICompositeType(tag: DW_TAG_structure_type, name: "b", line: 1, size: 64, align: 64, file: !1, elements: !10)75!10 = !{!11}76!11 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 2, size: 64, align: 64, file: !1, scope: !9, baseType: !12)77!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !13)78!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !14)79!14 = !DIBasicType(tag: DW_TAG_base_type, name: "double", size: 64, align: 64, encoding: DW_ATE_float)80!15 = !{!16, !17}81!16 = !DILocalVariable(name: "A", line: 5, arg: 1, scope: !4, file: !5, type: !8)82!17 = !DILocalVariable(name: "i", line: 6, scope: !18, file: !5, type: !19)83!18 = distinct !DILexicalBlock(line: 6, column: 3, file: !1, scope: !4)84!19 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)85!20 = !{i32 2, !"Dwarf Version", i32 4}86!21 = !{i32 2, !"Debug Info Version", i32 3}87!22 = !{!"clang version 3.5.0 "}88!23 = !DILocation(line: 5, column: 18, scope: !4)89!24 = !{i32 0}90!25 = !DILocation(line: 6, column: 12, scope: !18)91!26 = !DILocation(line: 7, column: 5, scope: !18)92!27 = !DILocation(line: 6, column: 8, scope: !18)93!28 = !{!29, !30, i64 0}94!29 = !{!"b", !30, i64 0}95!30 = !{!"any pointer", !31, i64 0}96!31 = !{!"omnipotent char", !32, i64 0}97!32 = !{!"Simple C/C++ TBAA"}98!33 = !{!30, !30, i64 0}99!34 = !DILocation(line: 8, column: 1, scope: !4)100