xref: /llvm-project/polly/test/ScheduleOptimizer/ManualOptimization/distribute_illegal_looploc.ll (revision e1f056f692d869708c1898d9d65a69ac5584a0ed)
1; RUN: opt %loadNPMPolly -passes=polly-opt-isl -polly-reschedule=0 -polly-pragma-based-opts=1 -disable-output < %s 2>&1 | FileCheck %s --match-full-lines
2;
3; CHECK: warning: distribute_illegal.c:2:3: not applying loop fission/distribution: cannot ensure semantic equivalence due to possible dependency violations
4;
5; void foo(double *A,double *B) {
6;   for (int i = 1; i < 128; ++i) {
7;     A[i] = i;
8;     B[i] = A[i+1];
9;   }
10; }
11
12source_filename = "distribute_illegal.c"
13target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
14target triple = "x86_64-unknown-linux-gnu"
15
16define dso_local void @foo(ptr %A, ptr %B) #0 !dbg !7 {
17entry:
18  call void @llvm.dbg.value(metadata ptr %A, metadata !13, metadata !DIExpression()), !dbg !18
19  call void @llvm.dbg.value(metadata ptr %B, metadata !14, metadata !DIExpression()), !dbg !18
20  call void @llvm.dbg.value(metadata i32 1, metadata !15, metadata !DIExpression()), !dbg !19
21  br label %for.cond, !dbg !20
22
23for.cond:
24  %i.0 = phi i32 [ 1, %entry ], [ %inc, %for.body ], !dbg !19
25  call void @llvm.dbg.value(metadata i32 %i.0, metadata !15, metadata !DIExpression()), !dbg !19
26  %cmp = icmp slt i32 %i.0, 128, !dbg !21
27  br i1 %cmp, label %for.body, label %for.end, !dbg !23
28
29for.body:
30  %conv = sitofp i32 %i.0 to double, !dbg !24
31  %idxprom = sext i32 %i.0 to i64, !dbg !26
32  %arrayidx = getelementptr inbounds double, ptr %A, i64 %idxprom, !dbg !26
33  store double %conv, ptr %arrayidx, align 8, !dbg !27, !tbaa !28
34
35  %add = add nsw i32 %i.0, 1, !dbg !32
36  %idxprom1 = sext i32 %add to i64, !dbg !33
37  %arrayidx2 = getelementptr inbounds double, ptr %A, i64 %idxprom1, !dbg !33
38  %0 = load double, ptr %arrayidx2, align 8, !dbg !33, !tbaa !28
39  %idxprom3 = sext i32 %i.0 to i64, !dbg !34
40  %arrayidx4 = getelementptr inbounds double, ptr %B, i64 %idxprom3, !dbg !34
41  store double %0, ptr %arrayidx4, align 8, !dbg !35, !tbaa !28
42
43  %inc = add nsw i32 %i.0, 1, !dbg !36
44  call void @llvm.dbg.value(metadata i32 %inc, metadata !15, metadata !DIExpression()), !dbg !19
45  br label %for.cond, !dbg !37, !llvm.loop !38
46
47for.end:
48  ret void, !dbg !41
49}
50
51declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
52
53declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2
54
55declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2
56
57declare void @llvm.dbg.value(metadata, metadata, metadata) #1
58
59attributes #0 = { nounwind uwtable "frame-pointer"="none" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
60attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
61attributes #2 = { argmemonly nofree nosync nounwind willreturn }
62
63!llvm.dbg.cu = !{!0}
64!llvm.module.flags = !{!2, !3, !4, !5}
65!llvm.ident = !{!6}
66
67!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 14.0.0 (/home/meinersbur/src/llvm-project/clang 81189783049d2b93f653c121d3731fd1732a3916)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
68!1 = !DIFile(filename: "distribute_illegal.c", directory: "/path/to")
69!2 = !{i32 7, !"Dwarf Version", i32 4}
70!3 = !{i32 2, !"Debug Info Version", i32 3}
71!4 = !{i32 1, !"wchar_size", i32 4}
72!5 = !{i32 7, !"uwtable", i32 1}
73!6 = !{!"clang version 14.0.0 (/home/meinersbur/src/llvm-project/clang 81189783049d2b93f653c121d3731fd1732a3916)"}
74!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12)
75!8 = !DISubroutineType(types: !9)
76!9 = !{null, !10, !10}
77!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
78!11 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
79!12 = !{!13, !14, !15}
80!13 = !DILocalVariable(name: "A", arg: 1, scope: !7, file: !1, line: 1, type: !10)
81!14 = !DILocalVariable(name: "B", arg: 2, scope: !7, file: !1, line: 1, type: !10)
82!15 = !DILocalVariable(name: "i", scope: !16, file: !1, line: 2, type: !17)
83!16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 2, column: 3)
84!17 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
85!18 = !DILocation(line: 0, scope: !7)
86!19 = !DILocation(line: 0, scope: !16)
87!20 = !DILocation(line: 2, column: 8, scope: !16)
88!21 = !DILocation(line: 2, column: 21, scope: !22)
89!22 = distinct !DILexicalBlock(scope: !16, file: !1, line: 2, column: 3)
90!23 = !DILocation(line: 2, column: 3, scope: !16)
91!24 = !DILocation(line: 3, column: 12, scope: !25)
92!25 = distinct !DILexicalBlock(scope: !22, file: !1, line: 2, column: 33)
93!26 = !DILocation(line: 3, column: 5, scope: !25)
94!27 = !DILocation(line: 3, column: 10, scope: !25)
95!28 = !{!29, !29, i64 0}
96!29 = !{!"double", !30, i64 0}
97!30 = !{!"omnipotent char", !31, i64 0}
98!31 = !{!"Simple C/C++ TBAA"}
99!32 = !DILocation(line: 4, column: 15, scope: !25)
100!33 = !DILocation(line: 4, column: 12, scope: !25)
101!34 = !DILocation(line: 4, column: 5, scope: !25)
102!35 = !DILocation(line: 4, column: 10, scope: !25)
103!36 = !DILocation(line: 2, column: 28, scope: !22)
104!37 = !DILocation(line: 2, column: 3, scope: !22)
105!38 = distinct !{!38, !23, !39, !40, !100}
106!39 = !DILocation(line: 5, column: 3, scope: !16)
107!40 = !{!"llvm.loop.mustprogress"}
108!41 = !DILocation(line: 6, column: 1, scope: !7)
109!100 = !{!"llvm.loop.distribute.enable"}
110