[llvm-commits] [poolalloc] r124886 - in /poolalloc/trunk: lib/DSA/Local.cpp test/TEST.dsgraph.Makefile
Arushi Aggarwal
aggarwa4 at illinois.edu
Fri Feb 4 10:18:02 PST 2011
Author: aggarwa4
Date: Fri Feb 4 12:18:01 2011
New Revision: 124886
URL: http://llvm.org/viewvc/llvm-project?rev=124886&view=rev
Log:
Added some code to help do better type inference. It
is disabled by default.
Modified:
poolalloc/trunk/lib/DSA/Local.cpp
poolalloc/trunk/test/TEST.dsgraph.Makefile
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=124886&r1=124885&r2=124886&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Fri Feb 4 12:18:01 2011
@@ -51,6 +51,10 @@
cl::opt<std::string> hasMagicSections("dsa-magic-sections",
cl::desc("File with section to global mapping")); //, cl::ReallyHidden);
+static cl::opt<bool> TypeInferenceOptimize("enable-type-inference-opts",
+ cl::desc("Enable Type Inference Optimizations added to DSA."),
+ cl::Hidden,
+ cl::init(false));
}
namespace {
@@ -355,7 +359,6 @@
void GraphBuilder::visitLoadInst(LoadInst &LI) {
DSNodeHandle Ptr = getValueDest(LI.getOperand(0));
-
if (Ptr.isNull()) return; // Load from null
// Make that the node is read from...
@@ -501,24 +504,28 @@
unsigned Offset = 0;
-#if 0
-
+ if(TypeInferenceOptimize) {
// Trying to special case constant index "inbounds" GEPs
- if(GetElementPtrInst *GEPInst = dyn_cast<GetElementPtrInst>(&GEP)) {
- if(GEPInst->isInBounds())
- if(GEPInst->hasAllConstantIndices()){
- if(GEPInst->getType() == llvm::Type::getInt8PtrTy(GEPInst->getParent()->getParent()->getContext()))
- if(GEPInst->getNumIndices() == 1) {
- Offset = (cast<ConstantInt>(GEPInst->getOperand(1)))->getSExtValue();
- if(Value.getNode()->getSize() <= (Offset+8)) {
- Value.getNode()->growSize(Offset + 8);
+ if(GetElementPtrInst *GEPInst = dyn_cast<GetElementPtrInst>(&GEP)) {
+ if(GEPInst->isInBounds())
+ if(GEPInst->hasAllConstantIndices()){
+ if(GEPInst->getType() == llvm::Type::getInt8PtrTy(GEPInst->getParent()->getParent()->getContext()))
+ if(GEPInst->getNumIndices() == 1) {
+ Offset = (cast<ConstantInt>(GEPInst->getOperand(1)))->getSExtValue();
+ if(Value.getNode()->getSize() <= (Offset+1)) {
+ Value.getNode()->growSize(Offset + 1);
+ }
+ Value.setOffset(Value.getOffset()+Offset);
+ DSNode *N = Value.getNode();
+ if((int)Offset < 0)
+ N->foldNodeCompletely();
+ setDestTo(GEP, Value);
+ return;
}
- goto end;
- }
+ }
}
}
-#endif
// FIXME: I am not sure if the code below is completely correct (especially
// if we start doing fancy analysis on non-constant array indices).
@@ -620,7 +627,6 @@
}
}
-
// Add in the offset calculated...
Value.setOffset(Value.getOffset()+Offset);
Modified: poolalloc/trunk/test/TEST.dsgraph.Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.dsgraph.Makefile?rev=124886&r1=124885&r2=124886&view=diff
==============================================================================
--- poolalloc/trunk/test/TEST.dsgraph.Makefile (original)
+++ poolalloc/trunk/test/TEST.dsgraph.Makefile Fri Feb 4 12:18:01 2011
@@ -27,10 +27,14 @@
ANALYZE_OPTS += -instcount -disable-verify -analyze
MEM := -track-memory -time-passes -disable-output
+#ifdef TYPE_INFERENCE_OPT
+ANALYZE_OPTS += -enable-type-inference-opts
+#endif
+
$(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \
Output/%.$(TEST).report.txt: Output/%.llvm.bc Output/%.LOC.txt $(LOPT)
@# Gather data
- -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.1 2>&1
+ -($(RUNOPT) -dsa-$(PASS) $(ANALYZE_OPTS) $<)> $@.time.1 2>&1
-($(RUNOPT) -dsa-$(PASS) -dsa-stdlib-no-fold $(ANALYZE_OPTS) $<)> $@.time.2 2>&1
-($(RUNOPT) $(MEM) -dsa-$(PASS) -disable-verify -debug-pass=Details $<)> $@.mem.1 2>&1
@# Emit data.
More information about the llvm-commits
mailing list