aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/IR/Verifier.cpp2
-rw-r--r--llvm/test/DebugInfo/X86/set.ll2
-rw-r--r--llvm/test/Transforms/LoopVectorize/dbg.value.ll4
-rw-r--r--llvm/test/Verifier/dicompositetype-elements-null.ll6
4 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 7b6f7b5..00280db 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1319,6 +1319,8 @@ void Verifier::visitDICompositeType(const DICompositeType &N) {
unsigned DIBlockByRefStruct = 1 << 4;
CheckDI((N.getFlags() & DIBlockByRefStruct) == 0,
"DIBlockByRefStruct on DICompositeType is no longer supported", &N);
+ CheckDI(llvm::all_of(N.getElements(), [](const DINode *N) { return N; }),
+ "DISubprogram contains null entry in `elements` field", &N);
if (N.isVector()) {
const DINodeArray Elements = N.getElements();
diff --git a/llvm/test/DebugInfo/X86/set.ll b/llvm/test/DebugInfo/X86/set.ll
index 292c7c6..85ad1af 100644
--- a/llvm/test/DebugInfo/X86/set.ll
+++ b/llvm/test/DebugInfo/X86/set.ll
@@ -109,7 +109,7 @@ attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
!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, elements: !7, identifier: "AJWxb1")
+!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)
diff --git a/llvm/test/Transforms/LoopVectorize/dbg.value.ll b/llvm/test/Transforms/LoopVectorize/dbg.value.ll
index 16d6f8b..19ef3ccf7 100644
--- a/llvm/test/Transforms/LoopVectorize/dbg.value.ll
+++ b/llvm/test/Transforms/LoopVectorize/dbg.value.ll
@@ -51,10 +51,8 @@ attributes #1 = { nounwind readnone }
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = !DIGlobalVariable(name: "A", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
!2 = !DIFile(filename: "test", directory: "/path/to/somewhere")
-!3 = !DICompositeType(tag: DW_TAG_array_type, baseType: !4, size: 32768, align: 32, elements: !5)
+!3 = !DICompositeType(tag: DW_TAG_array_type, baseType: !4, size: 32768, align: 32)
!4 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
-!5 = !{!6}
-!6 = !{i32 786465, i64 0, i64 1024}
!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression())
!8 = !DIGlobalVariable(name: "B", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
diff --git a/llvm/test/Verifier/dicompositetype-elements-null.ll b/llvm/test/Verifier/dicompositetype-elements-null.ll
new file mode 100644
index 0000000..c0aca47
--- /dev/null
+++ b/llvm/test/Verifier/dicompositetype-elements-null.ll
@@ -0,0 +1,6 @@
+; RUN: not opt -S < %s 2>&1 | FileCheck %s
+
+!named = !{!0}
+; CHECK: DISubprogram contains null entry in `elements` field
+!0 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", elements: !1)
+!1 = !{null}