Hans Wennborg
2009-Nov-04 14:33 UTC
[LLVMdev] DeadStoreElimination: do better without TargetData
The attached patch makes DeadStoreElimination able to remove stores in store-store dependencies when the operand types are equal, even if there is no TargetData available. / Hans -------------- next part -------------- A non-text attachment was scrubbed... Name: DeadStoreElimination.patch Type: text/x-patch Size: 812 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091104/2056b524/attachment.bin>
Hans Wennborg
2009-Nov-04 15:21 UTC
[LLVMdev] DeadStoreElimination: do better without TargetData
Re-posting with better-looking code. Hans Wennborg wrote:> The attached patch makes DeadStoreElimination able to remove stores in > store-store dependencies when the operand types are equal, even if there > is no TargetData available. > > / Hans > > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev-------------- next part -------------- A non-text attachment was scrubbed... Name: DeadStoreElimination2.patch Type: text/x-patch Size: 1303 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091104/51fa87bf/attachment.bin>
Chris Lattner
2009-Nov-04 16:32 UTC
[LLVMdev] DeadStoreElimination: do better without TargetData
On Nov 4, 2009, at 7:21 AM, Hans Wennborg wrote:> Re-posting with better-looking code.Thanks, do you have a testcase showing what this does? -Chris> > Hans Wennborg wrote: >> The attached patch makes DeadStoreElimination able to remove stores >> in store-store dependencies when the operand types are equal, even >> if there is no TargetData available. >> / Hans >> ------------------------------------------------------------------------ >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > Index: lib/Transforms/Scalar/DeadStoreElimination.cpp > ==================================================================> --- lib/Transforms/Scalar/DeadStoreElimination.cpp (revision 86023) > +++ lib/Transforms/Scalar/DeadStoreElimination.cpp (working copy) > @@ -117,10 +117,12 @@ > > // If this is a store-store dependence, then the previous store > is dead so > // long as this store is at least as big as it. > - if (StoreInst *DepStore = dyn_cast<StoreInst>(InstDep.getInst())) > - if (TD && > - TD->getTypeStoreSize(DepStore->getOperand(0)->getType()) <> - TD->getTypeStoreSize(SI->getOperand(0)->getType())) { > + if (StoreInst *DepStore = dyn_cast<StoreInst>(InstDep.getInst > ())) { > + const Type *DepType = DepStore->getOperand(0)->getType(); > + const Type *SIType = SI->getOperand(0)->getType(); > + if (DepType == SIType || > + (TD && > + TD->getTypeStoreSize(DepType) <= TD->getTypeStoreSize > (SIType))) { > // Delete the store and now-dead instructions that feed it. > DeleteDeadInstruction(DepStore); > NumFastStores++; > @@ -133,6 +135,7 @@ > --BBI; > continue; > } > + } > > // If we're storing the same value back to a pointer that we just > // loaded from, then the store can be removed. > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Maybe Matching Threads
- [LLVMdev] DeadStoreElimination: do better without TargetData
- [LLVMdev] DeadStoreElimination: do better without TargetData
- [LLVMdev] DeadStoreElimination: do better without TargetData
- Help for DeadStoreElimination cross-block dependence
- [LLVMdev] DeadStoreElimination: do better without TargetData