[llvm] [LV] Skipping all debug instructions when native vplan is enabled (PR #77413)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 15 05:54:30 PST 2024


https://github.com/Mel-Chen updated https://github.com/llvm/llvm-project/pull/77413

>From 828d2aaa0195ef0d1b4ee95627cb295d908f2883 Mon Sep 17 00:00:00 2001
From: Mel Chen <mel.chen at sifive.com>
Date: Sun, 7 Jan 2024 23:41:42 -0800
Subject: [PATCH 1/4] init test case

---
 .../LoopVectorize/dbg-outer-loop-vect.ll      | 91 +++++++++++++++++++
 1 file changed, 91 insertions(+)
 create mode 100644 llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll

diff --git a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
new file mode 100644
index 00000000000000..65ad34c52bd999
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
@@ -0,0 +1,91 @@
+; RUN: opt < %s -S -passes=loop-vectorize -enable-vplan-native-path -force-vector-interleave=1 -force-vector-width=4 | FileCheck %s
+
+target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
+
+define void @foo(ptr %h) !dbg !4 {
+entry:
+  call void @llvm.dbg.value(metadata ptr %h, metadata !10, metadata !DIExpression()), !dbg !20
+  call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression()), !dbg !21
+  br label %for.cond1.preheader, !dbg !22
+
+for.cond1.preheader:                              ; preds = %entry, %for.cond.cleanup3
+  %i.023 = phi i64 [ 0, %entry ], [ %inc13, %for.cond.cleanup3 ]
+  call void @llvm.dbg.value(metadata i64 %i.023, metadata !11, metadata !DIExpression()), !dbg !21
+  call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !DIExpression()), !dbg !23
+  br label %for.cond5.preheader, !dbg !24
+
+for.cond5.preheader:                              ; preds = %for.cond1.preheader, %for.cond5.preheader
+  %l.022 = phi i64 [ 0, %for.cond1.preheader ], [ %inc10, %for.cond5.preheader ]
+  call void @llvm.dbg.value(metadata i64 %l.022, metadata !14, metadata !DIExpression()), !dbg !23
+  %0 = getelementptr i32, ptr %h, i64 %l.022
+  call void @llvm.dbg.value(metadata i64 0, metadata !17, metadata !DIExpression()), !dbg !26
+  store i32 0, ptr %0, align 4, !dbg !27
+  call void @llvm.dbg.value(metadata i64 1, metadata !17, metadata !DIExpression()), !dbg !26
+  %arrayidx.1 = getelementptr i32, ptr %0, i64 1, !dbg !29
+  store i32 1, ptr %arrayidx.1, align 4, !dbg !27
+  call void @llvm.dbg.value(metadata i64 2, metadata !17, metadata !DIExpression()), !dbg !26
+  %arrayidx.2 = getelementptr i32, ptr %0, i64 2, !dbg !29
+  store i32 2, ptr %arrayidx.2, align 4, !dbg !27
+  call void @llvm.dbg.value(metadata i64 3, metadata !17, metadata !DIExpression()), !dbg !26
+  %arrayidx.3 = getelementptr i32, ptr %0, i64 3, !dbg !29
+  store i32 3, ptr %arrayidx.3, align 4, !dbg !27
+  call void @llvm.dbg.value(metadata i64 4, metadata !17, metadata !DIExpression()), !dbg !26
+  %inc10 = add nuw nsw i64 %l.022, 1, !dbg !30
+  call void @llvm.dbg.value(metadata i64 %inc10, metadata !14, metadata !DIExpression()), !dbg !23
+  %exitcond.not = icmp eq i64 %inc10, 5, !dbg !31
+  br i1 %exitcond.not, label %for.cond.cleanup3, label %for.cond5.preheader, !dbg !24, !llvm.loop !32
+
+for.cond.cleanup3:                                ; preds = %for.cond5.preheader
+  %inc13 = add nuw nsw i64 %i.023, 1, !dbg !34
+  call void @llvm.dbg.value(metadata i64 %inc13, metadata !11, metadata !DIExpression()), !dbg !21
+  %exitcond24.not = icmp eq i64 %inc13, 23, !dbg !35
+  br i1 %exitcond24.not, label %exit, label %for.cond1.preheader, !dbg !22, !llvm.loop !36
+
+exit:                                 ; preds = %for.cond.cleanup3
+  ret void, !dbg !25
+}
+
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+!1 = !DIFile(filename: "outer-loop-vect.c", directory: "/test/file/path")
+!2 = !{i32 2, !"Debug Info Version", i32 3}
+!3 = !{i32 7, !"debug-info-assignment-tracking", i1 true}
+!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 8, type: !5, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !9)
+!5 = !DISubroutineType(types: !6)
+!6 = !{null, !7}
+!7 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !8, size: 64)
+!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!9 = !{!10, !11, !14, !17}
+!10 = !DILocalVariable(name: "h", arg: 1, scope: !4, file: !1, line: 8, type: !7)
+!11 = !DILocalVariable(name: "i", scope: !12, file: !1, line: 10, type: !13)
+!12 = distinct !DILexicalBlock(scope: !4, file: !1, line: 10, column: 3)
+!13 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)
+!14 = !DILocalVariable(name: "l", scope: !15, file: !1, line: 11, type: !13)
+!15 = distinct !DILexicalBlock(scope: !16, file: !1, line: 11, column: 5)
+!16 = distinct !DILexicalBlock(scope: !12, file: !1, line: 10, column: 3)
+!17 = !DILocalVariable(name: "j", scope: !18, file: !1, line: 12, type: !13)
+!18 = distinct !DILexicalBlock(scope: !19, file: !1, line: 12, column: 7)
+!19 = distinct !DILexicalBlock(scope: !15, file: !1, line: 11, column: 5)
+!20 = !DILocation(line: 0, scope: !4)
+!21 = !DILocation(line: 0, scope: !12)
+!22 = !DILocation(line: 10, column: 3, scope: !12)
+!23 = !DILocation(line: 0, scope: !15)
+!24 = !DILocation(line: 11, column: 5, scope: !15)
+!25 = !DILocation(line: 14, column: 1, scope: !4)
+!26 = !DILocation(line: 0, scope: !18)
+!27 = !DILocation(line: 13, column: 11, scope: !28)
+!28 = distinct !DILexicalBlock(scope: !18, file: !1, line: 12, column: 7)
+!29 = !DILocation(line: 13, column: 2, scope: !28)
+!30 = !DILocation(line: 11, column: 32, scope: !19)
+!31 = !DILocation(line: 11, column: 26, scope: !19)
+!32 = distinct !{!32, !24, !33}
+!33 = !DILocation(line: 13, column: 13, scope: !15)
+!34 = !DILocation(line: 10, column: 30, scope: !16)
+!35 = !DILocation(line: 10, column: 24, scope: !16)
+!36 = distinct !{!36, !22, !37, !38}
+!37 = !DILocation(line: 13, column: 13, scope: !12)
+!38 = !{!"llvm.loop.vectorize.enable", i1 true}

>From 025ea286922a40af72cb5ff97ee05962fddcba17 Mon Sep 17 00:00:00 2001
From: Mel Chen <mel.chen at sifive.com>
Date: Mon, 8 Jan 2024 05:50:14 -0800
Subject: [PATCH 2/4] fix native vplan

---
 .../Transforms/Vectorize/VPlanHCFGBuilder.cpp |   2 +-
 .../LoopVectorize/dbg-outer-loop-vect.ll      | 113 ++++++++++++++++++
 2 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
index f950d4740e413c..94456bf858d9c5 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanHCFGBuilder.cpp
@@ -283,7 +283,7 @@ VPValue *PlainCFGBuilder::getOrCreateVPOperand(Value *IRVal) {
 void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
                                                   BasicBlock *BB) {
   VPIRBuilder.setInsertPoint(VPBB);
-  for (Instruction &InstRef : *BB) {
+  for (Instruction &InstRef : BB->instructionsWithoutDebug(false)) {
     Instruction *Inst = &InstRef;
 
     // There shouldn't be any VPValue for Inst at this point. Otherwise, we
diff --git a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
index 65ad34c52bd999..e55fec3c64bec5 100644
--- a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
+++ b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
@@ -1,8 +1,80 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
 ; RUN: opt < %s -S -passes=loop-vectorize -enable-vplan-native-path -force-vector-interleave=1 -force-vector-width=4 | FileCheck %s
 
 target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
 
 define void @foo(ptr %h) !dbg !4 {
+; CHECK-LABEL: define void @foo(
+; CHECK-SAME: ptr [[H:%.*]]) !dbg [[DBG4:![0-9]+]] {
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata ptr [[H]], metadata [[META10:![0-9]+]], metadata !DIExpression()), !dbg [[DBG20:![0-9]+]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META11:![0-9]+]], metadata !DIExpression()), !dbg [[DBG21:![0-9]+]]
+; CHECK-NEXT:    br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !dbg [[DBG22:![0-9]+]]
+; CHECK:       vector.ph:
+; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]], !dbg [[DBG22]]
+; CHECK:       vector.body:
+; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[FOR_COND_CLEANUP32:%.*]] ]
+; CHECK-NEXT:    [[VEC_IND:%.*]] = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[FOR_COND_CLEANUP32]] ]
+; CHECK-NEXT:    br label [[FOR_COND5_PREHEADER1:%.*]], !dbg [[DBG22]]
+; CHECK:       for.cond5.preheader1:
+; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x i64> [ zeroinitializer, [[VECTOR_BODY]] ], [ [[TMP4:%.*]], [[FOR_COND5_PREHEADER1]] ], !dbg [[DBG22]]
+; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i32, ptr [[H]], <4 x i64> [[VEC_PHI]], !dbg [[DBG22]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> zeroinitializer, <4 x ptr> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23:![0-9]+]]
+; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 1, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x ptr> [[TMP1]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23]]
+; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 2, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x ptr> [[TMP2]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23]]
+; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 3, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 3, i32 3, i32 3, i32 3>, <4 x ptr> [[TMP3]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23]]
+; CHECK-NEXT:    [[TMP4]] = add nuw nsw <4 x i64> [[VEC_PHI]], <i64 1, i64 1, i64 1, i64 1>, !dbg [[DBG25:![0-9]+]]
+; CHECK-NEXT:    [[TMP5:%.*]] = icmp eq <4 x i64> [[TMP4]], <i64 5, i64 5, i64 5, i64 5>, !dbg [[DBG26:![0-9]+]]
+; CHECK-NEXT:    [[TMP6:%.*]] = extractelement <4 x i1> [[TMP5]], i32 0
+; CHECK-NEXT:    br i1 [[TMP6]], label [[FOR_COND_CLEANUP32]], label [[FOR_COND5_PREHEADER1]]
+; CHECK:       for.cond.cleanup32:
+; CHECK-NEXT:    [[TMP7:%.*]] = add nuw nsw <4 x i64> [[VEC_IND]], <i64 1, i64 1, i64 1, i64 1>, !dbg [[DBG27:![0-9]+]]
+; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq <4 x i64> [[TMP7]], <i64 23, i64 23, i64 23, i64 23>, !dbg [[DBG28:![0-9]+]]
+; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
+; CHECK-NEXT:    [[VEC_IND_NEXT]] = add <4 x i64> [[VEC_IND]], <i64 4, i64 4, i64 4, i64 4>
+; CHECK-NEXT:    [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], 20
+; CHECK-NEXT:    br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP29:![0-9]+]]
+; CHECK:       middle.block:
+; CHECK-NEXT:    br i1 false, label [[EXIT:%.*]], label [[SCALAR_PH]], !dbg [[DBG22]]
+; CHECK:       scalar.ph:
+; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ 20, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
+; CHECK-NEXT:    br label [[FOR_COND1_PREHEADER:%.*]], !dbg [[DBG22]]
+; CHECK:       for.cond1.preheader:
+; CHECK-NEXT:    [[I_023:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC13:%.*]], [[FOR_COND_CLEANUP3:%.*]] ]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[I_023]], metadata [[META11]], metadata !DIExpression()), !dbg [[DBG21]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG33:![0-9]+]]
+; CHECK-NEXT:    br label [[FOR_COND5_PREHEADER:%.*]], !dbg [[DBG34:![0-9]+]]
+; CHECK:       for.cond5.preheader:
+; CHECK-NEXT:    [[L_022:%.*]] = phi i64 [ 0, [[FOR_COND1_PREHEADER]] ], [ [[INC10:%.*]], [[FOR_COND5_PREHEADER]] ]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[L_022]], metadata [[META14]], metadata !DIExpression()), !dbg [[DBG33]]
+; CHECK-NEXT:    [[TMP10:%.*]] = getelementptr i32, ptr [[H]], i64 [[L_022]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META17:![0-9]+]], metadata !DIExpression()), !dbg [[DBG35:![0-9]+]]
+; CHECK-NEXT:    store i32 0, ptr [[TMP10]], align 4, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 1, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
+; CHECK-NEXT:    [[ARRAYIDX_1:%.*]] = getelementptr i32, ptr [[TMP10]], i64 1, !dbg [[DBG36:![0-9]+]]
+; CHECK-NEXT:    store i32 1, ptr [[ARRAYIDX_1]], align 4, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 2, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
+; CHECK-NEXT:    [[ARRAYIDX_2:%.*]] = getelementptr i32, ptr [[TMP10]], i64 2, !dbg [[DBG36]]
+; CHECK-NEXT:    store i32 2, ptr [[ARRAYIDX_2]], align 4, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 3, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
+; CHECK-NEXT:    [[ARRAYIDX_3:%.*]] = getelementptr i32, ptr [[TMP10]], i64 3, !dbg [[DBG36]]
+; CHECK-NEXT:    store i32 3, ptr [[ARRAYIDX_3]], align 4, !dbg [[DBG23]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 4, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
+; CHECK-NEXT:    [[INC10]] = add nuw nsw i64 [[L_022]], 1, !dbg [[DBG25]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[INC10]], metadata [[META14]], metadata !DIExpression()), !dbg [[DBG33]]
+; CHECK-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INC10]], 5, !dbg [[DBG26]]
+; CHECK-NEXT:    br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP3]], label [[FOR_COND5_PREHEADER]], !dbg [[DBG34]], !llvm.loop [[LOOP37:![0-9]+]]
+; CHECK:       for.cond.cleanup3:
+; CHECK-NEXT:    [[INC13]] = add nuw nsw i64 [[I_023]], 1, !dbg [[DBG27]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[INC13]], metadata [[META11]], metadata !DIExpression()), !dbg [[DBG21]]
+; CHECK-NEXT:    [[EXITCOND24_NOT:%.*]] = icmp eq i64 [[INC13]], 23, !dbg [[DBG28]]
+; CHECK-NEXT:    br i1 [[EXITCOND24_NOT]], label [[EXIT]], label [[FOR_COND1_PREHEADER]], !dbg [[DBG22]], !llvm.loop [[LOOP39:![0-9]+]]
+; CHECK:       exit:
+; CHECK-NEXT:    ret void, !dbg [[DBG40:![0-9]+]]
+;
 entry:
   call void @llvm.dbg.value(metadata ptr %h, metadata !10, metadata !DIExpression()), !dbg !20
   call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression()), !dbg !21
@@ -89,3 +161,44 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
 !36 = distinct !{!36, !22, !37, !38}
 !37 = !DILocation(line: 13, column: 13, scope: !12)
 !38 = !{!"llvm.loop.vectorize.enable", i1 true}
+;.
+; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
+; CHECK: [[META1]] = !DIFile(filename: "outer-loop-vect.c", directory: {{.*}})
+; CHECK: [[DBG4]] = distinct !DISubprogram(name: "foo", scope: [[META1]], file: [[META1]], line: 8, type: [[META5:![0-9]+]], scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: [[META0]], retainedNodes: [[META9:![0-9]+]])
+; CHECK: [[META5]] = !DISubroutineType(types: [[META6:![0-9]+]])
+; CHECK: [[META6]] = !{null, [[META7:![0-9]+]]}
+; CHECK: [[META7]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META8:![0-9]+]], size: 64)
+; CHECK: [[META8]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+; CHECK: [[META9]] = !{[[META10]], [[META11]], [[META14]], [[META17]]}
+; CHECK: [[META10]] = !DILocalVariable(name: "h", arg: 1, scope: [[DBG4]], file: [[META1]], line: 8, type: [[META7]])
+; CHECK: [[META11]] = !DILocalVariable(name: "i", scope: [[META12:![0-9]+]], file: [[META1]], line: 10, type: [[META13:![0-9]+]])
+; CHECK: [[META12]] = distinct !DILexicalBlock(scope: [[DBG4]], file: [[META1]], line: 10, column: 3)
+; CHECK: [[META13]] = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)
+; CHECK: [[META14]] = !DILocalVariable(name: "l", scope: [[META15:![0-9]+]], file: [[META1]], line: 11, type: [[META13]])
+; CHECK: [[META15]] = distinct !DILexicalBlock(scope: [[META16:![0-9]+]], file: [[META1]], line: 11, column: 5)
+; CHECK: [[META16]] = distinct !DILexicalBlock(scope: [[META12]], file: [[META1]], line: 10, column: 3)
+; CHECK: [[META17]] = !DILocalVariable(name: "j", scope: [[META18:![0-9]+]], file: [[META1]], line: 12, type: [[META13]])
+; CHECK: [[META18]] = distinct !DILexicalBlock(scope: [[META19:![0-9]+]], file: [[META1]], line: 12, column: 7)
+; CHECK: [[META19]] = distinct !DILexicalBlock(scope: [[META15]], file: [[META1]], line: 11, column: 5)
+; CHECK: [[DBG20]] = !DILocation(line: 0, scope: [[DBG4]])
+; CHECK: [[DBG21]] = !DILocation(line: 0, scope: [[META12]])
+; CHECK: [[DBG22]] = !DILocation(line: 10, column: 3, scope: [[META12]])
+; CHECK: [[DBG23]] = !DILocation(line: 13, column: 11, scope: [[META24:![0-9]+]])
+; CHECK: [[META24]] = distinct !DILexicalBlock(scope: [[META18]], file: [[META1]], line: 12, column: 7)
+; CHECK: [[DBG25]] = !DILocation(line: 11, column: 32, scope: [[META19]])
+; CHECK: [[DBG26]] = !DILocation(line: 11, column: 26, scope: [[META19]])
+; CHECK: [[DBG27]] = !DILocation(line: 10, column: 30, scope: [[META16]])
+; CHECK: [[DBG28]] = !DILocation(line: 10, column: 24, scope: [[META16]])
+; CHECK: [[LOOP29]] = distinct !{[[LOOP29]], [[DBG22]], [[META30:![0-9]+]], [[META31:![0-9]+]], [[META32:![0-9]+]]}
+; CHECK: [[META30]] = !DILocation(line: 13, column: 13, scope: [[META12]])
+; CHECK: [[META31]] = !{!"llvm.loop.isvectorized", i32 1}
+; CHECK: [[META32]] = !{!"llvm.loop.unroll.runtime.disable"}
+; CHECK: [[DBG33]] = !DILocation(line: 0, scope: [[META15]])
+; CHECK: [[DBG34]] = !DILocation(line: 11, column: 5, scope: [[META15]])
+; CHECK: [[DBG35]] = !DILocation(line: 0, scope: [[META18]])
+; CHECK: [[DBG36]] = !DILocation(line: 13, column: 2, scope: [[META24]])
+; CHECK: [[LOOP37]] = distinct !{[[LOOP37]], [[DBG34]], [[META38:![0-9]+]]}
+; CHECK: [[META38]] = !DILocation(line: 13, column: 13, scope: [[META15]])
+; CHECK: [[LOOP39]] = distinct !{[[LOOP39]], [[DBG22]], [[META30]], [[META31]]}
+; CHECK: [[DBG40]] = !DILocation(line: 14, column: 1, scope: [[DBG4]])
+;.

>From 37fb4bc384151f455118b3f91b3e28cc2091f911 Mon Sep 17 00:00:00 2001
From: Mel Chen <mel.chen at sifive.com>
Date: Mon, 15 Jan 2024 05:33:52 -0800
Subject: [PATCH 3/4] Reduce metadata

---
 .../LoopVectorize/dbg-outer-loop-vect.ll      | 80 ++++++++-----------
 1 file changed, 33 insertions(+), 47 deletions(-)

diff --git a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
index e55fec3c64bec5..4ddb02fe11b764 100644
--- a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
+++ b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
@@ -76,45 +76,36 @@ define void @foo(ptr %h) !dbg !4 {
 ; CHECK-NEXT:    ret void, !dbg [[DBG40:![0-9]+]]
 ;
 entry:
-  call void @llvm.dbg.value(metadata ptr %h, metadata !10, metadata !DIExpression()), !dbg !20
-  call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression()), !dbg !21
-  br label %for.cond1.preheader, !dbg !22
+  call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression()), !dbg !20
+  br label %for.cond1.preheader, !dbg !21
 
 for.cond1.preheader:                              ; preds = %entry, %for.cond.cleanup3
   %i.023 = phi i64 [ 0, %entry ], [ %inc13, %for.cond.cleanup3 ]
-  call void @llvm.dbg.value(metadata i64 %i.023, metadata !11, metadata !DIExpression()), !dbg !21
-  call void @llvm.dbg.value(metadata i64 0, metadata !14, metadata !DIExpression()), !dbg !23
-  br label %for.cond5.preheader, !dbg !24
+  call void @llvm.dbg.value(metadata i64 %i.023, metadata !11, metadata !DIExpression()), !dbg !20
+  br label %for.cond5.preheader, !dbg !22
 
 for.cond5.preheader:                              ; preds = %for.cond1.preheader, %for.cond5.preheader
   %l.022 = phi i64 [ 0, %for.cond1.preheader ], [ %inc10, %for.cond5.preheader ]
-  call void @llvm.dbg.value(metadata i64 %l.022, metadata !14, metadata !DIExpression()), !dbg !23
   %0 = getelementptr i32, ptr %h, i64 %l.022
-  call void @llvm.dbg.value(metadata i64 0, metadata !17, metadata !DIExpression()), !dbg !26
-  store i32 0, ptr %0, align 4, !dbg !27
-  call void @llvm.dbg.value(metadata i64 1, metadata !17, metadata !DIExpression()), !dbg !26
-  %arrayidx.1 = getelementptr i32, ptr %0, i64 1, !dbg !29
-  store i32 1, ptr %arrayidx.1, align 4, !dbg !27
-  call void @llvm.dbg.value(metadata i64 2, metadata !17, metadata !DIExpression()), !dbg !26
-  %arrayidx.2 = getelementptr i32, ptr %0, i64 2, !dbg !29
-  store i32 2, ptr %arrayidx.2, align 4, !dbg !27
-  call void @llvm.dbg.value(metadata i64 3, metadata !17, metadata !DIExpression()), !dbg !26
-  %arrayidx.3 = getelementptr i32, ptr %0, i64 3, !dbg !29
-  store i32 3, ptr %arrayidx.3, align 4, !dbg !27
-  call void @llvm.dbg.value(metadata i64 4, metadata !17, metadata !DIExpression()), !dbg !26
-  %inc10 = add nuw nsw i64 %l.022, 1, !dbg !30
-  call void @llvm.dbg.value(metadata i64 %inc10, metadata !14, metadata !DIExpression()), !dbg !23
-  %exitcond.not = icmp eq i64 %inc10, 5, !dbg !31
-  br i1 %exitcond.not, label %for.cond.cleanup3, label %for.cond5.preheader, !dbg !24, !llvm.loop !32
+  store i32 0, ptr %0, align 4, !dbg !24
+  %arrayidx.1 = getelementptr i32, ptr %0, i64 1, !dbg !26
+  store i32 1, ptr %arrayidx.1, align 4, !dbg !24
+  %arrayidx.2 = getelementptr i32, ptr %0, i64 2, !dbg !26
+  store i32 2, ptr %arrayidx.2, align 4, !dbg !24
+  %arrayidx.3 = getelementptr i32, ptr %0, i64 3, !dbg !26
+  store i32 3, ptr %arrayidx.3, align 4, !dbg !24
+  %inc10 = add nuw nsw i64 %l.022, 1, !dbg !27
+  %exitcond.not = icmp eq i64 %inc10, 5, !dbg !28
+  br i1 %exitcond.not, label %for.cond.cleanup3, label %for.cond5.preheader, !dbg !22
 
 for.cond.cleanup3:                                ; preds = %for.cond5.preheader
-  %inc13 = add nuw nsw i64 %i.023, 1, !dbg !34
-  call void @llvm.dbg.value(metadata i64 %inc13, metadata !11, metadata !DIExpression()), !dbg !21
-  %exitcond24.not = icmp eq i64 %inc13, 23, !dbg !35
-  br i1 %exitcond24.not, label %exit, label %for.cond1.preheader, !dbg !22, !llvm.loop !36
+  %inc13 = add nuw nsw i64 %i.023, 1, !dbg !29
+  call void @llvm.dbg.value(metadata i64 %inc13, metadata !11, metadata !DIExpression()), !dbg !20
+  %exitcond24.not = icmp eq i64 %inc13, 23, !dbg !30
+  br i1 %exitcond24.not, label %exit, label %for.cond1.preheader, !dbg !21, !llvm.loop !31
 
 exit:                                 ; preds = %for.cond.cleanup3
-  ret void, !dbg !25
+  ret void, !dbg !23
 }
 
 declare void @llvm.dbg.value(metadata, metadata, metadata)
@@ -142,25 +133,20 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
 !17 = !DILocalVariable(name: "j", scope: !18, file: !1, line: 12, type: !13)
 !18 = distinct !DILexicalBlock(scope: !19, file: !1, line: 12, column: 7)
 !19 = distinct !DILexicalBlock(scope: !15, file: !1, line: 11, column: 5)
-!20 = !DILocation(line: 0, scope: !4)
-!21 = !DILocation(line: 0, scope: !12)
-!22 = !DILocation(line: 10, column: 3, scope: !12)
-!23 = !DILocation(line: 0, scope: !15)
-!24 = !DILocation(line: 11, column: 5, scope: !15)
-!25 = !DILocation(line: 14, column: 1, scope: !4)
-!26 = !DILocation(line: 0, scope: !18)
-!27 = !DILocation(line: 13, column: 11, scope: !28)
-!28 = distinct !DILexicalBlock(scope: !18, file: !1, line: 12, column: 7)
-!29 = !DILocation(line: 13, column: 2, scope: !28)
-!30 = !DILocation(line: 11, column: 32, scope: !19)
-!31 = !DILocation(line: 11, column: 26, scope: !19)
-!32 = distinct !{!32, !24, !33}
-!33 = !DILocation(line: 13, column: 13, scope: !15)
-!34 = !DILocation(line: 10, column: 30, scope: !16)
-!35 = !DILocation(line: 10, column: 24, scope: !16)
-!36 = distinct !{!36, !22, !37, !38}
-!37 = !DILocation(line: 13, column: 13, scope: !12)
-!38 = !{!"llvm.loop.vectorize.enable", i1 true}
+!20 = !DILocation(line: 0, scope: !12)
+!21 = !DILocation(line: 10, column: 3, scope: !12)
+!22 = !DILocation(line: 11, column: 5, scope: !15)
+!23 = !DILocation(line: 14, column: 1, scope: !4)
+!24 = !DILocation(line: 13, column: 11, scope: !25)
+!25 = distinct !DILexicalBlock(scope: !18, file: !1, line: 12, column: 7)
+!26 = !DILocation(line: 13, column: 2, scope: !25)
+!27 = !DILocation(line: 11, column: 32, scope: !19)
+!28 = !DILocation(line: 11, column: 26, scope: !19)
+!29 = !DILocation(line: 10, column: 30, scope: !16)
+!30 = !DILocation(line: 10, column: 24, scope: !16)
+!31 = distinct !{!31, !21, !32, !33}
+!32 = !DILocation(line: 13, column: 13, scope: !12)
+!33 = !{!"llvm.loop.vectorize.enable", i1 true}
 ;.
 ; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
 ; CHECK: [[META1]] = !DIFile(filename: "outer-loop-vect.c", directory: {{.*}})

>From f781ccb372e6acffb606fad8381db7e1969246bf Mon Sep 17 00:00:00 2001
From: Mel Chen <mel.chen at sifive.com>
Date: Mon, 15 Jan 2024 05:53:03 -0800
Subject: [PATCH 4/4] Update test case

---
 .../LoopVectorize/dbg-outer-loop-vect.ll      | 122 ++++++++----------
 1 file changed, 54 insertions(+), 68 deletions(-)

diff --git a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
index 4ddb02fe11b764..7f209634fe053d 100644
--- a/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
+++ b/llvm/test/Transforms/LoopVectorize/dbg-outer-loop-vect.ll
@@ -7,73 +7,64 @@ define void @foo(ptr %h) !dbg !4 {
 ; CHECK-LABEL: define void @foo(
 ; CHECK-SAME: ptr [[H:%.*]]) !dbg [[DBG4:![0-9]+]] {
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata ptr [[H]], metadata [[META10:![0-9]+]], metadata !DIExpression()), !dbg [[DBG20:![0-9]+]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META11:![0-9]+]], metadata !DIExpression()), !dbg [[DBG21:![0-9]+]]
-; CHECK-NEXT:    br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !dbg [[DBG22:![0-9]+]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META11:![0-9]+]], metadata !DIExpression()), !dbg [[DBG20:![0-9]+]]
+; CHECK-NEXT:    br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]], !dbg [[DBG21:![0-9]+]]
 ; CHECK:       vector.ph:
-; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]], !dbg [[DBG22]]
+; CHECK-NEXT:    br label [[VECTOR_BODY:%.*]], !dbg [[DBG21]]
 ; CHECK:       vector.body:
 ; CHECK-NEXT:    [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[FOR_COND_CLEANUP32:%.*]] ]
 ; CHECK-NEXT:    [[VEC_IND:%.*]] = phi <4 x i64> [ <i64 0, i64 1, i64 2, i64 3>, [[VECTOR_PH]] ], [ [[VEC_IND_NEXT:%.*]], [[FOR_COND_CLEANUP32]] ]
-; CHECK-NEXT:    br label [[FOR_COND5_PREHEADER1:%.*]], !dbg [[DBG22]]
+; CHECK-NEXT:    br label [[FOR_COND5_PREHEADER1:%.*]], !dbg [[DBG21]]
 ; CHECK:       for.cond5.preheader1:
-; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x i64> [ zeroinitializer, [[VECTOR_BODY]] ], [ [[TMP4:%.*]], [[FOR_COND5_PREHEADER1]] ], !dbg [[DBG22]]
-; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i32, ptr [[H]], <4 x i64> [[VEC_PHI]], !dbg [[DBG22]]
-; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> zeroinitializer, <4 x ptr> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23:![0-9]+]]
-; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 1, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x ptr> [[TMP1]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23]]
-; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 2, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x ptr> [[TMP2]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23]]
-; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 3, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 3, i32 3, i32 3, i32 3>, <4 x ptr> [[TMP3]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG23]]
-; CHECK-NEXT:    [[TMP4]] = add nuw nsw <4 x i64> [[VEC_PHI]], <i64 1, i64 1, i64 1, i64 1>, !dbg [[DBG25:![0-9]+]]
-; CHECK-NEXT:    [[TMP5:%.*]] = icmp eq <4 x i64> [[TMP4]], <i64 5, i64 5, i64 5, i64 5>, !dbg [[DBG26:![0-9]+]]
+; CHECK-NEXT:    [[VEC_PHI:%.*]] = phi <4 x i64> [ zeroinitializer, [[VECTOR_BODY]] ], [ [[TMP4:%.*]], [[FOR_COND5_PREHEADER1]] ], !dbg [[DBG21]]
+; CHECK-NEXT:    [[TMP0:%.*]] = getelementptr i32, ptr [[H]], <4 x i64> [[VEC_PHI]], !dbg [[DBG21]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> zeroinitializer, <4 x ptr> [[TMP0]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG22:![0-9]+]]
+; CHECK-NEXT:    [[TMP1:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 1, !dbg [[DBG22]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x ptr> [[TMP1]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG22]]
+; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 2, !dbg [[DBG22]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 2, i32 2, i32 2, i32 2>, <4 x ptr> [[TMP2]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG22]]
+; CHECK-NEXT:    [[TMP3:%.*]] = getelementptr i32, <4 x ptr> [[TMP0]], i64 3, !dbg [[DBG22]]
+; CHECK-NEXT:    call void @llvm.masked.scatter.v4i32.v4p0(<4 x i32> <i32 3, i32 3, i32 3, i32 3>, <4 x ptr> [[TMP3]], i32 4, <4 x i1> <i1 true, i1 true, i1 true, i1 true>), !dbg [[DBG22]]
+; CHECK-NEXT:    [[TMP4]] = add nuw nsw <4 x i64> [[VEC_PHI]], <i64 1, i64 1, i64 1, i64 1>, !dbg [[DBG24:![0-9]+]]
+; CHECK-NEXT:    [[TMP5:%.*]] = icmp eq <4 x i64> [[TMP4]], <i64 5, i64 5, i64 5, i64 5>, !dbg [[DBG25:![0-9]+]]
 ; CHECK-NEXT:    [[TMP6:%.*]] = extractelement <4 x i1> [[TMP5]], i32 0
 ; CHECK-NEXT:    br i1 [[TMP6]], label [[FOR_COND_CLEANUP32]], label [[FOR_COND5_PREHEADER1]]
 ; CHECK:       for.cond.cleanup32:
-; CHECK-NEXT:    [[TMP7:%.*]] = add nuw nsw <4 x i64> [[VEC_IND]], <i64 1, i64 1, i64 1, i64 1>, !dbg [[DBG27:![0-9]+]]
-; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq <4 x i64> [[TMP7]], <i64 23, i64 23, i64 23, i64 23>, !dbg [[DBG28:![0-9]+]]
+; CHECK-NEXT:    [[TMP7:%.*]] = add nuw nsw <4 x i64> [[VEC_IND]], <i64 1, i64 1, i64 1, i64 1>, !dbg [[DBG26:![0-9]+]]
+; CHECK-NEXT:    [[TMP8:%.*]] = icmp eq <4 x i64> [[TMP7]], <i64 23, i64 23, i64 23, i64 23>, !dbg [[DBG27:![0-9]+]]
 ; CHECK-NEXT:    [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
 ; CHECK-NEXT:    [[VEC_IND_NEXT]] = add <4 x i64> [[VEC_IND]], <i64 4, i64 4, i64 4, i64 4>
 ; CHECK-NEXT:    [[TMP9:%.*]] = icmp eq i64 [[INDEX_NEXT]], 20
-; CHECK-NEXT:    br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP29:![0-9]+]]
+; CHECK-NEXT:    br i1 [[TMP9]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP28:![0-9]+]]
 ; CHECK:       middle.block:
-; CHECK-NEXT:    br i1 false, label [[EXIT:%.*]], label [[SCALAR_PH]], !dbg [[DBG22]]
+; CHECK-NEXT:    br i1 false, label [[EXIT:%.*]], label [[SCALAR_PH]], !dbg [[DBG21]]
 ; CHECK:       scalar.ph:
 ; CHECK-NEXT:    [[BC_RESUME_VAL:%.*]] = phi i64 [ 20, [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY:%.*]] ]
-; CHECK-NEXT:    br label [[FOR_COND1_PREHEADER:%.*]], !dbg [[DBG22]]
+; CHECK-NEXT:    br label [[FOR_COND1_PREHEADER:%.*]], !dbg [[DBG21]]
 ; CHECK:       for.cond1.preheader:
 ; CHECK-NEXT:    [[I_023:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[INC13:%.*]], [[FOR_COND_CLEANUP3:%.*]] ]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[I_023]], metadata [[META11]], metadata !DIExpression()), !dbg [[DBG21]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META14:![0-9]+]], metadata !DIExpression()), !dbg [[DBG33:![0-9]+]]
-; CHECK-NEXT:    br label [[FOR_COND5_PREHEADER:%.*]], !dbg [[DBG34:![0-9]+]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[I_023]], metadata [[META11]], metadata !DIExpression()), !dbg [[DBG20]]
+; CHECK-NEXT:    br label [[FOR_COND5_PREHEADER:%.*]], !dbg [[DBG32:![0-9]+]]
 ; CHECK:       for.cond5.preheader:
 ; CHECK-NEXT:    [[L_022:%.*]] = phi i64 [ 0, [[FOR_COND1_PREHEADER]] ], [ [[INC10:%.*]], [[FOR_COND5_PREHEADER]] ]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[L_022]], metadata [[META14]], metadata !DIExpression()), !dbg [[DBG33]]
 ; CHECK-NEXT:    [[TMP10:%.*]] = getelementptr i32, ptr [[H]], i64 [[L_022]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 0, metadata [[META17:![0-9]+]], metadata !DIExpression()), !dbg [[DBG35:![0-9]+]]
-; CHECK-NEXT:    store i32 0, ptr [[TMP10]], align 4, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 1, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
-; CHECK-NEXT:    [[ARRAYIDX_1:%.*]] = getelementptr i32, ptr [[TMP10]], i64 1, !dbg [[DBG36:![0-9]+]]
-; CHECK-NEXT:    store i32 1, ptr [[ARRAYIDX_1]], align 4, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 2, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
-; CHECK-NEXT:    [[ARRAYIDX_2:%.*]] = getelementptr i32, ptr [[TMP10]], i64 2, !dbg [[DBG36]]
-; CHECK-NEXT:    store i32 2, ptr [[ARRAYIDX_2]], align 4, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 3, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
-; CHECK-NEXT:    [[ARRAYIDX_3:%.*]] = getelementptr i32, ptr [[TMP10]], i64 3, !dbg [[DBG36]]
-; CHECK-NEXT:    store i32 3, ptr [[ARRAYIDX_3]], align 4, !dbg [[DBG23]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 4, metadata [[META17]], metadata !DIExpression()), !dbg [[DBG35]]
-; CHECK-NEXT:    [[INC10]] = add nuw nsw i64 [[L_022]], 1, !dbg [[DBG25]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[INC10]], metadata [[META14]], metadata !DIExpression()), !dbg [[DBG33]]
-; CHECK-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INC10]], 5, !dbg [[DBG26]]
-; CHECK-NEXT:    br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP3]], label [[FOR_COND5_PREHEADER]], !dbg [[DBG34]], !llvm.loop [[LOOP37:![0-9]+]]
+; CHECK-NEXT:    store i32 0, ptr [[TMP10]], align 4, !dbg [[DBG22]]
+; CHECK-NEXT:    [[ARRAYIDX_1:%.*]] = getelementptr i32, ptr [[TMP10]], i64 1, !dbg [[DBG33:![0-9]+]]
+; CHECK-NEXT:    store i32 1, ptr [[ARRAYIDX_1]], align 4, !dbg [[DBG22]]
+; CHECK-NEXT:    [[ARRAYIDX_2:%.*]] = getelementptr i32, ptr [[TMP10]], i64 2, !dbg [[DBG33]]
+; CHECK-NEXT:    store i32 2, ptr [[ARRAYIDX_2]], align 4, !dbg [[DBG22]]
+; CHECK-NEXT:    [[ARRAYIDX_3:%.*]] = getelementptr i32, ptr [[TMP10]], i64 3, !dbg [[DBG33]]
+; CHECK-NEXT:    store i32 3, ptr [[ARRAYIDX_3]], align 4, !dbg [[DBG22]]
+; CHECK-NEXT:    [[INC10]] = add nuw nsw i64 [[L_022]], 1, !dbg [[DBG24]]
+; CHECK-NEXT:    [[EXITCOND_NOT:%.*]] = icmp eq i64 [[INC10]], 5, !dbg [[DBG25]]
+; CHECK-NEXT:    br i1 [[EXITCOND_NOT]], label [[FOR_COND_CLEANUP3]], label [[FOR_COND5_PREHEADER]], !dbg [[DBG32]]
 ; CHECK:       for.cond.cleanup3:
-; CHECK-NEXT:    [[INC13]] = add nuw nsw i64 [[I_023]], 1, !dbg [[DBG27]]
-; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[INC13]], metadata [[META11]], metadata !DIExpression()), !dbg [[DBG21]]
-; CHECK-NEXT:    [[EXITCOND24_NOT:%.*]] = icmp eq i64 [[INC13]], 23, !dbg [[DBG28]]
-; CHECK-NEXT:    br i1 [[EXITCOND24_NOT]], label [[EXIT]], label [[FOR_COND1_PREHEADER]], !dbg [[DBG22]], !llvm.loop [[LOOP39:![0-9]+]]
+; CHECK-NEXT:    [[INC13]] = add nuw nsw i64 [[I_023]], 1, !dbg [[DBG26]]
+; CHECK-NEXT:    call void @llvm.dbg.value(metadata i64 [[INC13]], metadata [[META11]], metadata !DIExpression()), !dbg [[DBG20]]
+; CHECK-NEXT:    [[EXITCOND24_NOT:%.*]] = icmp eq i64 [[INC13]], 23, !dbg [[DBG27]]
+; CHECK-NEXT:    br i1 [[EXITCOND24_NOT]], label [[EXIT]], label [[FOR_COND1_PREHEADER]], !dbg [[DBG21]], !llvm.loop [[LOOP34:![0-9]+]]
 ; CHECK:       exit:
-; CHECK-NEXT:    ret void, !dbg [[DBG40:![0-9]+]]
+; CHECK-NEXT:    ret void, !dbg [[DBG35:![0-9]+]]
 ;
 entry:
   call void @llvm.dbg.value(metadata i64 0, metadata !11, metadata !DIExpression()), !dbg !20
@@ -155,7 +146,7 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
 ; CHECK: [[META6]] = !{null, [[META7:![0-9]+]]}
 ; CHECK: [[META7]] = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: [[META8:![0-9]+]], size: 64)
 ; CHECK: [[META8]] = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
-; CHECK: [[META9]] = !{[[META10]], [[META11]], [[META14]], [[META17]]}
+; CHECK: [[META9]] = !{[[META10:![0-9]+]], [[META11]], [[META14:![0-9]+]], [[META17:![0-9]+]]}
 ; CHECK: [[META10]] = !DILocalVariable(name: "h", arg: 1, scope: [[DBG4]], file: [[META1]], line: 8, type: [[META7]])
 ; CHECK: [[META11]] = !DILocalVariable(name: "i", scope: [[META12:![0-9]+]], file: [[META1]], line: 10, type: [[META13:![0-9]+]])
 ; CHECK: [[META12]] = distinct !DILexicalBlock(scope: [[DBG4]], file: [[META1]], line: 10, column: 3)
@@ -166,25 +157,20 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
 ; CHECK: [[META17]] = !DILocalVariable(name: "j", scope: [[META18:![0-9]+]], file: [[META1]], line: 12, type: [[META13]])
 ; CHECK: [[META18]] = distinct !DILexicalBlock(scope: [[META19:![0-9]+]], file: [[META1]], line: 12, column: 7)
 ; CHECK: [[META19]] = distinct !DILexicalBlock(scope: [[META15]], file: [[META1]], line: 11, column: 5)
-; CHECK: [[DBG20]] = !DILocation(line: 0, scope: [[DBG4]])
-; CHECK: [[DBG21]] = !DILocation(line: 0, scope: [[META12]])
-; CHECK: [[DBG22]] = !DILocation(line: 10, column: 3, scope: [[META12]])
-; CHECK: [[DBG23]] = !DILocation(line: 13, column: 11, scope: [[META24:![0-9]+]])
-; CHECK: [[META24]] = distinct !DILexicalBlock(scope: [[META18]], file: [[META1]], line: 12, column: 7)
-; CHECK: [[DBG25]] = !DILocation(line: 11, column: 32, scope: [[META19]])
-; CHECK: [[DBG26]] = !DILocation(line: 11, column: 26, scope: [[META19]])
-; CHECK: [[DBG27]] = !DILocation(line: 10, column: 30, scope: [[META16]])
-; CHECK: [[DBG28]] = !DILocation(line: 10, column: 24, scope: [[META16]])
-; CHECK: [[LOOP29]] = distinct !{[[LOOP29]], [[DBG22]], [[META30:![0-9]+]], [[META31:![0-9]+]], [[META32:![0-9]+]]}
-; CHECK: [[META30]] = !DILocation(line: 13, column: 13, scope: [[META12]])
-; CHECK: [[META31]] = !{!"llvm.loop.isvectorized", i32 1}
-; CHECK: [[META32]] = !{!"llvm.loop.unroll.runtime.disable"}
-; CHECK: [[DBG33]] = !DILocation(line: 0, scope: [[META15]])
-; CHECK: [[DBG34]] = !DILocation(line: 11, column: 5, scope: [[META15]])
-; CHECK: [[DBG35]] = !DILocation(line: 0, scope: [[META18]])
-; CHECK: [[DBG36]] = !DILocation(line: 13, column: 2, scope: [[META24]])
-; CHECK: [[LOOP37]] = distinct !{[[LOOP37]], [[DBG34]], [[META38:![0-9]+]]}
-; CHECK: [[META38]] = !DILocation(line: 13, column: 13, scope: [[META15]])
-; CHECK: [[LOOP39]] = distinct !{[[LOOP39]], [[DBG22]], [[META30]], [[META31]]}
-; CHECK: [[DBG40]] = !DILocation(line: 14, column: 1, scope: [[DBG4]])
+; CHECK: [[DBG20]] = !DILocation(line: 0, scope: [[META12]])
+; CHECK: [[DBG21]] = !DILocation(line: 10, column: 3, scope: [[META12]])
+; CHECK: [[DBG22]] = !DILocation(line: 13, column: 11, scope: [[META23:![0-9]+]])
+; CHECK: [[META23]] = distinct !DILexicalBlock(scope: [[META18]], file: [[META1]], line: 12, column: 7)
+; CHECK: [[DBG24]] = !DILocation(line: 11, column: 32, scope: [[META19]])
+; CHECK: [[DBG25]] = !DILocation(line: 11, column: 26, scope: [[META19]])
+; CHECK: [[DBG26]] = !DILocation(line: 10, column: 30, scope: [[META16]])
+; CHECK: [[DBG27]] = !DILocation(line: 10, column: 24, scope: [[META16]])
+; CHECK: [[LOOP28]] = distinct !{[[LOOP28]], [[DBG21]], [[META29:![0-9]+]], [[META30:![0-9]+]], [[META31:![0-9]+]]}
+; CHECK: [[META29]] = !DILocation(line: 13, column: 13, scope: [[META12]])
+; CHECK: [[META30]] = !{!"llvm.loop.isvectorized", i32 1}
+; CHECK: [[META31]] = !{!"llvm.loop.unroll.runtime.disable"}
+; CHECK: [[DBG32]] = !DILocation(line: 11, column: 5, scope: [[META15]])
+; CHECK: [[DBG33]] = !DILocation(line: 13, column: 2, scope: [[META23]])
+; CHECK: [[LOOP34]] = distinct !{[[LOOP34]], [[DBG21]], [[META29]], [[META30]]}
+; CHECK: [[DBG35]] = !DILocation(line: 14, column: 1, scope: [[DBG4]])
 ;.



More information about the llvm-commits mailing list