1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes='instcombine' -S | FileCheck %s
3 ; RUN: opt < %s -passes='instcombine' -S --try-experimental-debuginfo-iterators | FileCheck %s
6 define i32 @foo(<vscale x 2 x i32> %x) {
9 ; CHECK-NEXT: [[ARR:%.*]] = alloca i32, align 4
10 ; CHECK-NEXT: #dbg_value(<vscale x 2 x i32> undef, [[META8:![0-9]+]], !DIExpression(), [[META14:![0-9]+]])
11 ; CHECK-NEXT: store <vscale x 2 x i32> [[X:%.*]], ptr [[ARR]], align 4
12 ; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[ARR]], align 4
13 ; CHECK-NEXT: ret i32 [[RES]]
16 %arr = alloca i32, align 4
17 call void @llvm.dbg.declare(metadata ptr %arr, metadata !8, metadata !DIExpression()), !dbg !14
18 store <vscale x 2 x i32> %x, ptr %arr, align 4
19 %res = load i32, ptr %arr
23 define i32 @foo2(<vscale x 2 x i32> %x) {
26 ; CHECK-NEXT: [[ARR:%.*]] = alloca [4 x i32], align 4
27 ; CHECK-NEXT: #dbg_declare(ptr [[ARR]], [[META15:![0-9]+]], !DIExpression(), [[META17:![0-9]+]])
28 ; CHECK-NEXT: store <vscale x 2 x i32> [[X:%.*]], ptr [[ARR]], align 4
29 ; CHECK-NEXT: [[RES:%.*]] = load i32, ptr [[ARR]], align 4
30 ; CHECK-NEXT: ret i32 [[RES]]
33 %arr = alloca [4 x i32], align 4
34 call void @llvm.dbg.declare(metadata ptr %arr, metadata !15, metadata !DIExpression()), !dbg !17
35 store <vscale x 2 x i32> %x, ptr %arr, align 4
36 %res = load i32, ptr %arr
40 ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
41 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
43 attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
46 !llvm.module.flags = !{!3, !4, !5, !6, !7}
48 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 17.0.0 (git@github.com:llvm/llvm-project.git a489e11439e36c7e0ec83b28a6fb1596a5c21faa)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, retainedTypes: !2, splitDebugInlining: false, nameTableKind: None)
49 !1 = !DIFile(filename: "u.cpp", directory: "/path/to/test", checksumkind: CSK_MD5, checksum: "42f62c17fb0f0110f515890bc6d69cb5")
51 !3 = !{i32 7, !"Dwarf Version", i32 5}
52 !4 = !{i32 2, !"Debug Info Version", i32 3}
53 !5 = !{i32 1, !"wchar_size", i32 4}
54 !6 = !{i32 1, !"target-abi", !"lp64d"}
55 !7 = !{i32 8, !"SmallDataLimit", i32 8}
56 !8 = !DILocalVariable(name: "arr", scope: !9, file: !1, line: 3, type: !12)
57 !9 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !1, file: !1, line: 2, type: !10, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
58 !10 = !DISubroutineType(types: !11)
60 !12 = !DICompositeType(tag: DW_TAG_array_type, baseType: !13, size: 128, elements: !2)
61 !13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
62 !14 = !DILocation(line: 3, column: 7, scope: !9)
63 !15 = !DILocalVariable(name: "arr", scope: !16, file: !1, line: 6, type: !12)
64 !16 = distinct !DISubprogram(name: "foo2", linkageName: "foo2", scope: !1, file: !1, line: 5, type: !10, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
65 !17 = !DILocation(line: 6, column: 7, scope: !16)