[llvm-commits] CVS: poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Feb 27 14:02:01 PST 2004
Changes in directory poolalloc/lib/PoolAllocate:
TransformFunctionBody.cpp updated: 1.20 -> 1.21
---
Log message:
Don't add null elements to the DSGraphs. Not all globals are in all graphs!
---
Diffs of the changes: (+15 -15)
Index: poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp
diff -u poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.20 poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.21
--- poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.20 Tue Feb 24 16:09:41 2004
+++ poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Fri Feb 27 14:00:19 2004
@@ -398,24 +398,22 @@
if (!isa<Constant>(*AI))
DSGraph::computeNodeMapping(CalleeGraph->getNodeForValue(FAI),
getDSNodeHFor(*AI), NodeMapping, false);
+
//assert(AI == AE && "Varargs calls not handled yet!");
// Map the return value as well...
- if (TheCall->getType() != Type::VoidTy)
+ if (DS::isPointerType(TheCall->getType()))
DSGraph::computeNodeMapping(CalleeGraph->getReturnNodeFor(*CF),
getDSNodeHFor(TheCall), NodeMapping, false);
-#if 1
// Map the nodes that are pointed to by globals.
- // For all globals map getDSNodeForGlobal(g)->CG.getDSNodeForGlobal(g)
- for (DSScalarMap::global_iterator SMI = G.getScalarMap().global_begin(),
- SME = G.getScalarMap().global_end(); SMI != SME; ++SMI) {
- DSGraph::computeNodeMapping(CalleeGraph->getNodeForValue(*SMI),
- G.getNodeForValue(*SMI),
+ DSScalarMap &CalleeSM = CalleeGraph->getScalarMap();
+ for (DSScalarMap::global_iterator GI = G.getScalarMap().global_begin(),
+ E = G.getScalarMap().global_end(); GI != E; ++GI)
+ if (CalleeSM.count(*GI))
+ DSGraph::computeNodeMapping(CalleeGraph->getNodeForValue(*GI),
+ getDSNodeHFor(*GI),
NodeMapping, false);
- }
-#endif
-
// Okay, now that we have established our mapping, we can figure out which
// pool descriptors to pass in...
@@ -459,11 +457,13 @@
SM.erase(CII); // Destroy the CallInst
} else {
// Otherwise update the NewToOldValueMap with the new CI return value
- std::map<Value*,const Value*>::iterator CII =
- FI.NewToOldValueMap.find(TheCall);
- assert(CII != FI.NewToOldValueMap.end() && "CI not found in clone?");
- FI.NewToOldValueMap.insert(std::make_pair(NewCall, CII->second));
- FI.NewToOldValueMap.erase(CII);
+ if (DS::isPointerType(TheCall->getType())) {
+ std::map<Value*,const Value*>::iterator CII =
+ FI.NewToOldValueMap.find(TheCall);
+ assert(CII != FI.NewToOldValueMap.end() && "CI not found in clone?");
+ FI.NewToOldValueMap.insert(std::make_pair(NewCall, CII->second));
+ FI.NewToOldValueMap.erase(CII);
+ }
}
} else if (!FI.NewToOldValueMap.empty()) {
std::map<Value*,const Value*>::iterator II =
More information about the llvm-commits
mailing list