Skip to content

Commit 42043c4

Browse files
committed
Reapply "Verifier: Add check for DICompositeType elements being null"
This remove some erroneous debug info from tests that should address the test failures that showed up when the this was previously committed. This reverts commit 6716ce8.
1 parent 9324e6a commit 42043c4

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,8 @@ void Verifier::visitDICompositeType(const DICompositeType &N) {
13191319
unsigned DIBlockByRefStruct = 1 << 4;
13201320
CheckDI((N.getFlags() & DIBlockByRefStruct) == 0,
13211321
"DIBlockByRefStruct on DICompositeType is no longer supported", &N);
1322+
CheckDI(llvm::all_of(N.getElements(), [](const DINode *N) { return N; }),
1323+
"DISubprogram contains null entry in `elements` field", &N);
13221324

13231325
if (N.isVector()) {
13241326
const DINodeArray Elements = N.getElements();

llvm/test/DebugInfo/X86/set.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
109109
!31 = !DISubroutineType(types: !32)
110110
!32 = !{!33, !35}
111111
!33 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "ADDR", baseType: !34, size: 64, align: 64)
112-
!34 = !DICompositeType(tag: DW_TAG_class_type, name: "ADDR__HeapObject", scope: !5, file: !2, line: 22, size: 64, align: 64, elements: !7, identifier: "AJWxb1")
112+
!34 = !DICompositeType(tag: DW_TAG_class_type, name: "ADDR__HeapObject", scope: !5, file: !2, line: 22, size: 64, align: 64, identifier: "AJWxb1")
113113
!35 = !DIBasicType(name: "INTEGER", size: 64, encoding: DW_ATE_signed)
114114
!36 = !DILocation(line: 23, scope: !30)
115115
!37 = !DILocalVariable(name: "mode", arg: 1, scope: !30, file: !2, line: 22, type: !35)

llvm/test/Transforms/LoopVectorize/dbg.value.ll

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ attributes #1 = { nounwind readnone }
5151
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
5252
!1 = !DIGlobalVariable(name: "A", scope: null, file: !2, line: 1, type: !3, isLocal: false, isDefinition: true)
5353
!2 = !DIFile(filename: "test", directory: "/path/to/somewhere")
54-
!3 = !DICompositeType(tag: DW_TAG_array_type, baseType: !4, size: 32768, align: 32, elements: !5)
54+
!3 = !DICompositeType(tag: DW_TAG_array_type, baseType: !4, size: 32768, align: 32)
5555
!4 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
56-
!5 = !{!6}
57-
!6 = !{i32 786465, i64 0, i64 1024}
5856
!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression())
5957
!8 = !DIGlobalVariable(name: "B", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
6058
!9 = !DIGlobalVariableExpression(var: !10, expr: !DIExpression())
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
; RUN: not opt -S < %s 2>&1 | FileCheck %s
2+
3+
!named = !{!0}
4+
; CHECK: DISubprogram contains null entry in `elements` field
5+
!0 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "t1", elements: !1)
6+
!1 = !{null}

0 commit comments

Comments
 (0)