From: Chris Lattner Date: Sat, 28 Feb 2009 20:28:50 +0000 (+0000) Subject: simplify condition X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=88344e63d4bd98a3c9a82cf84b73cd28ecef46a1;p=oota-llvm.git simplify condition git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65711 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index c59bc0e164a..d07ff8f4fc7 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -168,15 +168,18 @@ TypePrinting::TypePrinting(const Module *M, raw_ostream &os) : OS(os) { const TypeSymbolTable &ST = M->getTypeSymbolTable(); for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end(); TI != E; ++TI) { + const Type *Ty = cast(TI->second); + // As a heuristic, don't insert pointer to primitive types, because // they are used too often to have a single useful name. - // - const Type *Ty = cast(TI->second); - if (!isa(Ty) || - !cast(Ty)->getElementType()->isPrimitiveType() || - !cast(Ty)->getElementType()->isInteger() || - isa(cast(Ty)->getElementType())) - TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); + if (const PointerType *PTy = dyn_cast(Ty)) { + const Type *PETy = PTy->getElementType(); + if ((PETy->isPrimitiveType() || PETy->isInteger()) && + !isa(PETy)) + continue; + } + + TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first))); } }