Index: llvm/lib/Target/X86/X86InstrInfo.cpp =================================================================== --- llvm/lib/Target/X86/X86InstrInfo.cpp +++ llvm/lib/Target/X86/X86InstrInfo.cpp @@ -7785,6 +7785,8 @@ return ParamLoadedValue(*Op, Expr);; } + case X86::MOV8ri: + case X86::MOV16ri: case X86::MOV32ri: case X86::MOV64ri: case X86::MOV64ri32: Index: llvm/test/DebugInfo/MIR/X86/call-site-info-mov16ri.mir =================================================================== --- /dev/null +++ llvm/test/DebugInfo/MIR/X86/call-site-info-mov16ri.mir @@ -0,0 +1,180 @@ +# RUN: llc -O1 -debug-entry-values -filetype=obj -mtriple x86_64-apple-macosx10.14.0 -start-after=machineverifier %s -o %t.o +# RUN: llvm-dwarfdump %t.o | FileCheck %s + +# Crash test, reduced to this via creduce + delta + creduce again: +# +# typedef a; +# typedef b; +# #define c(d, m, e, f, ...) __builtin_os_log_format(g, f, __VA_ARGS__); +# g, ah +# #define h(aa, i) b aa +# ; +# #define j(k, l) " %s " k, l +# #define r(n, ...) \ +# a ab; \ +# h(o, ); \ +# c(, , , n, __VA_ARGS__) +# #define p(k, q, l, ...) r(j(k, l), __VA_ARGS__) ac(o, ab) +# #define ad(ae, ...) p(ae, , "", __VA_ARGS__) +# *ai; +# ac(int, ...); +# aj() { +# int *ak = ah; +# ad("\t%@ %@ %d 0", ak, ai); +# } + +# CHECK: DW_TAG_call_site_parameter +# CHECK-NEXT: DW_AT_location (DW_OP_reg4 RSI) +# CHECK-NEXT: DW_AT_call_value (DW_OP_constu 0x840) + +--- | + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-apple-macosx10.14.0" + + @ah = local_unnamed_addr global i32 0, align 4, !dbg !0 + @g = local_unnamed_addr global i32 0, align 4, !dbg !12 + @.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 1 + @ai = local_unnamed_addr global i32* null, align 8, !dbg !14 + + ; Function Attrs: nounwind optsize ssp uwtable + define i32 @aj() local_unnamed_addr #0 !dbg !23 { + entry: + ret i32 undef, !dbg !53 + } + + declare !dbg !6 i32 @ac(i32, ...) local_unnamed_addr + declare void @llvm.dbg.value(metadata, metadata, metadata) + declare void @llvm.stackprotector(i8*, i8**) + + attributes #0 = { "disable-tail-calls"="false" "frame-pointer"="all" } + + !llvm.module.flags = !{!17, !18, !19, !20, !21} + !llvm.dbg.cu = !{!2} + !llvm.ident = !{!22} + + !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) + !1 = distinct !DIGlobalVariable(name: "ah", scope: !2, file: !7, line: 4, type: !10, isLocal: false, isDefinition: true) + !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0 (git@github.com:llvm/llvm-project.git e4f0d718d0a9e35045ae665ee39b8a948bc86f21)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !11, nameTableKind: None, sysroot: "/") + !3 = !DIFile(filename: "FigNote.c", directory: "/Users/vsk/tmp/fig") + !4 = !{} + !5 = !{!6} + !6 = !DISubprogram(name: "ac", scope: !7, file: !7, line: 15, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !4) + !7 = !DIFile(filename: "from_delta_fail.c", directory: "/Users/vsk/tmp/fig") + !8 = !DISubroutineType(types: !9) + !9 = !{!10, !10, null} + !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !11 = !{!12, !0, !14} + !12 = !DIGlobalVariableExpression(var: !13, expr: !DIExpression()) + !13 = distinct !DIGlobalVariable(name: "g", scope: !2, file: !7, line: 4, type: !10, isLocal: false, isDefinition: true) + !14 = !DIGlobalVariableExpression(var: !15, expr: !DIExpression()) + !15 = distinct !DIGlobalVariable(name: "ai", scope: !2, file: !7, line: 14, type: !16, isLocal: false, isDefinition: true) + !16 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !10, size: 64) + !17 = !{i32 2, !"SDK Version", [2 x i32] [i32 10, i32 16]} + !18 = !{i32 7, !"Dwarf Version", i32 4} + !19 = !{i32 2, !"Debug Info Version", i32 3} + !20 = !{i32 1, !"wchar_size", i32 4} + !21 = !{i32 7, !"PIC Level", i32 2} + !22 = !{!"clang version 11.0.0 (git@github.com:llvm/llvm-project.git e4f0d718d0a9e35045ae665ee39b8a948bc86f21)"} + !23 = distinct !DISubprogram(name: "aj", scope: !7, file: !7, line: 16, type: !24, scopeLine: 16, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !26) + !24 = !DISubroutineType(types: !25) + !25 = !{!10} + !26 = !{!27, !28, !30} + !27 = !DILocalVariable(name: "ak", scope: !23, file: !7, line: 17, type: !16) + !28 = !DILocalVariable(name: "ab", scope: !23, file: !7, line: 18, type: !29) + !29 = !DIDerivedType(tag: DW_TAG_typedef, name: "a", file: !7, line: 1, baseType: !10) + !30 = !DILocalVariable(name: "o", scope: !23, file: !7, line: 18, type: !31) + !31 = !DIDerivedType(tag: DW_TAG_typedef, name: "b", file: !7, line: 2, baseType: !10) + !32 = !DILocation(line: 17, column: 13, scope: !23) + !33 = !{!34, !34, i64 0} + !34 = !{!"int", !35, i64 0} + !35 = !{!"omnipotent char", !36, i64 0} + !36 = !{!"Simple C/C++ TBAA"} + !37 = !DILocation(line: 0, scope: !23) + !38 = !DILocation(line: 18, column: 3, scope: !23) + !39 = !{!40, !40, i64 0} + !40 = !{!"any pointer", !35, i64 0} + !41 = !DILocalVariable(name: "buffer", arg: 1, scope: !42, type: !45, flags: DIFlagArtificial) + !42 = distinct !DISubprogram(name: "__os_log_helper_1_2_3_8_32_8_64_8_64", scope: !3, file: !3, line: 18, type: !43, scopeLine: 18, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !47) + !43 = !DISubroutineType(types: !44) + !44 = !{null, !45, !46, !46, !46} + !45 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) + !46 = !DIBasicType(name: "long unsigned int", size: 64, encoding: DW_ATE_unsigned) + !47 = !{!41, !48, !49, !50} + !48 = !DILocalVariable(name: "arg0", arg: 2, scope: !42, type: !46, flags: DIFlagArtificial) + !49 = !DILocalVariable(name: "arg1", arg: 3, scope: !42, type: !46, flags: DIFlagArtificial) + !50 = !DILocalVariable(name: "arg2", arg: 4, scope: !42, type: !46, flags: DIFlagArtificial) + !51 = !DILocation(line: 0, scope: !42, inlinedAt: !52) + !52 = distinct !DILocation(line: 18, column: 3, scope: !23) + !53 = !DILocation(line: 19, column: 1, scope: !23) + +... +--- +name: aj +alignment: 1 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +registers: [] +liveins: [] +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 8 + offsetAdjustment: -8 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + maxCallFrameSize: 0 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: + - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default, + callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '', + debug-info-expression: '', debug-info-location: '' } +stack: [] +callSites: + - { bb: 0, offset: 23, fwdArgRegs: + - { arg: 0, reg: '$edi' } + - { arg: 1, reg: '$esi' } } +constants: [] +machineFunctionInfo: {} +body: | + bb.0.entry: + frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp + CFI_INSTRUCTION def_cfa_offset 16 + CFI_INSTRUCTION offset $rbp, -16 + $rbp = frame-setup MOV64rr $rsp + CFI_INSTRUCTION def_cfa_register $rbp + renamable $rax = MOVSX64rm32 $rip, 1, $noreg, @ah, $noreg, debug-location !32 + DBG_VALUE $rax, $noreg, !27, !DIExpression(), debug-location !37 + renamable $rcx = MOVSX64rm32 $rip, 1, $noreg, @g, $noreg, debug-location !38 + renamable $rdx = MOV64rm $rip, 1, $noreg, @ai, $noreg, debug-location !38 + DBG_VALUE $rax, $noreg, !49, !DIExpression(), debug-location !51 + DBG_VALUE $rcx, $noreg, !41, !DIExpression(), debug-location !51 + DBG_VALUE $rdx, $noreg, !50, !DIExpression(), debug-location !51 + MOV32mi renamable $rcx, 1, $noreg, 0, $noreg, 136315650, debug-location !51 + renamable $rsi = LEA64r $rip, 1, $noreg, @.str, $noreg, debug-location !51 + DBG_VALUE $rsi, $noreg, !48, !DIExpression(), debug-location !51 + MOV64mr renamable $rcx, 1, $noreg, 4, $noreg, killed renamable $rsi, debug-location !51 + renamable $si = MOV16ri 2112 + MOV16mr renamable $rcx, 1, $noreg, 12, $noreg, renamable $si, debug-location !51 + MOV64mr renamable $rcx, 1, $noreg, 14, $noreg, killed renamable $rax, debug-location !51 + MOV16mr renamable $rcx, 1, $noreg, 22, $noreg, killed renamable $si, debug-location !51 + MOV64mr killed renamable $rcx, 1, $noreg, 24, $noreg, killed renamable $rdx, debug-location !51 + dead $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $al, debug-location !38 + $rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !38 + TAILJMPd64 @ac, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit undef $edi, implicit undef $esi, implicit $al, debug-location !38 + +...