OSDN Git Service

[Debugify] Handled unsized types
authorVedant Kumar <vsk@apple.com>
Sat, 6 Jan 2018 00:37:01 +0000 (00:37 +0000)
committerVedant Kumar <vsk@apple.com>
Sat, 6 Jan 2018 00:37:01 +0000 (00:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321918 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/ArgumentPromotion/pr27568.ll
tools/opt/Debugify.cpp

index 1496780..711a71f 100644 (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*) {
index 40ee545..89e5724 100644 (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);