[llvm] [LV] Skipping all debug instructions when native vplan is enabled (PR #77413)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 13:00:21 PST 2024
================
@@ -0,0 +1,204 @@
+; 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
+ 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)
----------------
fhahn wrote:
Would be good to reduce the amount of meadata a bit if possible.
https://github.com/llvm/llvm-project/pull/77413
More information about the llvm-commits
mailing list