[llvm] r321918 - [Debugify] Handled unsized types

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 16:37:01 PST 2018


Author: vedantk
Date: Fri Jan  5 16:37:01 2018
New Revision: 321918

URL: http://llvm.org/viewvc/llvm-project?rev=321918&view=rev
Log:
[Debugify] Handled unsized types

Modified:
    llvm/trunk/test/Transforms/ArgumentPromotion/pr27568.ll
    llvm/trunk/tools/opt/Debugify.cpp

Modified: llvm/trunk/test/Transforms/ArgumentPromotion/pr27568.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ArgumentPromotion/pr27568.ll?rev=321918&r1=321917&r2=321918&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ArgumentPromotion/pr27568.ll (original)
+++ llvm/trunk/test/Transforms/ArgumentPromotion/pr27568.ll Fri Jan  5 16:37:01 2018
@@ -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*) {

Modified: llvm/trunk/tools/opt/Debugify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Debugify.cpp?rev=321918&r1=321917&r2=321918&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Debugify.cpp (original)
+++ llvm/trunk/tools/opt/Debugify.cpp Fri Jan  5 16:37:01 2018
@@ -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);




More information about the llvm-commits mailing list