diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-03 03:46:34 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-03 03:46:34 +0000 |
commit | e0e32a9ef06188c1aa4bfd10097d2b7b589ec982 (patch) | |
tree | 594a21e276d049f25ff57f782afc0ec81ee7942b /llvm/lib/Transforms/Scalar/EarlyCSE.cpp | |
parent | 92bb0f9f9d9819bf638128f6f8c7a8ad479ea79e (diff) | |
download | bcm5719-llvm-e0e32a9ef06188c1aa4bfd10097d2b7b589ec982.tar.gz bcm5719-llvm-e0e32a9ef06188c1aa4bfd10097d2b7b589ec982.zip |
now that loads are in their own table, we can implement
store->load forwarding. This allows EarlyCSE to zap 600 more
loads from 176.gcc.
llvm-svn: 122732
Diffstat (limited to 'llvm/lib/Transforms/Scalar/EarlyCSE.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index a899640d0ad..06c1b911118 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -380,8 +380,19 @@ bool EarlyCSE::processNode(DomTreeNode *Node) { // Okay, this isn't something we can CSE at all. Check to see if it is // something that could modify memory. If so, our available memory values // cannot be used so bump the generation count. - if (Inst->mayWriteToMemory()) + if (Inst->mayWriteToMemory()) { ++CurrentGeneration; + + // Okay, we just invalidated anything we knew about loaded values. Try to + // salvage *something* by remembering that the stored value is a live + // version of the pointer. It is safe to forward from volatile stores to + // non-volatile loads, so we don't have to check for volatility of the + // store. + if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { + AvailableLoads->insert(SI->getPointerOperand(), + std::pair<Value*, unsigned>(SI->getValueOperand(), CurrentGeneration)); + } + } } unsigned LiveOutGeneration = CurrentGeneration; |