[Debugify] Handled unsized types

llvm-svn: 321918
This commit is contained in:
Vedant Kumar 2018-01-06 00:37:01 +00:00
parent 740b9e13ef
commit 0941370e24
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
; RUN: opt -S -argpromotion < %s | FileCheck %s
; RUN: opt -S -passes=argpromotion < %s | FileCheck %s
; RUN: opt -S -debugify -o /dev/null < %s
target triple = "x86_64-pc-windows-msvc"
define internal void @callee(i8*) {

View File

@ -47,7 +47,8 @@ bool applyDebugifyMetadata(Module &M) {
// Get a DIType which corresponds to Ty.
DenseMap<uint64_t, DIType *> TypeCache;
auto getCachedDIType = [&](Type *Ty) -> DIType * {
uint64_t Size = M.getDataLayout().getTypeAllocSizeInBits(Ty);
uint64_t Size =
Ty->isSized() ? M.getDataLayout().getTypeAllocSizeInBits(Ty) : 0;
DIType *&DTy = TypeCache[Size];
if (!DTy) {
std::string Name = "ty" + utostr(Size);