[llvm-commits] [poolalloc] r130868 - in /poolalloc/trunk: include/dsa/DSNode.h lib/DSA/Local.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Wed May 4 14:20:18 PDT 2011
Author: aggarwa4
Date: Wed May 4 16:20:18 2011
New Revision: 130868
URL: http://llvm.org/viewvc/llvm-project?rev=130868&view=rev
Log:
Allow PtrToInt and IntToPtr values to be used
locally for compares, without setting those flags.
This should help improve type safety for some
subset of the program in SAFECode
Modified:
poolalloc/trunk/include/dsa/DSNode.h
poolalloc/trunk/lib/DSA/Local.cpp
Modified: poolalloc/trunk/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=130868&r1=130867&r2=130868&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSNode.h (original)
+++ poolalloc/trunk/include/dsa/DSNode.h Wed May 4 16:20:18 2011
@@ -103,8 +103,11 @@
ArrayNode = 1 << 9, // This node is treated like an array
CollapsedNode = 1 << 10, // This node is collapsed
ExternalNode = 1 << 11, // This node comes from an external source
- IntToPtrNode = 1 << 12, // This node comes from an int cast
- PtrToIntNode = 1 << 13, // This node escapes to an int cast
+ IntToPtrNode = 1 << 12, // This node comes from an int cast
+ // and is used in pointer operations
+ // like geps, loads, stores
+ PtrToIntNode = 1 << 13, // This node escapes to an int cast
+ // and DSA does not track it further.
VAStartNode = 1 << 14, // This node is from a vastart call
//#ifndef NDEBUG
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=130868&r1=130867&r2=130868&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Wed May 4 16:20:18 2011
@@ -433,12 +433,10 @@
void GraphBuilder::visitIntToPtrInst(IntToPtrInst &I) {
DSNode *N = createNode();
- if(TypeInferenceOptimize) {
- if(I.getNumUses() == 1) {
- if(isa<ICmpInst>(I.use_begin())) {
- NumBoringIntToPtr++;
- return;
- }
+ if(I.getNumUses() == 1) {
+ if(isa<ICmpInst>(I.use_begin())) {
+ NumBoringIntToPtr++;
+ return;
}
} else {
N->setIntToPtrMarker();
@@ -449,30 +447,26 @@
void GraphBuilder::visitPtrToIntInst(PtrToIntInst& I) {
DSNode* N = getValueDest(I.getOperand(0)).getNode();
- if(TypeInferenceOptimize) {
- if(I.getNumUses() == 1) {
- if(isa<ICmpInst>(I.use_begin())) {
- NumBoringIntToPtr++;
- return;
- }
+ if(I.getNumUses() == 1) {
+ if(isa<ICmpInst>(I.use_begin())) {
+ NumBoringIntToPtr++;
+ return;
}
}
- if(TypeInferenceOptimize) {
- if(I.getNumUses() == 1) {
- Value *V = dyn_cast<Value>(I.use_begin());
- while(V && V->getNumUses() == 1) {
- if(isa<LoadInst>(V))
- break;
- if(isa<StoreInst>(V))
- break;
- if(isa<CallInst>(V))
- break;
- V = dyn_cast<Value>(V->use_begin());
- }
- if(isa<BranchInst>(V)){
- NumBoringIntToPtr++;
- return;
- }
+ if(I.getNumUses() == 1) {
+ Value *V = dyn_cast<Value>(I.use_begin());
+ while(V && V->getNumUses() == 1) {
+ if(isa<LoadInst>(V))
+ break;
+ if(isa<StoreInst>(V))
+ break;
+ if(isa<CallInst>(V))
+ break;
+ V = dyn_cast<Value>(V->use_begin());
+ }
+ if(isa<BranchInst>(V)){
+ NumBoringIntToPtr++;
+ return;
}
}
if(N)
More information about the llvm-commits
mailing list