[llvm] [SLP]Remove operands upon marking instruction for deletion. (PR #97409)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 12 07:13:46 PDT 2024
alexey-bataev wrote:
> Just got to this, which crashes `opt -passes=slp-vectorizer`:
>
> ```
> target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
> target triple = "x86_64-generic-linux-gnu"
>
> define void @_h() #0 {
> entry:
> %arrayidx51.1.i = getelementptr i8, ptr null, i64 4
> %retval.sroa.3.0.insert.ext.i.i = zext i8 0 to i32
> %retval.sroa.2.0.insert.ext.i.i = zext i8 0 to i32
> br label %cond.end.i
>
> cond.end.i: ; preds = %entry
> %add46.i30 = or i32 0, %retval.sroa.2.0.insert.ext.i.i
> %add49.i = or i32 0, %retval.sroa.3.0.insert.ext.i.i
> #dbg_value(i32 %add49.i, !8, !DIExpression(), !16)
> %0 = tail call i32 @llvm.umin.i32(i32 %add46.i30, i32 0)
> %cmp.i14.i.i.i = icmp slt i32 %add49.i, 0
> %block_color.sroa.7.0.insert.ext.i = select i1 %cmp.i14.i.i.i, i32 0, i32 0
> %block_color.sroa.7.0.insert.shift.i = shl i32 %block_color.sroa.7.0.insert.ext.i, 16
> %block_color.sroa.5.0.insert.ext.i = select i1 false, i32 0, i32 %0
> %block_color.sroa.5.0.insert.shift.i = shl i32 %block_color.sroa.5.0.insert.ext.i, 0
> %block_color.sroa.7.0.insert.insert.i = or i32 %block_color.sroa.7.0.insert.shift.i, %block_color.sroa.5.0.insert.shift.i
> %block_color.sroa.5.0.insert.insert.i = or i32 %block_color.sroa.7.0.insert.insert.i, 0
> %block_color.sroa.0.0.insert.insert.i = or i32 %block_color.sroa.5.0.insert.insert.i, 0
> store i32 %block_color.sroa.0.0.insert.insert.i, ptr null, align 4
> %add46.1.i = or i32 0, %retval.sroa.2.0.insert.ext.i.i
> %add49.1.i = or i32 0, %retval.sroa.3.0.insert.ext.i.i
> %cmp.i11.i.i.1.i = icmp slt i32 %add46.1.i, 0
> %1 = tail call i32 @llvm.umin.i32(i32 %add49.1.i, i32 0)
> %block_color.sroa.7.0.insert.ext.1.i = select i1 false, i32 0, i32 %1
> %block_color.sroa.7.0.insert.shift.1.i = shl i32 %block_color.sroa.7.0.insert.ext.1.i, 16
> %block_color.sroa.5.0.insert.ext.1.i = select i1 %cmp.i11.i.i.1.i, i32 0, i32 0
> %block_color.sroa.5.0.insert.shift.1.i = shl i32 %block_color.sroa.5.0.insert.ext.1.i, 0
> %block_color.sroa.7.0.insert.insert.1.i = or i32 %block_color.sroa.7.0.insert.shift.1.i, %block_color.sroa.5.0.insert.shift.1.i
> %block_color.sroa.5.0.insert.insert.1.i = or i32 %block_color.sroa.7.0.insert.insert.1.i, 0
> %block_color.sroa.0.0.insert.insert.1.i = or i32 %block_color.sroa.5.0.insert.insert.1.i, 0
> store i32 %block_color.sroa.0.0.insert.insert.1.i, ptr %arrayidx51.1.i, align 4
> ret void
> }
>
> ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
> declare i32 @llvm.umin.i32(i32, i32) #1
>
> ; uselistorder directives
> uselistorder ptr @llvm.umin.i32, { 1, 0 }
>
> attributes #0 = { "target-features"="+aes,+cmov,+crc32,+cx16,+cx8,+fxsr,+mmx,+pclmul,+popcnt,+prfchw,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" }
> attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
>
> !llvm.dbg.cu = !{!0, !3, !5}
> !llvm.module.flags = !{!7}
>
> !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang 9ddfe62f5c11e3f65f444209f514029ded2d58b9", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "q.pic.dwo", emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: GNU)
> !1 = !DIFile(filename: "q.cpp", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "7f405f2fa7a85732c62eeb5ad41e9a99")
> !2 = !{}
> !3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !4, producer: "clang 9ddfe62f5c11e3f65f444209f514029ded2d58b9", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "q.pic.dwo", emissionKind: FullDebug, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: GNU)
> !4 = !DIFile(filename: "q.cpp", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "b1f6e06104b120054aa37f5011b1165d")
> !5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !6, producer: "clang 9ddfe62f5c11e3f65f444209f514029ded2d58b9", isOptimized: true, runtimeVersion: 0, splitDebugFilename: "q.pic.dwo", emissionKind: FullDebug, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: GNU)
> !6 = !DIFile(filename: "q.cpp", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "1a3869a68f60205ccd08e442850492ac")
> !7 = !{i32 2, !"Debug Info Version", i32 3}
> !8 = !DILocalVariable(name: "sb", arg: 4, scope: !9, file: !10, line: 813, type: !15)
> !9 = distinct !DISubprogram(name: "color_rgba", linkageName: "_i", scope: !11, file: !10, line: 813, type: !13, scopeLine: 814, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !14, retainedNodes: !2)
> !10 = !DIFile(filename: "q.h", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "798e10c1d58d4180e9266db9b9a5137b")
> !11 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "color_rgba", scope: !12, file: !10, line: 763, size: 32, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !2, identifier: "_ZTSN6basisu10color_rgbaE")
> !12 = !DINamespace(name: "basisu", scope: null)
> !13 = distinct !DISubroutineType(types: !2)
> !14 = !DISubprogram(name: "color_rgba", scope: !11, file: !10, line: 813, type: !13, scopeLine: 813, flags: DIFlagPublic | DIFlagPrototyped, spFlags: DISPFlagOptimized)
> !15 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
> !16 = !DILocation(line: 0, scope: !9, inlinedAt: !17)
> !17 = distinct !DILocation(line: 1320, column: 16, scope: !18, inlinedAt: !29)
> !18 = distinct !DILexicalBlock(scope: !19, file: !1, line: 1318, column: 4)
> !19 = distinct !DILexicalBlock(scope: !20, file: !1, line: 1317, column: 4)
> !20 = distinct !DILexicalBlock(scope: !21, file: !1, line: 1317, column: 4)
> !21 = distinct !DILexicalBlock(scope: !22, file: !1, line: 1312, column: 3)
> !22 = distinct !DILexicalBlock(scope: !23, file: !1, line: 1311, column: 3)
> !23 = distinct !DILexicalBlock(scope: !24, file: !1, line: 1311, column: 3)
> !24 = distinct !DISubprogram(name: "evaluate_solution_fast", linkageName: "_f", scope: !25, file: !1, line: 1276, type: !27, scopeLine: 1277, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !28, retainedNodes: !2)
> !25 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "u", scope: !12, file: !26, line: 924, size: 3072, flags: DIFlagFwdDecl | DIFlagNonTrivial, identifier: "_j")
> !26 = !DIFile(filename: "q.h", directory: "/proc/self/cwd", checksumkind: CSK_MD5, checksum: "fd8326e7945b2062220a64fd8351349c")
> !27 = distinct !DISubroutineType(types: !2)
> !28 = !DISubprogram(name: "evaluate_solution_fast", linkageName: "_f", scope: !25, file: !26, line: 1089, type: !27, scopeLine: 1089, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
> !29 = distinct !DILocation(line: 1096, column: 12, scope: !30, inlinedAt: !33)
> !30 = distinct !DILexicalBlock(scope: !31, file: !26, line: 1093, column: 8)
> !31 = distinct !DISubprogram(name: "evaluate_solution", linkageName: "_g", scope: !25, file: !26, line: 1091, type: !27, scopeLine: 1092, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !32, retainedNodes: !2)
> !32 = !DISubprogram(name: "evaluate_solution", linkageName: "_g", scope: !25, file: !26, line: 1091, type: !27, scopeLine: 1091, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
> !33 = distinct !DILocation(line: 990, column: 4, scope: !34)
> !34 = !DILexicalBlockFile(scope: !35, file: !1, discriminator: 2)
> !35 = distinct !DILexicalBlock(scope: !36, file: !1, line: 958, column: 3)
> !36 = distinct !DILexicalBlock(scope: !37, file: !1, line: 957, column: 3)
> !37 = distinct !DILexicalBlock(scope: !38, file: !1, line: 957, column: 3)
> !38 = distinct !DISubprogram(name: "y", linkageName: "_h", scope: !25, file: !1, line: 947, type: !39, scopeLine: 948, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, declaration: !40, retainedNodes: !2)
> !39 = distinct !DISubroutineType(types: !2)
> !40 = !DISubprogram(name: "y", linkageName: "_h", scope: !25, file: !26, line: 1101, type: !39, scopeLine: 1101, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized)
> ```
Thanks, will fix ASAP
https://github.com/llvm/llvm-project/pull/97409
More information about the llvm-commits
mailing list