brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.2 KiB · 6e7e403 Raw
177 lines · plain
1; RUN: opt < %s -disable-output "-passes=print<ddg>" 2>&1 | FileCheck %s2 3; CHECK-LABEL: 'DDG' for loop 'test1.for.body':4 5; CHECK: Node Address:[[PI:0x[0-9a-f]*]]:pi-block6; CHECK-NEXT: --- start of nodes in pi-block ---7; CHECK: Node Address:[[N1:0x[0-9a-f]*]]:single-instruction8; CHECK-NEXT: Instructions:9; CHECK-NEXT:    %i.02 = phi i64 [ %inc, %test1.for.body ], [ 0, %test1.for.body.preheader ]10; CHECK-NEXT: Edges:11; CHECK-NEXT:  [def-use] to [[N2:0x[0-9a-f]*]]12 13; CHECK: Node Address:[[N2]]:single-instruction14; CHECK-NEXT: Instructions:15; CHECK-NEXT:    %inc = add i64 %i.02, 116; CHECK-NEXT: Edges:17; CHECK-NEXT:  [def-use] to [[N1]]18; CHECK-NEXT: --- end of nodes in pi-block ---19; CHECK-NEXT: Edges:20; CHECK-NEXT:  [def-use] to [[N3:0x[0-9a-f]*]]21; CHECK-NEXT:  [def-use] to [[N4:0x[0-9a-f]*]]22; CHECK-NEXT:  [def-use] to [[N5:0x[0-9a-f]*]]23 24; CHECK: Node Address:[[N5]]:multi-instruction25; CHECK-NEXT: Instructions:26; CHECK-NEXT:    %exitcond = icmp ne i64 %inc, %n27; CHECK-NEXT:    br i1 %exitcond, label %test1.for.body, label %for.end.loopexit28; CHECK-NEXT: Edges:none!29 30; CHECK: Node Address:[[N4]]:single-instruction31; CHECK-NEXT: Instructions:32; CHECK-NEXT:    %arrayidx1 = getelementptr inbounds float, ptr %a, i64 %i.0233; CHECK-NEXT: Edges:34; CHECK-NEXT:  [def-use] to [[N6:0x[0-9a-f]*]]35 36; CHECK: Node Address:[[N3]]:multi-instruction37; CHECK-NEXT: Instructions:38; CHECK-NEXT:    %arrayidx = getelementptr inbounds float, ptr %b, i64 %i.0239; CHECK-NEXT:    %0 = load float, ptr %arrayidx, align 440; CHECK-NEXT: Edges:41; CHECK-NEXT:  [def-use] to [[N7:0x[0-9a-f]*]]42 43; CHECK: Node Address:[[N8:0x[0-9a-f]*]]:single-instruction44; CHECK-NEXT: Instructions:45; CHECK-NEXT:    %conv = uitofp i64 %n to float46; CHECK-NEXT: Edges:47; CHECK-NEXT:  [def-use] to [[N7]]48 49; CHECK: Node Address:[[N7]]:single-instruction50; CHECK-NEXT: Instructions:51; CHECK-NEXT:    %add = fadd float %0, %conv52; CHECK-NEXT: Edges:53; CHECK-NEXT:  [def-use] to [[N6]]54 55; CHECK: Node Address:[[N6]]:single-instruction56; CHECK-NEXT: Instructions:57; CHECK-NEXT:    store float %add, ptr %arrayidx1, align 458; CHECK-NEXT: Edges:none!59 60 61;; No memory dependencies.62;; void test1(unsigned long n, ptr restrict a, ptr restrict b) {63;;  for (unsigned long i = 0; i < n; i++)64;;    a[i] = b[i] + n;65;; }66 67define void @test1(i64 %n, ptr noalias %a, ptr noalias %b) {68entry:69  %exitcond1 = icmp ne i64 0, %n70  br i1 %exitcond1, label %test1.for.body, label %for.end71 72test1.for.body:                                         ; preds = %entry, %test1.for.body73  %i.02 = phi i64 [ %inc, %test1.for.body ], [ 0, %entry ]74  %arrayidx = getelementptr inbounds float, ptr %b, i64 %i.0275  %0 = load float, ptr %arrayidx, align 476  %conv = uitofp i64 %n to float77  %add = fadd float %0, %conv78  %arrayidx1 = getelementptr inbounds float, ptr %a, i64 %i.0279  store float %add, ptr %arrayidx1, align 480  %inc = add i64 %i.02, 181  %exitcond = icmp ne i64 %inc, %n82  br i1 %exitcond, label %test1.for.body, label %for.end83 84for.end:                                          ; preds = %test1.for.body, %entry85  ret void86}87 88 89; CHECK-LABEL: 'DDG' for loop 'test2.for.body':90 91; CHECK: Node Address:[[PI:0x[0-9a-f]*]]:pi-block92; CHECK-NEXT: --- start of nodes in pi-block ---93; CHECK: Node Address:[[N1:0x[0-9a-f]*]]:single-instruction94; CHECK-NEXT: Instructions:95; CHECK-NEXT:    %i.02 = phi i64 [ %inc, %test2.for.body ], [ 0, %test2.for.body.preheader ]96; CHECK-NEXT: Edges:97; CHECK-NEXT:  [def-use] to [[N2:0x[0-9a-f]*]]98 99; CHECK: Node Address:[[N2]]:single-instruction100; CHECK-NEXT: Instructions:101; CHECK-NEXT:    %inc = add i64 %i.02, 1102; CHECK-NEXT: Edges:103; CHECK-NEXT:  [def-use] to [[N1]]104; CHECK-NEXT: --- end of nodes in pi-block ---105; CHECK-NEXT: Edges:106; CHECK-NEXT:  [def-use] to [[N3:0x[0-9a-f]*]]107; CHECK-NEXT:  [def-use] to [[N4:0x[0-9a-f]*]]108; CHECK-NEXT:  [def-use] to [[N5:0x[0-9a-f]*]]109; CHECK-NEXT:  [def-use] to [[N6:0x[0-9a-f]*]]110 111; CHECK: Node Address:[[N6]]:multi-instruction112; CHECK-NEXT: Instructions:113; CHECK-NEXT:    %exitcond = icmp ne i64 %inc, %n114; CHECK-NEXT:    br i1 %exitcond, label %test2.for.body, label %for.end.loopexit115; CHECK-NEXT: Edges:none!116 117; CHECK: Node Address:[[N5]]:single-instruction118; CHECK-NEXT: Instructions:119; CHECK-NEXT:    %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %i.02120; CHECK-NEXT: Edges:121; CHECK-NEXT:  [def-use] to [[N7:0x[0-9a-f]*]]122 123; CHECK: Node Address:[[N4]]:multi-instruction124; CHECK-NEXT: Instructions:125; CHECK-NEXT:    %arrayidx1 = getelementptr inbounds float, ptr %a, i64 %i.02126; CHECK-NEXT:    %1 = load float, ptr %arrayidx1, align 4127; CHECK-NEXT: Edges:128; CHECK-NEXT:  [def-use] to [[N8:0x[0-9a-f]*]]129; CHECK-NEXT:  [memory] to [[N7]]130 131; CHECK: Node Address:[[N3]]:multi-instruction132; CHECK-NEXT: Instructions:133; CHECK-NEXT:    %arrayidx = getelementptr inbounds float, ptr %b, i64 %i.02134; CHECK-NEXT:    %0 = load float, ptr %arrayidx, align 4135; CHECK-NEXT: Edges:136; CHECK-NEXT:  [def-use] to [[N8]]137 138; CHECK: Node Address:[[N8]]:single-instruction139; CHECK-NEXT: Instructions:140; CHECK-NEXT:    %add = fadd float %0, %1141; CHECK-NEXT: Edges:142; CHECK-NEXT:  [def-use] to [[N7]]143 144; CHECK: Node Address:[[N7]]:single-instruction145; CHECK-NEXT: Instructions:146; CHECK-NEXT:    store float %add, ptr %arrayidx2, align 4147; CHECK-NEXT: Edges:none!148 149 150 151;; Loop-independent memory dependencies.152;; void test2(unsigned long n, ptr restrict a, ptr restrict b) {153;;  for (unsigned long i = 0; i < n; i++)154;;    a[i] = b[i] + a[i];155;; }156 157define void @test2(i64 %n, ptr noalias %a, ptr noalias %b) {158entry:159  %exitcond1 = icmp ne i64 0, %n160  br i1 %exitcond1, label %test2.for.body, label %for.end161 162test2.for.body:                                         ; preds = %entry, %test2.for.body163  %i.02 = phi i64 [ %inc, %test2.for.body ], [ 0, %entry ]164  %arrayidx = getelementptr inbounds float, ptr %b, i64 %i.02165  %0 = load float, ptr %arrayidx, align 4166  %arrayidx1 = getelementptr inbounds float, ptr %a, i64 %i.02167  %1 = load float, ptr %arrayidx1, align 4168  %add = fadd float %0, %1169  %arrayidx2 = getelementptr inbounds float, ptr %a, i64 %i.02170  store float %add, ptr %arrayidx2, align 4171  %inc = add i64 %i.02, 1172  %exitcond = icmp ne i64 %inc, %n173  br i1 %exitcond, label %test2.for.body, label %for.end174 175for.end:                                          ; preds = %test2.for.body, %entry176  ret void177}