summaryrefslogtreecommitdiff
path: root/llvm/test/DebugInfo
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /llvm/test/DebugInfo
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'llvm/test/DebugInfo')
-rw-r--r--llvm/test/DebugInfo/Generic/structor-declaration-linkage-names.ll69
-rw-r--r--llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll2
-rw-r--r--llvm/test/DebugInfo/NVPTX/debug-info.ll2
-rw-r--r--llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll2
-rw-r--r--llvm/test/DebugInfo/NVPTX/debug-name-table.ll2
-rw-r--r--llvm/test/DebugInfo/NVPTX/debug-ptx-symbols.ll2
-rw-r--r--llvm/test/DebugInfo/X86/pr12831.ll37
-rw-r--r--llvm/test/DebugInfo/X86/set.ll165
-rw-r--r--llvm/test/DebugInfo/debug-bool-const-location.ll38
9 files changed, 240 insertions, 79 deletions
diff --git a/llvm/test/DebugInfo/Generic/structor-declaration-linkage-names.ll b/llvm/test/DebugInfo/Generic/structor-declaration-linkage-names.ll
new file mode 100644
index 000000000000..1096cde5f414
--- /dev/null
+++ b/llvm/test/DebugInfo/Generic/structor-declaration-linkage-names.ll
@@ -0,0 +1,69 @@
+; REQUIRES: aarch64-registered-target
+; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck %s
+
+; Make sure we attach DW_AT_linkage_name on function declarations but only
+; attach it on definitions if the value is different than on the declaration.
+
+target triple = "arm64-apple-macosx"
+
+define void @_Z11SameLinkagev() !dbg !4 {
+entry:
+ ret void
+}
+
+; CHECK: DW_AT_linkage_name ("_Z11SameLinkagev")
+; CHECK: DW_AT_declaration (true)
+; CHECK-NOT: DW_AT_linkage_name ("_Z11SameLinkagev")
+
+define void @_Z11DiffLinkagev() !dbg !8 {
+entry:
+ ret void
+}
+
+; CHECK: DW_AT_linkage_name ("SomeName")
+; CHECK: DW_AT_declaration (true)
+; CHECK: DW_AT_linkage_name ("_Z11DiffLinkagev")
+
+define void @_Z15EmptyDefLinkagev() !dbg !10 {
+entry:
+ ret void
+}
+
+; CHECK: DW_AT_linkage_name ("_Z15EmptyDefLinkagev")
+; CHECK: DW_AT_declaration (true)
+; CHECK-NOT: DW_AT_linkage_name
+
+define void @_Z16EmptyDeclLinkagev() !dbg !12 {
+entry:
+ ret void
+}
+
+; CHECK: DW_AT_declaration (true)
+; CHECK: DW_AT_linkage_name ("_Z16EmptyDeclLinkagev")
+
+define void @_Z13EmptyLinkagesv() !dbg !14 {
+entry:
+ ret void
+}
+
+; CHECK-NOT: DW_AT_linkage_name
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2, !3}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/")
+!1 = !DIFile(filename: "foo.cpp", directory: "/tmp")
+!2 = !{i32 7, !"Dwarf Version", i32 5}
+!3 = !{i32 2, !"Debug Info Version", i32 3}
+!4 = distinct !DISubprogram(name: "SameLinkage", linkageName: "_Z11SameLinkagev", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !7)
+!5 = !DISubroutineType(types: !6)
+!6 = !{null}
+!7 = !DISubprogram(name: "SameLinkage", linkageName: "_Z11SameLinkagev", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0)
+!8 = distinct !DISubprogram(name: "DiffLinkage", linkageName: "_Z11DiffLinkagev", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !9)
+!9 = !DISubprogram(name: "DiffLinkage", linkageName: "SomeName", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0)
+!10 = distinct !DISubprogram(name: "EmptyDefLinkage", linkageName: "", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !11)
+!11 = !DISubprogram(name: "EmptyDefLinkage", linkageName: "_Z15EmptyDefLinkagev", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0)
+!12 = distinct !DISubprogram(name: "EmptyDeclLinkage", linkageName: "_Z16EmptyDeclLinkagev", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !13)
+!13 = !DISubprogram(name: "EmptyDeclLinkage", linkageName: "", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0)
+!14 = distinct !DISubprogram(name: "EmptyLinkages", linkageName: "", scope: !1, file: !1, line: 5, type: !5, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, declaration: !15)
+!15 = !DISubprogram(name: "EmptyLinkages", linkageName: "", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, flags: DIFlagPrototyped, spFlags: 0)
diff --git a/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll b/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
index 41734f33213e..6ca906ad3ef2 100644
--- a/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
+++ b/llvm/test/DebugInfo/NVPTX/dbg-value-const-byref.ll
@@ -1,5 +1,5 @@
; RUN: llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 < %s | FileCheck %s
-; RUN: %if ptxas %{ llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 < %s | %ptxas-verify %}
+; RUN: %if ptxas-isa-7.0 %{ llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 < %s | %ptxas-verify %}
; Generated with -O1 from:
; int f1();
diff --git a/llvm/test/DebugInfo/NVPTX/debug-info.ll b/llvm/test/DebugInfo/NVPTX/debug-info.ll
index 04296cd92cd0..4624dce40822 100644
--- a/llvm/test/DebugInfo/NVPTX/debug-info.ll
+++ b/llvm/test/DebugInfo/NVPTX/debug-info.ll
@@ -1,5 +1,5 @@
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 | FileCheck %s
-; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 | %ptxas-verify %}
+; RUN: %if ptxas-isa-7.0 %{ llc < %s -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 | %ptxas-verify %}
; // Bitcode in this test case is reduced version of compiled code below:
;__device__ inline void res(float x, float y, ptr res) { *res = x + y; }
diff --git a/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll b/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
index ca11a2ccf670..7a58caef1d20 100644
--- a/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
+++ b/llvm/test/DebugInfo/NVPTX/debug-loc-offset.ll
@@ -1,5 +1,5 @@
; RUN: llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx70 < %s | FileCheck %s
-; RUN: %if ptxas %{ llc -mtriple=nvptx64-nvidia-cuda < %s -mattr=+ptx70 | %ptxas-verify %}
+; RUN: %if ptxas-isa-7.0 %{ llc -mtriple=nvptx64-nvidia-cuda < %s -mattr=+ptx70 | %ptxas-verify %}
; CHECK: .target sm_{{[0-9]+}}, debug
diff --git a/llvm/test/DebugInfo/NVPTX/debug-name-table.ll b/llvm/test/DebugInfo/NVPTX/debug-name-table.ll
index f0dc50daedfa..936b69de27df 100644
--- a/llvm/test/DebugInfo/NVPTX/debug-name-table.ll
+++ b/llvm/test/DebugInfo/NVPTX/debug-name-table.ll
@@ -1,5 +1,5 @@
; RUN: llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx75 < %s | FileCheck %s
-; RUN: %if ptxas-11.5 %{ llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx75 < %s | %ptxas-verify %}
+; RUN: %if ptxas-isa-7.5 %{ llc -mtriple=nvptx64-nvidia-cuda -mattr=+ptx75 < %s | %ptxas-verify %}
; DICompileUnit without 'nameTableKind: None' results in
; debug_pubnames and debug_pubtypes sections in DWARF. These sections
diff --git a/llvm/test/DebugInfo/NVPTX/debug-ptx-symbols.ll b/llvm/test/DebugInfo/NVPTX/debug-ptx-symbols.ll
index fe1933ad16fe..24ddb972be1b 100644
--- a/llvm/test/DebugInfo/NVPTX/debug-ptx-symbols.ll
+++ b/llvm/test/DebugInfo/NVPTX/debug-ptx-symbols.ll
@@ -1,5 +1,5 @@
; RUN: llc < %s -mcpu=sm_60 | FileCheck %s
-; RUN: %if ptxas %{ llc < %s -mcpu=sm_60 | %ptxas-verify %}
+; RUN: %if ptxas-sm_60 %{ llc < %s -mcpu=sm_60 | %ptxas-verify -arch=sm_60 %}
target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
target triple = "nvptx64-nvidia-cuda"
diff --git a/llvm/test/DebugInfo/X86/pr12831.ll b/llvm/test/DebugInfo/X86/pr12831.ll
index 402bc9aa0450..c37c017a52c2 100644
--- a/llvm/test/DebugInfo/X86/pr12831.ll
+++ b/llvm/test/DebugInfo/X86/pr12831.ll
@@ -1,4 +1,39 @@
-; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -o /dev/null
+; RUN: llc %s -mtriple=x86_64-unknown-linux-gnu -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
+
+; Check that there are no empty DW_TAG_subprogram tags.
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK: DW_TAG_subprogram
+; CHECK-NEXT: DW_AT
+; CHECK-NOT: DW_TAG_subprogram
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
diff --git a/llvm/test/DebugInfo/X86/set.ll b/llvm/test/DebugInfo/X86/set.ll
index 85ad1af53d3e..2bfb08f0de39 100644
--- a/llvm/test/DebugInfo/X86/set.ll
+++ b/llvm/test/DebugInfo/X86/set.ll
@@ -5,112 +5,131 @@
; ModuleID = 'Main.mb'
source_filename = "../src/Main.m3"
-target datalayout = "e-m:e-p:64:64-i64:64-f80:128-n8:16:32:64-S128"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-p:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
-%M_Const_struct = type { [7 x i8], [1 x i8], [4 x i8], [4 x i8], ptr, ptr, ptr, ptr, [8 x i8], [14 x i8], [2 x i8] }
+%M_Const_struct = type { [8 x i8], i64, [16 x i8], [7 x i8], [1 x i8], [4 x i8], [4 x i8], ptr, ptr, ptr, ptr, [8 x i8], [14 x i8], [2 x i8] }
%M_Main_struct = type { ptr, [32 x i8], ptr, [24 x i8], ptr, [8 x i8], ptr, i64, [8 x i8], ptr, ptr, [8 x i8], ptr, [8 x i8] }
+%struct.0 = type { [32 x i8] }
-@M_Const = internal constant %M_Const_struct { [7 x i8] c"Main_M3", [1 x i8] zeroinitializer, [4 x i8] c"Test", [4 x i8] zeroinitializer, ptr @Main_M3, ptr @M_Const, ptr @Main__Test, ptr getelementptr inbounds (i8, ptr @M_Const, i64 8), [8 x i8] zeroinitializer, [14 x i8] c"../src/Main.m3", [2 x i8] zeroinitializer }, align 8
-@M_Main = internal global %M_Main_struct { ptr getelementptr inbounds (i8, ptr @M_Const, i64 56), [32 x i8] zeroinitializer, ptr getelementptr inbounds (i8, ptr @M_Const, i64 16), [24 x i8] zeroinitializer, ptr getelementptr inbounds (i8, ptr @M_Main, i64 104), [8 x i8] zeroinitializer, ptr @Main_M3, i64 3, [8 x i8] zeroinitializer, ptr @Main_I3, ptr getelementptr inbounds (i8, ptr @M_Main, i64 128), [8 x i8] zeroinitializer, ptr @RTHooks_I3, [8 x i8] zeroinitializer }, align 8
+@M_Const = internal constant %M_Const_struct { [8 x i8] zeroinitializer, i64 65546, [16 x i8] zeroinitializer, [7 x i8] c"Main_M3", [1 x i8] zeroinitializer, [4 x i8] c"Test", [4 x i8] zeroinitializer, ptr @Main_M3, ptr getelementptr inbounds (i8, ptr @M_Const, i64 32), ptr @Main__Test, ptr getelementptr inbounds (i8, ptr @M_Const, i64 40), [8 x i8] zeroinitializer, [14 x i8] c"../src/Main.m3", [2 x i8] zeroinitializer }, align 8
+@M_Main = internal global %M_Main_struct { ptr getelementptr inbounds (i8, ptr @M_Const, i64 88), [32 x i8] zeroinitializer, ptr getelementptr inbounds (i8, ptr @M_Const, i64 48), [24 x i8] zeroinitializer, ptr getelementptr inbounds (i8, ptr @M_Main, i64 104), [8 x i8] zeroinitializer, ptr @Main_M3, i64 3, [8 x i8] zeroinitializer, ptr @Main_I3, ptr getelementptr inbounds (i8, ptr @M_Main, i64 128), [8 x i8] zeroinitializer, ptr @RTHooks_I3, [8 x i8] zeroinitializer }, align 8
@m3_jmpbuf_size = external global i64, align 8
+declare ptr @__m3_personality_v0()
+
declare ptr @Main_I3()
declare ptr @RTHooks_I3()
-; Function Attrs: uwtable
-define void @Main__Test() #0 !dbg !5 {
+define void @Main__Test() #0 !dbg !18 {
entry:
%as = alloca i64, align 8
- %bs = alloca i64, align 8
- br label %second, !dbg !21
+ %bs = alloca i8, align 1
+ %sc = alloca %struct.0, align 8
+ %sb = alloca i8, align 1
+ br label %second, !dbg !22
second: ; preds = %entry
- call void @llvm.dbg.declare(metadata ptr %as, metadata !22, metadata !DIExpression()), !dbg !25
- call void @llvm.dbg.declare(metadata ptr %bs, metadata !26, metadata !DIExpression()), !dbg !25
- store i64 36028797018972298, ptr %as, align 8, !dbg !28
- store i64 197, ptr %bs, align 8, !dbg !29
- ret void, !dbg !21
+ #dbg_declare(ptr %as, !23, !DIExpression(), !27)
+ #dbg_declare(ptr %bs, !28, !DIExpression(), !27)
+ #dbg_declare(ptr %sc, !30, !DIExpression(), !27)
+ #dbg_declare(ptr %sb, !33, !DIExpression(), !27)
+ store i8 3, ptr %sb, align 1, !dbg !36
+ store i64 36028797018972298, ptr %as, align 8, !dbg !37
+ store i8 85, ptr %bs, align 1, !dbg !38
+ call void @llvm.memmove.p0.p0.i64(ptr align 8 %sc, ptr align 8 @M_Const, i64 32, i1 false), !dbg !39
+ ret void, !dbg !22
}
-; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
-declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
-
declare ptr @alloca()
-; Function Attrs: uwtable
-define ptr @Main_M3(i64 %mode) #0 !dbg !30 {
+; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
+declare void @llvm.memmove.p0.p0.i64(ptr writeonly captures(none), ptr readonly captures(none), i64, i1 immarg) #1
+
+define ptr @Main_M3(i64 %mode) #0 !dbg !40 {
entry:
%mode1 = alloca i64, align 8
store i64 %mode, ptr %mode1, align 8
- br label %second, !dbg !36
+ br label %second, !dbg !45
second: ; preds = %entry
- call void @llvm.dbg.declare(metadata ptr %mode1, metadata !37, metadata !DIExpression()), !dbg !38
- %v.3 = load i64, ptr %mode1, align 8, !dbg !38
- %icmp = icmp eq i64 %v.3, 0, !dbg !38
- br i1 %icmp, label %if_1, label %else_1, !dbg !38
+ #dbg_declare(ptr %mode1, !46, !DIExpression(), !47)
+ %v.3 = load i64, ptr %mode1, align 8, !dbg !47
+ %icmp = icmp eq i64 %v.3, 0, !dbg !47
+ br i1 %icmp, label %if_1, label %else_1, !dbg !47
else_1: ; preds = %second
- call void @Main__Test(), !dbg !36
- br label %if_1, !dbg !36
+ call void @Main__Test(), !dbg !45
+ br label %if_1, !dbg !45
if_1: ; preds = %else_1, %second
- ret ptr @M_Main, !dbg !36
+ ret ptr @M_Main, !dbg !45
}
-attributes #0 = { uwtable "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
-attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
-
-!llvm.ident = !{!0}
-!llvm.dbg.cu = !{!1}
-!llvm.module.flags = !{!18, !19, !20}
-
-!0 = !{!"versions- cm3: d5.10.0 llvm: 9.0"}
-!1 = distinct !DICompileUnit(language: DW_LANG_Modula3, file: !2, producer: "cm3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !3)
-!2 = !DIFile(filename: "Main.m3", directory: "/home/cm3/settest/src")
-!3 = !{!4}
-!4 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", scope: !5, file: !2, line: 11, size: 8, align: 8, elements: !9)
-!5 = distinct !DISubprogram(name: "Test", linkageName: "Main__Test", scope: !2, file: !2, line: 11, type: !6, scopeLine: 11, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !8)
-!6 = !DISubroutineType(types: !7)
-!7 = !{null}
-!8 = !{}
-!9 = !{!10, !11, !12, !13, !14, !15, !16, !17}
-!10 = !DIEnumerator(name: "alpha", value: 0)
-!11 = !DIEnumerator(name: "beta", value: 1)
-!12 = !DIEnumerator(name: "gamma", value: 2)
-!13 = !DIEnumerator(name: "delta", value: 3)
-!14 = !DIEnumerator(name: "epsilon", value: 4)
-!15 = !DIEnumerator(name: "theta", value: 5)
-!16 = !DIEnumerator(name: "psi", value: 6)
-!17 = !DIEnumerator(name: "zeta", value: 7)
-!18 = !{i64 2, !"Dwarf Version", i64 4}
-!19 = !{i64 2, !"Debug Info Version", i64 3}
-!20 = !{i64 2, !"wchar_size", i64 2}
-!21 = !DILocation(line: 20, scope: !5)
-!22 = !DILocalVariable(name: "as", scope: !5, file: !2, line: 11, type: !23)
-!23 = !DIDerivedType(tag: DW_TAG_set_type, name: "SS", scope: !2, file: !2, line: 11, baseType: !24, size: 64, align: 64)
-!24 = !DIBasicType(name: "SR", size: 8, encoding: DW_ATE_signed)
+attributes #0 = { "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!13, !14, !15, !16, !17}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_Modula3, file: !1, producer: "cm3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
+!1 = !DIFile(filename: "Main.m3", directory: "/home/peter/cm3/settest/src")
+!2 = !{!3}
+!3 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "Enum", scope: !1, file: !1, line: 1, size: 8, align: 8, elements: !4)
+!4 = !{!5, !6, !7, !8, !9, !10, !11, !12}
+!5 = !DIEnumerator(name: "alpha", value: 0)
+!6 = !DIEnumerator(name: "beta", value: 1)
+!7 = !DIEnumerator(name: "gamma", value: 2)
+!8 = !DIEnumerator(name: "delta", value: 3)
+!9 = !DIEnumerator(name: "epsilon", value: 4)
+!10 = !DIEnumerator(name: "theta", value: 5)
+!11 = !DIEnumerator(name: "psi", value: 6)
+!12 = !DIEnumerator(name: "zeta", value: 7)
+!13 = !{i32 2, !"Dwarf Version", i32 4}
+!14 = !{i32 2, !"Debug Info Version", i32 3}
+!15 = !{i32 2, !"wchar_size", i32 2}
+!16 = !{i32 2, !"PIC Level", i32 2}
+!17 = !{i32 2, !"PIE Level", i32 2}
+!18 = distinct !DISubprogram(name: "Test", linkageName: "Main__Test", scope: !1, file: !1, line: 18, type: !19, scopeLine: 18, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !21)
+!19 = !DISubroutineType(types: !20)
+!20 = !{null}
+!21 = !{}
+!22 = !DILocation(line: 30, scope: !18)
+!23 = !DILocalVariable(name: "as", scope: !18, file: !1, line: 19, type: !24)
+!24 = !DIDerivedType(tag: DW_TAG_set_type, name: "SS", scope: !1, file: !1, line: 1, baseType: !25, size: 64, align: 64)
; CHECK: DW_TAG_set_type
; CHECK: DW_AT_type{{.*}}"SR"
; CHECK: DW_AT_name ("SS")
; CHECK: DW_AT_byte_size (0x08)
-!25 = !DILocation(line: 11, scope: !5)
-!26 = !DILocalVariable(name: "bs", scope: !5, file: !2, line: 11, type: !27)
-!27 = !DIDerivedType(tag: DW_TAG_set_type, name: "ST", scope: !2, file: !2, line: 11, baseType: !4, size: 64, align: 64)
+!25 = !DISubrangeType(name: "SR", scope: !1, file: !1, line: 1, size: 8, align: 8, baseType: !26, lowerBound: i64 0, upperBound: i64 55)
+!26 = !DIBasicType(name: "SR_BASE", size: 8, encoding: DW_ATE_signed)
+!27 = !DILocation(line: 18, scope: !18)
+!28 = !DILocalVariable(name: "bs", scope: !18, file: !1, line: 19, type: !29)
+!29 = !DIDerivedType(tag: DW_TAG_set_type, name: "ST", scope: !1, file: !1, line: 1, baseType: !3, size: 8, align: 8)
; CHECK: DW_TAG_set_type
; CHECK: DW_AT_type{{.*}}"Enum"
; CHECK: DW_AT_name ("ST")
-; CHECK: DW_AT_byte_size (0x08)
-!28 = !DILocation(line: 17, scope: !5)
-!29 = !DILocation(line: 18, scope: !5)
-!30 = distinct !DISubprogram(name: "Main_M3", linkageName: "Main_M3", scope: !2, file: !2, line: 22, type: !31, scopeLine: 22, spFlags: DISPFlagDefinition, unit: !1, retainedNodes: !8)
-!31 = !DISubroutineType(types: !32)
-!32 = !{!33, !35}
-!33 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "ADDR", baseType: !34, size: 64, align: 64)
-!34 = !DICompositeType(tag: DW_TAG_class_type, name: "ADDR__HeapObject", scope: !5, file: !2, line: 22, size: 64, align: 64, identifier: "AJWxb1")
-!35 = !DIBasicType(name: "INTEGER", size: 64, encoding: DW_ATE_signed)
-!36 = !DILocation(line: 23, scope: !30)
-!37 = !DILocalVariable(name: "mode", arg: 1, scope: !30, file: !2, line: 22, type: !35)
-!38 = !DILocation(line: 22, scope: !30)
+; CHECK: DW_AT_byte_size (0x01)
+!30 = !DILocalVariable(name: "sc", scope: !18, file: !1, line: 19, type: !31)
+!31 = !DIDerivedType(tag: DW_TAG_set_type, name: "SC", scope: !1, file: !1, line: 1, baseType: !32, size: 256, align: 64)
+; CHECK: DW_TAG_set_type
+; CHECK: DW_AT_type{{.*}}"CHAR"
+; CHECK: DW_AT_name ("SC")
+; CHECK: DW_AT_byte_size (0x20)
+!32 = !DIBasicType(name: "CHAR", size: 8, encoding: DW_ATE_unsigned_char)
+!33 = !DILocalVariable(name: "sb", scope: !18, file: !1, line: 19, type: !34)
+!34 = !DIDerivedType(tag: DW_TAG_set_type, name: "SB", scope: !1, file: !1, line: 1, baseType: !35, size: 8, align: 8)
+!35 = !DIBasicType(name: "BOOLEAN", size: 8, encoding: DW_ATE_boolean)
+!36 = !DILocation(line: 25, scope: !18)
+!37 = !DILocation(line: 26, scope: !18)
+!38 = !DILocation(line: 27, scope: !18)
+!39 = !DILocation(line: 28, scope: !18)
+!40 = distinct !DISubprogram(name: "Main_M3", linkageName: "Main_M3", scope: !1, file: !1, line: 32, type: !41, scopeLine: 32, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !21)
+!41 = !DISubroutineType(types: !42)
+!42 = !{!43, !44}
+!43 = !DICompositeType(tag: DW_TAG_class_type, name: "ADDR", scope: !1, file: !1, line: 1, size: 64, align: 64, elements: !21, identifier: "AJWxb1")
+!44 = !DIBasicType(name: "INTEGER", size: 64, encoding: DW_ATE_signed)
+!45 = !DILocation(line: 33, scope: !40)
+!46 = !DILocalVariable(name: "mode", arg: 1, scope: !40, file: !1, line: 32, type: !44)
+!47 = !DILocation(line: 32, scope: !40)
diff --git a/llvm/test/DebugInfo/debug-bool-const-location.ll b/llvm/test/DebugInfo/debug-bool-const-location.ll
new file mode 100644
index 000000000000..fc986d3688fb
--- /dev/null
+++ b/llvm/test/DebugInfo/debug-bool-const-location.ll
@@ -0,0 +1,38 @@
+; REQUIRES: object-emission
+; RUN: %llc_dwarf %s -filetype=obj -o - | llvm-dwarfdump - | FileCheck %s
+
+; CHECK: {{.*}} DW_TAG_variable
+; CHECK-NEXT: {{.*}} DW_AT_location
+; CHECK-NEXT: {{.*}} DW_OP_lit0
+; CHECK-NEXT: {{.*}} DW_OP_lit1
+; CHECK-NOT: {{.*}} DW_OP_lit0, DW_OP_not
+; CHECK: {{.*}} DW_AT_name ("arg")
+
+define void @foo() !dbg !5
+{
+entry:
+ %arg = alloca i1
+ store i1 false, i1* %arg
+ call void @"llvm.dbg.value"(metadata i1 false , metadata !9, metadata !10), !dbg !6
+ store i1 true, i1* %arg
+ call void @"llvm.dbg.value"(metadata i1 true , metadata !9, metadata !10), !dbg !7
+ ret void, !dbg !8
+}
+
+declare void @"llvm.dbg.value"(metadata %".1", metadata %".2", metadata %".3")
+
+!llvm.dbg.cu = !{ !2 }
+!llvm.module.flags = !{ !11, !12 }
+
+!1 = !DIFile(directory: "", filename: "test")
+!2 = distinct !DICompileUnit(emissionKind: FullDebug, file: !1, isOptimized: false, language: DW_LANG_C_plus_plus, runtimeVersion: 0)
+!3 = !DIBasicType(encoding: DW_ATE_boolean, name: "bool", size: 8)
+!4 = !DISubroutineType(types: !{null})
+!5 = distinct !DISubprogram(file: !1, isDefinition: true, isLocal: false, isOptimized: false, line: 5, linkageName: "foo", name: "foo", scope: !1, scopeLine: 5, type: !4, unit: !2)
+!6 = !DILocation(column: 1, line: 5, scope: !5)
+!7 = !DILocation(column: 1, line: 7, scope: !5)
+!8 = !DILocation(column: 1, line: 8, scope: !5)
+!9 = !DILocalVariable(arg: 0, file: !1, line: 5, name: "arg", scope: !5, type: !3)
+!10 = !DIExpression()
+!11 = !{ i32 2, !"Dwarf Version", i32 4 }
+!12 = !{ i32 2, !"Debug Info Version", i32 3 }