[llvm-commits] [poolalloc] r131564 - in /poolalloc/trunk/lib/AssistDS: SimplifyExtractValue.cpp SimplifyInsertValue.cpp
Arushi Aggarwal
aggarwa4 at illinois.edu
Wed May 18 13:32:28 PDT 2011
Author: aggarwa4
Date: Wed May 18 15:32:28 2011
New Revision: 131564
URL: http://llvm.org/viewvc/llvm-project?rev=131564&view=rev
Log:
Added some minor comments.
Modified:
poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp
poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp
Modified: poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp?rev=131564&r1=131563&r2=131564&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyExtractValue.cpp Wed May 18 15:32:28 2011
@@ -122,6 +122,9 @@
continue;
}
if (LoadInst * LI = dyn_cast<LoadInst>(Agg)) {
+ // if the Agg value came from a load instruction
+ // replace the extract value intruction with
+ // a gep and a load.
SmallVector<Value*, 8> Indices;
const Type *Int32Ty = Type::getInt32Ty(M.getContext());
Indices.push_back(Constant::getNullValue(Int32Ty));
@@ -138,7 +141,6 @@
changed = true;
numErased++;
continue;
-
}
if (InsertValueInst *IV = dyn_cast<InsertValueInst>(Agg)) {
bool done = false;
@@ -185,7 +187,6 @@
numErased++;
changed = true;
continue;
-
}
if (exti == exte) {
// The extract list is a prefix of the insert list. i.e. replace
Modified: poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp?rev=131564&r1=131563&r2=131564&view=diff
==============================================================================
--- poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp (original)
+++ poolalloc/trunk/lib/AssistDS/SimplifyInsertValue.cpp Wed May 18 15:32:28 2011
@@ -59,17 +59,20 @@
InsertValueInst *IV = dyn_cast<InsertValueInst>(I++);
if(!IV)
continue;
- //Value *Agg = IV->getAggregateOperand();
+ // Find all insert value instructions.
if(IV->getNumUses() != 1)
continue;
+ // Check that its only use is a StoreInst
StoreInst *SI = dyn_cast<StoreInst>(IV->use_begin());
if(!SI)
continue;
+ // Check that it is the stored value
if(SI->getOperand(0) != IV)
continue;
changed = true;
numErased++;
do {
+ // replace by a series of gep/stores
SmallVector<Value*, 8> Indices;
const Type *Int32Ty = Type::getInt32Ty(M.getContext());
Indices.push_back(Constant::getNullValue(Int32Ty));
@@ -84,7 +87,6 @@
} while(IV);
worklist.push_back(SI);
-
}
}
}
More information about the llvm-commits
mailing list