Skip to content

Commit a0463a8

Browse files
committed
Remove a workaround in the debug info handling of zero-sized types.
This fixes potential LLVM verifier errors in exploded variables with undefined elments, because a few lines below the size of fragments is derived from the size of the LLVM SSA value and the constant used in the deleted workaround is always an i64. rdar://problem/51343998
1 parent d878aed commit a0463a8

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,11 +2193,6 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
21932193
if (Indirection)
21942194
Operands.push_back(llvm::dwarf::DW_OP_deref);
21952195

2196-
// There are variables without storage, such as "struct { func foo() {}
2197-
// }". Emit them as constant 0.
2198-
if (isa<llvm::UndefValue>(Piece))
2199-
Piece = llvm::ConstantInt::get(IGM.Int64Ty, 0);
2200-
22012196
if (IsPiece) {
22022197
// Advance the offset and align it for the next piece.
22032198
OffsetInBits += llvm::alignTo(SizeInBits, AlignInBits);

test/DebugInfo/nostorage.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ struct AStruct {}
2525

2626
// CHECK2: define{{.*}}app
2727
public func app() {
28-
// No members? No storage! Emitted as a constant 0, because.
29-
// CHECK2: call void @llvm.dbg.value(metadata i{{.*}} 0,
28+
// No members? No storage!
29+
// CHECK2: call void @llvm.dbg.value(metadata {{.*}}* undef,
3030
// CHECK2-SAME: metadata ![[AT:.*]], metadata
3131
// CHECK2: ![[AT]] = !DILocalVariable(name: "at",{{.*}}line: [[@LINE+1]]
3232
var at = AStruct()

0 commit comments

Comments
 (0)