Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,69 @@
; This test checks that we do not accidently mutate the debug info when
; inserting loop parallel metadata.
; RUN: opt %loadPolly < %s -S -polly -polly-codegen -polly-ast-detect-parallel | FileCheck %s
; CHECK-NOT: !7 = !{!7}
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
@A = common global i32* null, align 8
; Function Attrs: nounwind uwtable
define void @foo() !dbg !4 {
entry:
tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !9, metadata !19), !dbg !20
%0 = load i32*, i32** @A, align 8, !dbg !21, !tbaa !23
br label %for.body, !dbg !27
for.body: ; preds = %for.body, %entry
%indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
%arrayidx = getelementptr inbounds i32, i32* %0, i64 %indvars.iv, !dbg !21
%1 = load i32, i32* %arrayidx, align 4, !dbg !21, !tbaa !30
%add = add nsw i32 %1, 1, !dbg !21
store i32 %add, i32* %arrayidx, align 4, !dbg !21, !tbaa !30
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !27
%exitcond = icmp eq i64 %indvars.iv, 1, !dbg !27
br i1 %exitcond, label %for.end, label %for.body, !dbg !27
for.end: ; preds = %for.body
ret void, !dbg !32
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!15, !16}
!llvm.ident = !{!17}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, globals: !12, imports: !2)
!1 = !DIFile(filename: "t2.c", directory: "/local/mnt/workspace/build/tip-Release")
!2 = !{}
!4 = distinct !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: true, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, variables: !8)
!5 = !DIFile(filename: "t2.c", directory: "/local/mnt/workspace/build/tip-Release")
!6 = !DISubroutineType(types: !7)
!7 = !{null}
!8 = !{!9}
!9 = !DILocalVariable(name: "i", line: 4, scope: !10, file: !5, type: !11)
!10 = distinct !DILexicalBlock(line: 4, column: 3, file: !1, scope: !4)
!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!12 = !{!13}
!13 = !DIGlobalVariableExpression(var: !DIGlobalVariable(name: "A", line: 2, isLocal: false, isDefinition: true, scope: null, file: !5, type: !14), expr: !DIExpression())
!14 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !11)
!15 = !{i32 2, !"Dwarf Version", i32 4}
!16 = !{i32 2, !"Debug Info Version", i32 3}
!17 = !{!"clang version 3.6.0 "}
!18 = !{i32 0}
!19 = !DIExpression()
!20 = !DILocation(line: 4, column: 12, scope: !10)
!21 = !DILocation(line: 5, column: 5, scope: !22)
!22 = distinct !DILexicalBlock(line: 4, column: 3, file: !1, scope: !10)
!23 = !{!24, !24, i64 0}
!24 = !{!"any pointer", !25, i64 0}
!25 = !{!"omnipotent char", !26, i64 0}
!26 = !{!"Simple C/C++ TBAA"}
!27 = !DILocation(line: 4, column: 3, scope: !28)
!28 = !DILexicalBlockFile(discriminator: 2, file: !1, scope: !29)
!29 = !DILexicalBlockFile(discriminator: 1, file: !1, scope: !22)
!30 = !{!31, !31, i64 0}
!31 = !{!"int", !25, i64 0}
!32 = !DILocation(line: 6, column: 1, scope: !4)

View File

@@ -0,0 +1,64 @@
; RUN: opt %loadPolly -polly-codegen -polly-ast-detect-parallel -S < %s | FileCheck %s
;
; Check that we mark multiple parallel loops correctly including the memory instructions.
;
; CHECK-DAG: %polly.loop_cond[[COuter:[0-9]*]] = icmp sle i64 %polly.indvar_next{{[0-9]*}}, 1023
; CHECK-DAG: br i1 %polly.loop_cond[[COuter]], label %polly.loop_header{{[0-9]*}}, label %polly.loop_exit{{[0-9]*}}, !llvm.loop ![[IDOuter:[0-9]*]]
;
; CHECK-DAG: %polly.loop_cond[[CInner:[0-9]*]] = icmp sle i64 %polly.indvar_next{{[0-9]*}}, 511
; CHECK-DAG: br i1 %polly.loop_cond[[CInner]], label %polly.loop_header{{[0-9]*}}, label %polly.loop_exit{{[0-9]*}}, !llvm.loop ![[IDInner:[0-9]*]]
;
; CHECK-DAG: store i32 %{{[a-z_0-9]*}}, i32* %{{[a-z_0-9]*}}, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access !4
;
; CHECK-DAG: ![[IDOuter]] = distinct !{![[IDOuter]]}
; CHECK-DAG: ![[IDInner]] = distinct !{![[IDInner]]}
; CHECK-DAG: !4 = !{![[IDOuter]], ![[IDInner]]}
;
; void jd(int *A) {
; for (int i = 0; i < 1024; i++)
; for (int j = 0; j < 512; j++)
; A[i * 512 + j] = i + j;
; }
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
define void @jd(i32* %A) {
entry:
br label %for.cond
for.cond: ; preds = %for.inc5, %entry
%indvars.iv3 = phi i64 [ %indvars.iv.next4, %for.inc5 ], [ 0, %entry ]
%exitcond6 = icmp ne i64 %indvars.iv3, 1024
br i1 %exitcond6, label %for.body, label %for.end7
for.body: ; preds = %for.cond
br label %for.cond1
for.cond1: ; preds = %for.inc, %for.body
%indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %for.body ]
%exitcond = icmp ne i64 %indvars.iv, 512
br i1 %exitcond, label %for.body3, label %for.end
for.body3: ; preds = %for.cond1
%tmp = add nsw i64 %indvars.iv3, %indvars.iv
%tmp7 = shl nsw i64 %indvars.iv3, 9
%tmp8 = add nsw i64 %tmp7, %indvars.iv
%arrayidx = getelementptr inbounds i32, i32* %A, i64 %tmp8
%tmp9 = trunc i64 %tmp to i32
store i32 %tmp9, i32* %arrayidx, align 4
br label %for.inc
for.inc: ; preds = %for.body3
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
br label %for.cond1
for.end: ; preds = %for.cond1
br label %for.inc5
for.inc5: ; preds = %for.end
%indvars.iv.next4 = add nuw nsw i64 %indvars.iv3, 1
br label %for.cond
for.end7: ; preds = %for.cond
ret void
}

View File

@@ -0,0 +1,86 @@
; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s -check-prefix=SEQUENTIAL
; RUN: opt %loadPolly -polly-codegen -polly-ast-detect-parallel -S < %s | FileCheck %s -check-prefix=PARALLEL
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
; This is a trivially parallel loop. We just use it to ensure that we actually
; emit the right information.
;
; for (i = 0; i < n; i++)
; A[i] = 1;
;
@A = common global [1024 x i32] zeroinitializer
define void @test-one(i64 %n) {
start:
fence seq_cst
br label %loop.header
loop.header:
%i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
%exitcond = icmp ne i64 %i, %n
br i1 %exitcond, label %loop.body, label %ret
loop.body:
%scevgep = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %i
store i32 1, i32* %scevgep
br label %loop.backedge
loop.backedge:
%i.next = add nsw i64 %i, 1
br label %loop.header
ret:
fence seq_cst
ret void
}
; SEQUENTIAL: @test-one
; SEQUENTIAL-NOT: !llvm.mem.parallel_loop_access
; SEQUENTIAL-NOT: !llvm.loop
; PARALLEL: @test-one
; PARALLEL: store i32 1, i32* %scevgep1, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access ![[LoopID:[0-9]*]]
; PARALLEL: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit, !llvm.loop ![[LoopID]]
; This loop has memory dependences that require at least a simple dependence
; analysis to detect the parallelism.
;
; for (i = 0; i < n; i++)
; A[2 * i] = A[2 * i + 1];
;
define void @test-two(i64 %n) {
start:
fence seq_cst
br label %loop.header
loop.header:
%i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
%exitcond = icmp ne i64 %i, %n
br i1 %exitcond, label %loop.body, label %ret
loop.body:
%loadoffset1 = mul nsw i64 %i, 2
%loadoffset2 = add nsw i64 %loadoffset1, 1
%scevgepload = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %loadoffset2
%val = load i32, i32* %scevgepload
%storeoffset = mul i64 %i, 2
%scevgepstore = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %storeoffset
store i32 %val, i32* %scevgepstore
br label %loop.backedge
loop.backedge:
%i.next = add nsw i64 %i, 1
br label %loop.header
ret:
fence seq_cst
ret void
}
; SEQUENTIAL: @test-two
; SEQUENTIAL-NOT: !llvm.mem.parallel_loop_access
; SEQUENTIAL-NOT: !llvm.loop
; PARALLEL: @test-two
; PARALLEL: %val_p_scalar_ = load i32, i32* %scevgep, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access ![[LoopID:[0-9]*]]
; PARALLEL: store i32 %val_p_scalar_, i32* %scevgep1, {{[ ._!,a-zA-Z0-9]*}}, !llvm.mem.parallel_loop_access ![[LoopID]]
; PARALLEL: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit, !llvm.loop ![[LoopID]]