[llvm-commits] [poolalloc] r100141 - /poolalloc/branches/release_26/lib/PoolAllocate/Heuristic.cpp
John Criswell
criswell at uiuc.edu
Thu Apr 1 14:59:06 PDT 2010
Author: criswell
Date: Thu Apr 1 16:59:06 2010
New Revision: 100141
URL: http://llvm.org/viewvc/llvm-project?rev=100141&view=rev
Log:
Updated the code to handle the fact that DSNode::getType() can return NULL.
Updated the code to the new LLVM API: we need to use ConstantPointerNull::get()
to get null pointer constants.
Modified:
poolalloc/branches/release_26/lib/PoolAllocate/Heuristic.cpp
Modified: poolalloc/branches/release_26/lib/PoolAllocate/Heuristic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/branches/release_26/lib/PoolAllocate/Heuristic.cpp?rev=100141&r1=100140&r2=100141&view=diff
==============================================================================
--- poolalloc/branches/release_26/lib/PoolAllocate/Heuristic.cpp (original)
+++ poolalloc/branches/release_26/lib/PoolAllocate/Heuristic.cpp Thu Apr 1 16:59:06 2010
@@ -122,8 +122,14 @@
///
unsigned Heuristic::getRecommendedAlignment(const DSNode *N) {
const Type * VoidType = Type::getVoidTy(getGlobalContext());
- if (N->getType() == VoidType) // Is this void or collapsed?
- return 0; // No known alignment, let runtime decide.
+
+ //
+ // If this node has a void type (which can be signified by getType()
+ // returning NULL) or the node is collapsed, then there is no known
+ // alignment. We will return 0 to let the runtime decide.
+ //
+ if ((!(N->getType())) || (N->getType() == VoidType))
+ return 0;
const TargetData &TD = N->getParentGraph()->getTargetData();
@@ -454,7 +460,7 @@
if (!NullGlobal) {
Module *M = I->getParent()->getParent()->getParent();
const Type * PoolTy = PoolAllocate::PoolDescPtrTy;
- Constant * Init = ConstantAggregateZero::get(PoolTy);
+ Constant * Init = ConstantPointerNull::get(cast<PointerType>(PoolTy));
NullGlobal = new GlobalVariable(*M,
PoolAllocate::PoolDescPtrTy, false,
GlobalValue::ExternalLinkage,
More information about the llvm-commits
mailing list