1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -run-pass=prologepilog -o - %s | FileCheck %s
# Test that the presence of debug instructions doesn't trigger arbitrary registers that are unused to be zeroed out.
--- |
; ModuleID = 'zero-call-used-regs-debug-info.ll'
source_filename = "zero-call-used-regs-debug-info.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@b = dso_local local_unnamed_addr global i32 0, align 4, !dbg !0
@a = dso_local local_unnamed_addr global [1 x i8] zeroinitializer, align 1, !dbg !5
; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local signext i8 @c(i32 noundef %d) local_unnamed_addr #0 !dbg !19 {
entry:
call void @llvm.dbg.value(metadata i32 %d, metadata !23, metadata !DIExpression()), !dbg !26
call void @llvm.dbg.value(metadata i32 %d, metadata !24, metadata !DIExpression()), !dbg !27
%0 = load i32, ptr @b, align 4, !dbg !28, !tbaa !29
%conv = trunc i32 %0 to i8, !dbg !33
store i8 %conv, ptr @a, align 1, !dbg !34, !tbaa !35
ret i8 undef, !dbg !36
}
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, argmem: none, inaccessiblemem: none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" "zero-call-used-regs"="used" }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!12, !13, !14, !15, !16, !17}
!llvm.ident = !{!18}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 2, type: !11, isLocal: false, isDefinition: true)
!2 = distinct !DICompileUnit(language: DW_LANG_C11, file: !3, producer: "clang version 16.0.0 (https://github.com/llvm/llvm-project.git ba5acedd979aa94a81be555e0add8e4421499d4f)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, globals: !4, splitDebugInlining: false, nameTableKind: None)
!3 = !DIFile(filename: "zero-call-used-regs-debug-info.c", directory: "/home/xgupta/compiler/llvm-project/build/bin", checksumkind: CSK_MD5, checksum: "fe3a5f45289411a008e07c7debb490ca")
!4 = !{!5, !0}
!5 = !DIGlobalVariableExpression(var: !6, expr: !DIExpression())
!6 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !7, isLocal: false, isDefinition: true)
!7 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 8, elements: !9)
!8 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!9 = !{!10}
!10 = !DISubrange(count: 1)
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!12 = !{i32 7, !"Dwarf Version", i32 5}
!13 = !{i32 2, !"Debug Info Version", i32 3}
!14 = !{i32 1, !"wchar_size", i32 4}
!15 = !{i32 8, !"PIC Level", i32 2}
!16 = !{i32 7, !"PIE Level", i32 2}
!17 = !{i32 7, !"uwtable", i32 2}
!18 = !{!"clang version 16.0.0 (https://github.com/llvm/llvm-project.git ba5acedd979aa94a81be555e0add8e4421499d4f)"}
!19 = distinct !DISubprogram(name: "c", scope: !3, file: !3, line: 3, type: !20, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !22)
!20 = !DISubroutineType(types: !21)
!21 = !{!8, !11}
!22 = !{!23, !24}
!23 = !DILocalVariable(name: "d", arg: 1, scope: !19, file: !3, line: 3, type: !11)
!24 = !DILocalVariable(name: "e", scope: !25, file: !3, line: 5, type: !11)
!25 = distinct !DILexicalBlock(scope: !19, file: !3, line: 4, column: 9)
!26 = !DILocation(line: 0, scope: !19)
!27 = !DILocation(line: 0, scope: !25)
!28 = !DILocation(line: 6, column: 5, scope: !25)
!29 = !{!30, !30, i64 0}
!30 = !{!"int", !31, i64 0}
!31 = !{!"omnipotent char", !32, i64 0}
!32 = !{!"Simple C/C++ TBAA"}
!33 = !DILocation(line: 4, column: 8, scope: !19)
!34 = !DILocation(line: 4, column: 6, scope: !19)
!35 = !{!31, !31, i64 0}
!36 = !DILocation(line: 8, column: 1, scope: !19)
!37 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 9, type: !38, scopeLine: 9, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !40)
!38 = !DISubroutineType(types: !39)
!39 = !{null}
!40 = !{}
!41 = !DILocation(line: 9, column: 14, scope: !37)
...
---
name: c
alignment: 16
exposesReturnsTwice: false
legalized: false
regBankSelected: false
selected: false
failedISel: false
tracksRegLiveness: true
hasWinCFI: false
callsEHReturn: false
callsUnwindInit: false
hasEHCatchret: false
hasEHScopes: false
hasEHFunclets: false
debugInstrRef: true
failsVerification: false
tracksDebugUserValues: true
registers: []
liveins: []
frameInfo:
isFrameAddressTaken: false
isReturnAddressTaken: false
hasStackMap: false
hasPatchPoint: false
stackSize: 0
offsetAdjustment: 0
maxAlignment: 1
adjustsStack: false
hasCalls: false
stackProtector: ''
functionContext: ''
maxCallFrameSize: 4294967295
cvBytesOfCalleeSavedRegisters: 0
hasOpaqueSPAdjustment: false
hasVAStart: false
hasMustTailInVarArgFunc: false
hasTailCall: false
localFrameSize: 0
savePoint: ''
restorePoint: ''
fixedStack: []
stack: []
callSites: []
debugValueSubstitutions: []
constants: []
machineFunctionInfo: {}
body: |
bb.0.entry:
; CHECK-LABEL: name: c
; CHECK: DBG_VALUE $edi, $noreg, !23, !DIExpression(), debug-location !26
; CHECK-NEXT: DBG_VALUE $edi, $noreg, !24, !DIExpression(), debug-location !27
; CHECK-NEXT: renamable $al = MOV8rm $rip, 1, $noreg, @b, $noreg, debug-location !28 :: (dereferenceable load (s8) from @b, align 4, !tbaa !29)
; CHECK-NEXT: MOV8mr $rip, 1, $noreg, @a, $noreg, killed renamable $al, debug-location !34 :: (store (s8) into @a, !tbaa !35)
; CHECK-NEXT: RET 0, undef $al, debug-location !36
DBG_VALUE $edi, $noreg, !23, !DIExpression(), debug-location !26
DBG_VALUE $edi, $noreg, !24, !DIExpression(), debug-location !27
renamable $al = MOV8rm $rip, 1, $noreg, @b, $noreg, debug-location !28 :: (dereferenceable load (s8) from @b, align 4, !tbaa !29)
MOV8mr $rip, 1, $noreg, @a, $noreg, killed renamable $al, debug-location !34 :: (store (s8) into @a, !tbaa !35)
RET 0, undef $al, debug-location !36
...
|