[llvm] 3b23453 - Revert "[SafeStack][DebugInfo] Insert DW_OP_deref in correct location"
Leonard Chan via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 16:19:09 PST 2020
Author: Leonard Chan
Date: 2020-01-30T16:18:41-08:00
New Revision: 3b23453b6cbff7366e91c7bb76c3a0c529ec8515
URL: https://github.com/llvm/llvm-project/commit/3b23453b6cbff7366e91c7bb76c3a0c529ec8515
DIFF: https://github.com/llvm/llvm-project/commit/3b23453b6cbff7366e91c7bb76c3a0c529ec8515.diff
LOG: Revert "[SafeStack][DebugInfo] Insert DW_OP_deref in correct location"
This reverts commit fff6a1b0f1fe57b46379001db75952d2a06eab1f.
This was breaking a bunch of buildbots.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/test/DebugInfo/COFF/types-array-advanced.ll
llvm/test/DebugInfo/X86/safestack-byval.ll
Removed:
llvm/test/DebugInfo/X86/safestack-deref.ll
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
index dc78bba72e65..02de072ea601 100644
--- a/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -754,9 +754,9 @@ InstrEmitter::EmitDbgValue(SDDbgValue *SD,
// Indirect addressing is indicated by an Imm as the second parameter.
if (SD->isIndirect())
- MIB.addImm(0U);
- else
- MIB.addReg(0U, RegState::Debug);
+ Expr = DIExpression::append(Expr, {dwarf::DW_OP_deref});
+
+ MIB.addReg(0U, RegState::Debug);
MIB.addMetadata(Var);
MIB.addMetadata(Expr);
diff --git a/llvm/test/DebugInfo/COFF/types-array-advanced.ll b/llvm/test/DebugInfo/COFF/types-array-advanced.ll
index 146fd933c133..3aa0686e2032 100644
--- a/llvm/test/DebugInfo/COFF/types-array-advanced.ll
+++ b/llvm/test/DebugInfo/COFF/types-array-advanced.ll
@@ -51,28 +51,39 @@
; CHECK: SizeOf: 0
; CHECK: Name:
; CHECK: }
-; CHECK: Array (0x1004) {
+; CHECK: Pointer (0x1004) {
+; CHECK: TypeLeafKind: LF_POINTER (0x1002)
+; CHECK: PointeeType: 0x1003
+; CHECK: PtrType: Near32 (0xA)
+; CHECK: PtrMode: LValueReference (0x1)
+; CHECK: IsFlat: 0
+; CHECK: IsConst: 0
+; CHECK: IsVolatile: 0
+; CHECK: IsUnaligned: 0
+; CHECK: SizeOf: 0
+; CHECK: }
+; CHECK: Array (0x1005) {
; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
; CHECK: ElementType: char (0x70)
; CHECK: IndexType: unsigned long (0x22)
; CHECK: SizeOf: 7
; CHECK: Name:
; CHECK: }
-; CHECK: Array (0x1005) {
+; CHECK: Array (0x1006) {
; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
-; CHECK: ElementType: 0x1004
+; CHECK: ElementType: 0x1005
; CHECK: IndexType: unsigned long (0x22)
; CHECK: SizeOf: 35
; CHECK: Name:
; CHECK: }
-; CHECK: Array (0x1006) {
+; CHECK: Array (0x1007) {
; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
-; CHECK: ElementType: 0x1005
+; CHECK: ElementType: 0x1006
; CHECK: IndexType: unsigned long (0x22)
; CHECK: SizeOf: 70
; CHECK: Name:
; CHECK: }
-; CHECK: Struct (0x1007) {
+; CHECK: Struct (0x1008) {
; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505)
; CHECK: MemberCount: 0
; CHECK: Properties [ (0x280)
@@ -86,16 +97,16 @@
; CHECK: Name: incomplete_struct
; CHECK: LinkageName: .?AUincomplete_struct@@
; CHECK: }
-; CHECK: Array (0x1008) {
+; CHECK: Array (0x1009) {
; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
-; CHECK: ElementType: incomplete_struct (0x1007)
+; CHECK: ElementType: incomplete_struct (0x1008)
; CHECK: IndexType: unsigned long (0x22)
; CHECK: SizeOf: 12
; CHECK: Name:
; CHECK: }
-; CHECK: Pointer (0x1009) {
+; CHECK: Pointer (0x100A) {
; CHECK: TypeLeafKind: LF_POINTER (0x1002)
-; CHECK: PointeeType: 0x1008
+; CHECK: PointeeType: 0x1009
; CHECK: PtrType: Near32 (0xA)
; CHECK: PtrMode: Pointer (0x0)
; CHECK: IsFlat: 0
@@ -104,7 +115,7 @@
; CHECK: IsUnaligned: 0
; CHECK: SizeOf: 4
; CHECK: }
-; CHECK: FieldList (0x100A) {
+; CHECK: FieldList (0x100B) {
; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
; CHECK: DataMember {
; CHECK: TypeLeafKind: LF_MEMBER (0x150D)
@@ -114,31 +125,31 @@
; CHECK: Name: s1
; CHECK: }
; CHECK: }
-; CHECK: Struct (0x100B) {
+; CHECK: Struct (0x100C) {
; CHECK: TypeLeafKind: LF_STRUCTURE (0x1505)
; CHECK: MemberCount: 1
; CHECK: Properties [ (0x200)
; CHECK: HasUniqueName (0x200)
; CHECK: ]
-; CHECK: FieldList: <field list> (0x100A)
+; CHECK: FieldList: <field list> (0x100B)
; CHECK: DerivedFrom: 0x0
; CHECK: VShape: 0x0
; CHECK: SizeOf: 4
; CHECK: Name: incomplete_struct
; CHECK: LinkageName: .?AUincomplete_struct@@
; CHECK: }
-; CHECK: StringId (0x100C) {
+; CHECK: StringId (0x100D) {
; CHECK: TypeLeafKind: LF_STRING_ID (0x1605)
; CHECK: Id: 0x0
; CHECK: StringData: /t.cpp
; CHECK: }
-; CHECK: UdtSourceLine (0x100D) {
+; CHECK: UdtSourceLine (0x100E) {
; CHECK: TypeLeafKind: LF_UDT_SRC_LINE (0x1606)
-; CHECK: UDT: incomplete_struct (0x100B)
-; CHECK: SourceFile: /t.cpp (0x100C)
+; CHECK: UDT: incomplete_struct (0x100C)
+; CHECK: SourceFile: /t.cpp (0x100D)
; CHECK: LineNumber: 4
; CHECK: }
-; CHECK: Modifier (0x100E) {
+; CHECK: Modifier (0x100F) {
; CHECK: TypeLeafKind: LF_MODIFIER (0x1001)
; CHECK: ModifiedType: int (0x74)
; CHECK: Modifiers [ (0x3)
@@ -146,9 +157,9 @@
; CHECK: Volatile (0x2)
; CHECK: ]
; CHECK: }
-; CHECK: Array (0x100F) {
+; CHECK: Array (0x1010) {
; CHECK: TypeLeafKind: LF_ARRAY (0x1503)
-; CHECK: ElementType: const volatile int (0x100E)
+; CHECK: ElementType: const volatile int (0x100F)
; CHECK: IndexType: unsigned long (0x22)
; CHECK: SizeOf: 16
; CHECK: Name:
diff --git a/llvm/test/DebugInfo/X86/safestack-byval.ll b/llvm/test/DebugInfo/X86/safestack-byval.ll
index ee09ba596d51..1d53908b4978 100644
--- a/llvm/test/DebugInfo/X86/safestack-byval.ll
+++ b/llvm/test/DebugInfo/X86/safestack-byval.ll
@@ -14,7 +14,7 @@
; }
; CHECK: ![[ZZZ:.*]] = !DILocalVariable(name: "zzz",
-; CHECK: DBG_VALUE {{.*}} ![[ZZZ]], !DIExpression(DW_OP_constu, 400, DW_OP_minus)
+; CHECK: DBG_VALUE {{.*}} ![[ZZZ]], !DIExpression(DW_OP_constu, 400, DW_OP_minus, DW_OP_deref)
%struct.S = type { [100 x i32] }
diff --git a/llvm/test/DebugInfo/X86/safestack-deref.ll b/llvm/test/DebugInfo/X86/safestack-deref.ll
deleted file mode 100644
index 6a13dbce3657..000000000000
--- a/llvm/test/DebugInfo/X86/safestack-deref.ll
+++ /dev/null
@@ -1,42 +0,0 @@
-; This test prevents a regression of PR44585 where the DW_OP_deref is incorrectly placed at the end of the expression chain.
-
-; RUN: llc -O0 -mtriple=x86_64-unknown-linux-gnu -filetype=obj %s -o - | llvm-dwarfdump - --name=value | FileCheck %s
-; REQUIRES: object-emission
-
-; CHECK: DW_TAG_variable
-; CHECK-NEXT: DW_AT_location
-; CHECK-NEXT: DW_OP_breg{{[0-9]+}} R{{[0-9A-Z]+}}-8
-; CHECK-NEXT: DW_OP_breg{{[0-9]+}} R{{[0-9A-Z]+}}+8, DW_OP_deref, DW_OP_lit8, DW_OP_minus
-; CHECK-NEXT: DW_AT_name ("value")
-
-define dso_local void @_Z4funcv() safestack !dbg !7 {
- %1 = alloca i8, align 8
- call void @llvm.dbg.declare(metadata i8* %1, metadata !11, metadata !DIExpression()), !dbg !22
- call void @extern_func(i8* %1), !dbg !22
- ret void
-}
-declare void @llvm.dbg.declare(metadata, metadata, metadata)
-declare void @extern_func(i8* %0)
-
-!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!4}
-
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, emissionKind: FullDebug)
-!1 = !DIFile(filename: "/tmp/test3.cpp", directory: "")
-!4 = !{i32 2, !"Debug Info Version", i32 3}
-!7 = distinct !DISubprogram(name: "func", linkageName: "_Z4funcv", scope: !8, file: !8, line: 7, type: !9, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0)
-!8 = !DIFile(filename: "/tmp/test3.cpp", directory: "")
-!9 = !DISubroutineType(types: !10)
-!10 = !{null}
-!11 = !DILocalVariable(name: "value", scope: !7, file: !8, line: 8, type: !12)
-!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "A", file: !8, line: 1, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !13, identifier: "_ZTS1A")
-!13 = !{!14, !18}
-!14 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !12, file: !8, line: 4, baseType: !15, size: 64, flags: DIFlagPublic)
-!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64)
-!16 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !17)
-!17 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
-!18 = !DISubprogram(name: "A", scope: !12, file: !8, line: 3, type: !19, scopeLine: 3, flags: DIFlagPublic | DIFlagPrototyped, spFlags: 0)
-!19 = !DISubroutineType(types: !20)
-!20 = !{null, !21, !15}
-!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
-!22 = !DILocation(line: 8, column: 5, scope: !7)
More information about the llvm-commits
mailing list