summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2017-06-14 13:14:38 +0000
committerFlorian Hahn <florian.hahn@arm.com>2017-06-14 13:14:38 +0000
commitffc498dfcc8d67e6e9acaebb690377f674457ab4 (patch)
treeee4b382264a95b313d95f2531f4adea92677d085 /llvm/test/Bitcode
parent3f250380d4bded33c24fb36ef780b2d37ed3e52e (diff)
downloadbcm5719-llvm-ffc498dfcc8d67e6e9acaebb690377f674457ab4.tar.gz
bcm5719-llvm-ffc498dfcc8d67e6e9acaebb690377f674457ab4.zip
Align definition of DW_OP_plus with DWARF spec [3/3]
Summary: This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things. The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack. This is done in three stages: • The first patch (LLVM) adds support for DW_OP_plus_uconst. • The second patch (Clang) contains changes all its uses from DW_OP_plus to DW_OP_plus_uconst. • The third patch (LLVM) changes the semantics of DW_OP_plus and DW_OP_minus to be in line with its DWARF meaning. This patch includes the bitcode upgrade from legacy DIExpressions. Patch by Sander de Smalen. Reviewers: echristo, pcc, aprantl Reviewed By: aprantl Subscribers: fhahn, javed.absar, aprantl, llvm-commits Differential Revision: https://reviews.llvm.org/D33894 llvm-svn: 305386
Diffstat (limited to 'llvm/test/Bitcode')
-rw-r--r--llvm/test/Bitcode/DIExpression-deref.ll6
-rw-r--r--llvm/test/Bitcode/DIExpression-minus-upgrade.ll16
-rw-r--r--llvm/test/Bitcode/DIExpression-minus-upgrade.ll.bcbin0 -> 988 bytes
-rw-r--r--llvm/test/Bitcode/DIGlobalVariableExpression.ll2
4 files changed, 20 insertions, 4 deletions
diff --git a/llvm/test/Bitcode/DIExpression-deref.ll b/llvm/test/Bitcode/DIExpression-deref.ll
index 3a161b8ee4d..a03d6016523 100644
--- a/llvm/test/Bitcode/DIExpression-deref.ll
+++ b/llvm/test/Bitcode/DIExpression-deref.ll
@@ -11,11 +11,11 @@
!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
; DW_OP_deref should be moved to the back of the expression.
;
-; CHECK: !DIExpression(DW_OP_plus, 0, DW_OP_deref, DW_OP_LLVM_fragment, 8, 32)
+; CHECK: !DIExpression(DW_OP_plus_uconst, 0, DW_OP_deref, DW_OP_LLVM_fragment, 8, 32)
!6 = !DIExpression(DW_OP_deref, DW_OP_plus, 0, DW_OP_LLVM_fragment, 8, 32)
-; CHECK: !DIExpression(DW_OP_plus, 0, DW_OP_deref)
+; CHECK: !DIExpression(DW_OP_plus_uconst, 0, DW_OP_deref)
!7 = !DIExpression(DW_OP_deref, DW_OP_plus, 0)
-; CHECK: !DIExpression(DW_OP_plus, 1, DW_OP_deref)
+; CHECK: !DIExpression(DW_OP_plus_uconst, 1, DW_OP_deref)
!8 = !DIExpression(DW_OP_plus, 1, DW_OP_deref)
; CHECK: !DIExpression(DW_OP_deref)
!9 = !DIExpression(DW_OP_deref)
diff --git a/llvm/test/Bitcode/DIExpression-minus-upgrade.ll b/llvm/test/Bitcode/DIExpression-minus-upgrade.ll
new file mode 100644
index 00000000000..1f26eba6f98
--- /dev/null
+++ b/llvm/test/Bitcode/DIExpression-minus-upgrade.ll
@@ -0,0 +1,16 @@
+; RUN: llvm-dis -o - %s.bc | FileCheck %s
+
+!llvm.dbg.cu = !{!1}
+!llvm.module.flags = !{!8, !9}
+
+!0 = distinct !DIGlobalVariable(name: "g", scope: !1, file: !2, line: 1, type: !5, isLocal: false, isDefinition: true)
+!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang (llvm/trunk 304286)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !4)
+!2 = !DIFile(filename: "a.c", directory: "/")
+!3 = !{}
+!4 = !{!7}
+!5 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+; CHECK: !DIExpression(DW_OP_constu, 42, DW_OP_minus)
+!6 = !DIExpression(DW_OP_minus, 42)
+!7 = !DIGlobalVariableExpression(var: !0, expr: !6)
+!8 = !{i32 2, !"Dwarf Version", i32 4}
+!9 = !{i32 2, !"Debug Info Version", i32 3}
diff --git a/llvm/test/Bitcode/DIExpression-minus-upgrade.ll.bc b/llvm/test/Bitcode/DIExpression-minus-upgrade.ll.bc
new file mode 100644
index 00000000000..354ba6454c3
--- /dev/null
+++ b/llvm/test/Bitcode/DIExpression-minus-upgrade.ll.bc
Binary files differ
diff --git a/llvm/test/Bitcode/DIGlobalVariableExpression.ll b/llvm/test/Bitcode/DIGlobalVariableExpression.ll
index f6796bbdb7a..31c3fda1b00 100644
--- a/llvm/test/Bitcode/DIGlobalVariableExpression.ll
+++ b/llvm/test/Bitcode/DIGlobalVariableExpression.ll
@@ -14,7 +14,7 @@
; CHECK: ![[HVAR:[0-9]+]] = distinct !DIGlobalVariable(name: "h",
; CHECK: ![[IMPORTS]] = !{![[CIMPORT:[0-9]+]]}
; CHECK: ![[CIMPORT]] = !DIImportedEntity({{.*}}entity: ![[HVAR]]
-; CHECK: ![[GEXPR]] = !DIExpression(DW_OP_plus, 1)
+; CHECK: ![[GEXPR]] = !DIExpression(DW_OP_plus_uconst, 1)
; CHECK: ![[H]] = {{.*}}!DIGlobalVariableExpression(var: ![[HVAR]])
@g = common global i32 0, align 4, !dbg !0
OpenPOWER on IntegriCloud