[llvm-commits] [llvm] r65711 - /llvm/trunk/lib/VMCore/AsmWriter.cpp

Chris Lattner sabre at nondot.org
Sat Feb 28 12:28:50 PST 2009


Author: lattner
Date: Sat Feb 28 14:28:50 2009
New Revision: 65711

URL: http://llvm.org/viewvc/llvm-project?rev=65711&view=rev
Log:
simplify condition

Modified:
    llvm/trunk/lib/VMCore/AsmWriter.cpp

Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65711&r1=65710&r2=65711&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 14:28:50 2009
@@ -168,15 +168,18 @@
   const TypeSymbolTable &ST = M->getTypeSymbolTable();
   for (TypeSymbolTable::const_iterator TI = ST.begin(), E = ST.end();
        TI != E; ++TI) {
+    const Type *Ty = cast<Type>(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<Type>(TI->second);
-    if (!isa<PointerType>(Ty) ||
-        !cast<PointerType>(Ty)->getElementType()->isPrimitiveType() ||
-        !cast<PointerType>(Ty)->getElementType()->isInteger() ||
-        isa<OpaqueType>(cast<PointerType>(Ty)->getElementType()))
-      TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first)));
+    if (const PointerType *PTy = dyn_cast<PointerType>(Ty)) {
+      const Type *PETy = PTy->getElementType();
+      if ((PETy->isPrimitiveType() || PETy->isInteger()) &&
+          !isa<OpaqueType>(PETy))
+        continue;
+    }
+    
+    TypeNames.insert(std::make_pair(Ty, '%' + getLLVMName(TI->first)));
   }
 }
 





More information about the llvm-commits mailing list