Skip to content

Commit a464e38

Browse files
committed
[LV] Check debug location for more recipes in vplan-printing.ll.
Extend test to check printing of debug locations to cover a range of wide and replicating recipes. Currently those do not print the debug metadata.
1 parent be9e287 commit a464e38

File tree

1 file changed

+38
-16
lines changed

1 file changed

+38
-16
lines changed

llvm/test/Transforms/LoopVectorize/vplan-printing.ll

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ for.end:
329329
ret void
330330
}
331331

332-
define void @debug_loc_vpinstruction(ptr nocapture %asd, ptr nocapture %bsd) !dbg !5 {
333-
; CHECK-LABEL: Checking a loop in 'debug_loc_vpinstruction'
332+
define void @recipe_debug_loc_location(ptr nocapture %src) !dbg !5 {
333+
; CHECK-LABEL: Checking a loop in 'recipe_debug_loc_location'
334334
; CHECK: VPlan 'Initial VPlan for VF={4},UF>=1' {
335335
; CHECK-NEXT: Live-in vp<[[VF:%.]]> = VF
336336
; CHECK-NEXT: Live-in vp<[[VFxUF:%.]]> = VF * UF
@@ -347,14 +347,20 @@ define void @debug_loc_vpinstruction(ptr nocapture %asd, ptr nocapture %bsd) !db
347347
; CHECK-NEXT: vector.body:
348348
; CHECK-NEXT: EMIT vp<[[CAN_IV:%.+]]> = CANONICAL-INDUCTION ir<0>, vp<[[CAN_IV_NEXT:%.+]]>
349349
; CHECK-NEXT: vp<[[STEPS:%.+]]> = SCALAR-STEPS vp<[[CAN_IV]]>, ir<1>, vp<[[VF]]>
350-
; CHECK-NEXT: CLONE ir<%isd> = getelementptr inbounds ir<%asd>, vp<[[STEPS]]>
350+
; CHECK-NEXT: CLONE ir<%isd> = getelementptr inbounds ir<%src>, vp<[[STEPS]]>
351+
; CHECK-NOT: !dbg
351352
; CHECK-NEXT: vp<[[VEC_PTR:%.+]]> = vector-pointer ir<%isd>
353+
; CHECK-NOT: !dbg
352354
; CHECK-NEXT: WIDEN ir<%lsd> = load vp<[[VEC_PTR]]>
355+
; CHECK-NOT: !dbg
353356
; CHECK-NEXT: WIDEN ir<%psd> = add nuw nsw ir<%lsd>, ir<23>
357+
; CHECK-NOT: !dbg
354358
; CHECK-NEXT: WIDEN ir<%cmp1> = icmp slt ir<%lsd>, ir<100>
355-
; CHECK-NEXT: EMIT vp<[[NOT1:%.+]]> = not ir<%cmp1>, !dbg /tmp/s.c:5:3
359+
; CHECK-NOT: !dbg
360+
; CHECK-NEXT: EMIT vp<[[NOT1:%.+]]> = not ir<%cmp1>, !dbg /tmp/s.c:9:3
356361
; CHECK-NEXT: WIDEN ir<%cmp2> = icmp sge ir<%lsd>, ir<200>
357-
; CHECK-NEXT: EMIT vp<[[SEL1:%.+]]> = logical-and vp<[[NOT1]]>, ir<%cmp2>, !dbg /tmp/s.c:5:21
362+
; CHECK-NOT: !dbg
363+
; CHECK-NEXT: EMIT vp<[[SEL1:%.+]]> = logical-and vp<[[NOT1]]>, ir<%cmp2>, !dbg /tmp/s.c:11:3
358364
; CHECK-NEXT: EMIT vp<[[OR1:%.+]]> = or vp<[[SEL1]]>, ir<%cmp1>
359365
; CHECK-NEXT: Successor(s): pred.sdiv
360366
; CHECK-EMPTY:
@@ -365,18 +371,23 @@ define void @debug_loc_vpinstruction(ptr nocapture %asd, ptr nocapture %bsd) !db
365371
; CHECK-EMPTY:
366372
; CHECK-NEXT: pred.sdiv.if:
367373
; CHECK-NEXT: REPLICATE ir<%sd1> = sdiv ir<%psd>, ir<%lsd> (S->V)
374+
; CHECK-NOT: !dbg
368375
; CHECK-NEXT: Successor(s): pred.sdiv.continue
369376
; CHECK-EMPTY:
370377
; CHECK-NEXT: pred.sdiv.continue:
371378
; CHECK-NEXT: PHI-PREDICATED-INSTRUCTION vp<[[PHI:%.+]]> = ir<%sd1>
379+
; CHECK-NOT: !dbg
372380
; CHECK-NEXT: No successors
373381
; CHECK-NEXT: }
374382
; CHECK-NEXT: Successor(s): if.then.0
375383
; CHECK-EMPTY:
376384
; CHECK-NEXT: if.then.0:
377385
; CHECK-NEXT: BLEND ir<%ysd.0> = ir<%psd> vp<[[PHI]]>/vp<[[OR1]]>
386+
; CHECK-NOT: !dbg
378387
; CHECK-NEXT: vp<[[VEC_PTR2:%.+]]> = vector-pointer ir<%isd>
388+
; CHECK-NOT: !dbg
379389
; CHECK-NEXT: WIDEN store vp<[[VEC_PTR2]]>, ir<%ysd.0>
390+
; CHECK-NOT: !dbg
380391
; CHECK-NEXT: EMIT vp<[[CAN_IV_NEXT]]> = add nuw vp<[[CAN_IV]]>, vp<[[VFxUF]]>
381392
; CHECK-NEXT: EMIT branch-on-count vp<[[CAN_IV_NEXT]]>, vp<[[VTC]]>
382393
; CHECK-NEXT: No successors
@@ -406,23 +417,23 @@ entry:
406417

407418
loop:
408419
%iv = phi i64 [ 0, %entry ], [ %iv.next, %if.end ]
409-
%isd = getelementptr inbounds i32, ptr %asd, i64 %iv
410-
%lsd = load i32, ptr %isd, align 4
411-
%psd = add nuw nsw i32 %lsd, 23
412-
%cmp1 = icmp slt i32 %lsd, 100
413-
br i1 %cmp1, label %if.then, label %check, !dbg !7
420+
%isd = getelementptr inbounds i32, ptr %src, i64 %iv, !dbg !7
421+
%lsd = load i32, ptr %isd, align 4, !dbg !8
422+
%psd = add nuw nsw i32 %lsd, 23, !dbg !9
423+
%cmp1 = icmp slt i32 %lsd, 100, !dbg !10
424+
br i1 %cmp1, label %if.then, label %check, !dbg !11
414425

415426
check:
416-
%cmp2 = icmp sge i32 %lsd, 200
417-
br i1 %cmp2, label %if.then, label %if.end, !dbg !8
427+
%cmp2 = icmp sge i32 %lsd, 200, !dbg !12
428+
br i1 %cmp2, label %if.then, label %if.end, !dbg !13
418429

419430
if.then:
420-
%sd1 = sdiv i32 %psd, %lsd
431+
%sd1 = sdiv i32 %psd, %lsd, !dbg !14
421432
br label %if.end
422433

423434
if.end:
424-
%ysd.0 = phi i32 [ %sd1, %if.then ], [ %psd, %check ]
425-
store i32 %ysd.0, ptr %isd, align 4
435+
%ysd.0 = phi i32 [ %sd1, %if.then ], [ %psd, %check ], !dbg !16
436+
store i32 %ysd.0, ptr %isd, align 4, !dbg !17
426437
%iv.next = add nuw nsw i64 %iv, 1
427438
%exitcond = icmp eq i64 %iv.next, 128
428439
br i1 %exitcond, label %exit, label %loop
@@ -1078,4 +1089,15 @@ attributes #0 = { readonly nounwind "vector-function-abi-variant"="_ZGV_LLVM_M2v
10781089
!5 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !6, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
10791090
!6 = !DISubroutineType(types: !2)
10801091
!7 = !DILocation(line: 5, column: 3, scope: !5)
1081-
!8 = !DILocation(line: 5, column: 21, scope: !5)
1092+
!8 = !DILocation(line: 6, column: 3, scope: !5)
1093+
!9 = !DILocation(line: 7, column: 3, scope: !5)
1094+
!10 = !DILocation(line: 8, column: 3, scope: !5)
1095+
!11 = !DILocation(line: 9, column: 3, scope: !5)
1096+
!12 = !DILocation(line: 10, column: 3, scope: !5)
1097+
!13 = !DILocation(line: 11, column: 3, scope: !5)
1098+
!14 = !DILocation(line: 12, column: 3, scope: !5)
1099+
!15 = !DILocation(line: 13, column: 3, scope: !5)
1100+
!16 = !DILocation(line: 14, column: 3, scope: !5)
1101+
!17 = !DILocation(line: 15, column: 3, scope: !5)
1102+
!18 = !DILocation(line: 16, column: 3, scope: !5)
1103+
!19 = !DILocation(line: 17, column: 3, scope: !5)

0 commit comments

Comments
 (0)