[DebugInfo] Normalize common kinds of DWARF sub-expressions.
Normalize common kinds of DWARF sub-expressions to make debug info
encoding a bit more compact:
DW_OP_constu [X < 32] -> DW_OP_litX
DW_OP_constu [all ones] -> DW_OP_lit0, DW_OP_not (64-bit only)
Differential revision: https://reviews.llvm.org/D51640
llvm-svn: 341457
diff --git a/llvm/test/DebugInfo/X86/PR26148.ll b/llvm/test/DebugInfo/X86/PR26148.ll
index 198776e..685f2d5 100644
--- a/llvm/test/DebugInfo/X86/PR26148.ll
+++ b/llvm/test/DebugInfo/X86/PR26148.ll
@@ -19,8 +19,8 @@
; AS in 26163, we expect two ranges (as opposed to one), the first one being zero sized
;
;
-; CHECK: [0x0000000000000004, 0x0000000000000004): DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_reg5 RDI, DW_OP_piece 0x2
-; CHECK: [0x0000000000000004, 0x0000000000000014): DW_OP_constu 0x3, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_piece 0x4
+; CHECK: [0x0000000000000004, 0x0000000000000004): DW_OP_lit3, DW_OP_piece 0x4, DW_OP_reg5 RDI, DW_OP_piece 0x2
+; CHECK: [0x0000000000000004, 0x0000000000000014): DW_OP_lit3, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_piece 0x4
source_filename = "test/DebugInfo/X86/PR26148.ll"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/DebugInfo/X86/constant-loclist.ll b/llvm/test/DebugInfo/X86/constant-loclist.ll
index 9810683..17643d1 100644
--- a/llvm/test/DebugInfo/X86/constant-loclist.ll
+++ b/llvm/test/DebugInfo/X86/constant-loclist.ll
@@ -14,7 +14,7 @@
; CHECK-NEXT: DW_AT_name {{.*}}"i"
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location [DW_FORM_data4] (
-; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x0
+; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_lit0
; CHECK-NEXT: [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4000000000000000)
; CHECK-NEXT: DW_AT_name {{.*}}"u"
diff --git a/llvm/test/DebugInfo/X86/dw_op_minus_direct.ll b/llvm/test/DebugInfo/X86/dw_op_minus_direct.ll
index a801347..bc4241c 100644
--- a/llvm/test/DebugInfo/X86/dw_op_minus_direct.ll
+++ b/llvm/test/DebugInfo/X86/dw_op_minus_direct.ll
@@ -17,7 +17,7 @@
; CHECK: .debug_loc contents:
; CHECK: 0x00000000:
-; CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_constu 0x1, DW_OP_minus, DW_OP_stack_value
+; CHECK-NEXT: [0x0000000000000000, 0x0000000000000004): DW_OP_breg0 RAX+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_lit1, DW_OP_minus, DW_OP_stack_value
; rax+0, constu 0xffffffff, and, constu 0x00000001, minus, stack-value
source_filename = "minus.c"
diff --git a/llvm/test/DebugInfo/X86/partial-constant.ll b/llvm/test/DebugInfo/X86/partial-constant.ll
index 0c02cf1..831d616 100644
--- a/llvm/test/DebugInfo/X86/partial-constant.ll
+++ b/llvm/test/DebugInfo/X86/partial-constant.ll
@@ -18,7 +18,7 @@
; CHECK-NOT: DW_AT_const_value
; CHECK: .debug_loc contents:
; CHECK-NEXT: 0x00000000:
-; CHECK-NEXT: {{.*}}: DW_OP_constu 0x1, DW_OP_stack_value
+; CHECK-NEXT: {{.*}}: DW_OP_lit1, DW_OP_stack_value
source_filename = "test.ii"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
diff --git a/llvm/test/DebugInfo/X86/pieces-4.ll b/llvm/test/DebugInfo/X86/pieces-4.ll
index 0e8c5e1..6ae8597 100644
--- a/llvm/test/DebugInfo/X86/pieces-4.ll
+++ b/llvm/test/DebugInfo/X86/pieces-4.ll
@@ -25,7 +25,7 @@
; DWARF: .debug_loc contents:
; DWARF-NEXT: 0x00000000:
-; DWARF-NEXT: {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
+; DWARF-NEXT: {{.*}}: DW_OP_breg7 RSP+{{[0-9]+}}, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
; ModuleID = 't.c'
source_filename = "t.c"
diff --git a/llvm/test/DebugInfo/X86/split-global.ll b/llvm/test/DebugInfo/X86/split-global.ll
index a47dd53..abe0a82 100644
--- a/llvm/test/DebugInfo/X86/split-global.ll
+++ b/llvm/test/DebugInfo/X86/split-global.ll
@@ -17,13 +17,13 @@
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_name {{.*}}"part_const"
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4)
+; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x8, DW_OP_piece 0x4, DW_OP_lit2, DW_OP_stack_value, DW_OP_piece 0x4)
; [0x0000000000000008], piece 0x00000004, constu 0x00000002, stack-value, piece 0x00000004
; CHECK-NOT: DW_TAG
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_name {{.*}}"full_const"
; CHECK-NOT: DW_TAG
-; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_constu 0x1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_constu 0x2, DW_OP_stack_value, DW_OP_piece 0x4)
+; CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_lit1, DW_OP_stack_value, DW_OP_piece 0x4, DW_OP_lit2, DW_OP_stack_value, DW_OP_piece 0x4)
; CHECK-NOT: DW_TAG
@point.y = global i32 2, align 4, !dbg !13
@point.x = global i32 1, align 4, !dbg !12
diff --git a/llvm/test/DebugInfo/X86/stack-value-dwarf4.ll b/llvm/test/DebugInfo/X86/stack-value-dwarf4.ll
index 7ad7cce..479625b 100644
--- a/llvm/test/DebugInfo/X86/stack-value-dwarf4.ll
+++ b/llvm/test/DebugInfo/X86/stack-value-dwarf4.ll
@@ -6,25 +6,23 @@
target datalayout = "e-p:64:64"
target triple = "x86_64-unknown-linux-gnu"
-; CHECK-DWARF2: .byte 8 # DW_AT_location
-; CHECK-DWARF2 .byte 16
-; CHECK-DWARF2 .byte 4
-; CHECK-DWARF2 .byte 147
-; CHECK-DWARF2 .byte 2
-; CHECK-DWARF2 .byte 16
-; CHECK-DWARF2 .byte 0
-; CHECK-DWARF2 .byte 147
-; CHECK-DWARF2 .byte 2
+; CHECK-DWARF2: .byte 6 # DW_AT_location
+; CHECK-DWARF2-NEXT: .byte 52
+; CHECK-DWARF2-NEXT: .byte 147
+; CHECK-DWARF2-NEXT: .byte 2
+; CHECK-DWARF2-NEXT: .byte 48
+; CHECK-DWARF2-NEXT: .byte 147
+; CHECK-DWARF2-NEXT: .byte 2
-; CHECK-DWARF4: .byte 10 # DW_AT_location
-; CHECK-DWARF4-NEXT: .byte 16
-; CHECK-DWARF4-NEXT: .byte 4
-; CHECK-DWARF4-NEXT: .byte 159
-; CHECK-DWARF4-NEXT: .byte 147
-; CHECK-DWARF4-NEXT: .byte 2
-; CHECK-DWARF4-NEXT: .byte 16
-; CHECK-DWARF4-NEXT: .byte 0
-; CHECK-DWARF4-NEXT: .byte 159
+; CHECK-DWARF4: .byte 8 # DW_AT_location
+; CHECK-DWARF4-NEXT:.byte 52
+; CHECK-DWARF4-NEXT:.byte 159
+; CHECK-DWARF4-NEXT:.byte 147
+; CHECK-DWARF4-NEXT:.byte 2
+; CHECK-DWARF4-NEXT:.byte 48
+; CHECK-DWARF4-NEXT:.byte 159
+; CHECK-DWARF4-NEXT:.byte 147
+; CHECK-DWARF4-NEXT:.byte 2
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang", file: !4, globals: !1, emissionKind: FullDebug)
!1 = !{!2, !10}
diff --git a/llvm/test/DebugInfo/X86/stack-value-piece.ll b/llvm/test/DebugInfo/X86/stack-value-piece.ll
index 995504f..b6a03c3 100644
--- a/llvm/test/DebugInfo/X86/stack-value-piece.ll
+++ b/llvm/test/DebugInfo/X86/stack-value-piece.ll
@@ -19,21 +19,21 @@
; CHECK: DW_AT_name {{.*}} "i"
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} ([[I:.*]]
-; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
+; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)
; CHECK-NEXT: DW_AT_name {{.*}} "r"
;
; CHECK: DW_TAG_subprogram
; CHECK: DW_AT_name {{.*}} "f"
; CHECK: DW_TAG_variable
; CHECK-NEXT: DW_AT_location {{.*}} ([[F:.*]]
-; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4)
+; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4)
; CHECK-NEXT: DW_AT_name {{.*}} "r"
;
; CHECK: .debug_loc contents:
; CHECK: [[I]]:
-; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
+; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg5 RDI, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
; CHECK: [[F]]:
-; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_constu 0x0, DW_OP_stack_value, DW_OP_piece 0x4
+; CHECK-NEXT: [{{.*}}, {{.*}}): DW_OP_reg17 XMM0, DW_OP_piece 0x4, DW_OP_lit0, DW_OP_stack_value, DW_OP_piece 0x4
source_filename = "stack-value-piece.c"
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"