diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2013-05-08 09:00:10 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2013-05-08 09:00:10 +0000 |
commit | 5fb1963f2aba9bc41103c063b50a048fd0e46b6f (patch) | |
tree | c18cce378f54db0e8548db0d67597f7a48a6b8fc /llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp | |
parent | bb5a17e8fa18d5f0b97015b9d22bf3d5dc50fbf0 (diff) | |
download | bcm5719-llvm-5fb1963f2aba9bc41103c063b50a048fd0e46b6f.tar.gz bcm5719-llvm-5fb1963f2aba9bc41103c063b50a048fd0e46b6f.zip |
Fix a bug in codegenprep where it was losing track of values OptimizeMemoryInst
by switching to a ValueMap. Patch by Andrea DiBiagio!
llvm-svn: 181397
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp index 615c5174492..f0d29c88a82 100644 --- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/ValueMap.h" #include "llvm/Analysis/DominatorInternals.h" #include "llvm/Analysis/Dominators.h" #include "llvm/Analysis/InstructionSimplify.h" @@ -88,7 +89,7 @@ namespace { /// Keeps track of non-local addresses that have been sunk into a block. /// This allows us to avoid inserting duplicate code for blocks with /// multiple load/stores of the same address. - DenseMap<Value*, Value*> SunkAddrs; + ValueMap<Value*, Value*> SunkAddrs; /// ModifiedDT - If CFG is modified in anyway, dominator tree may need to /// be updated. @@ -1653,10 +1654,6 @@ bool CodeGenPrepare::OptimizeMemoryInst(Instruction *MemoryInst, Value *Addr, // start of the block. CurInstIterator = BB->begin(); SunkAddrs.clear(); - } else { - // This address is now available for reassignment, so erase the table - // entry; we don't want to match some completely different instruction. - SunkAddrs[Addr] = 0; } } ++NumMemoryInsts; |