diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-11-18 06:26:49 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-11-18 06:26:49 +0000 |
| commit | f183d5c4bea6a96da6573ade7ee123a359019bd1 (patch) | |
| tree | af604b3547d727ef21d3b7f431c0fcddb4c0b0f8 /llvm/lib | |
| parent | 7aeae25c78197800a931d56a10cad062a7711a46 (diff) | |
| download | bcm5719-llvm-f183d5c4bea6a96da6573ade7ee123a359019bd1.tar.gz bcm5719-llvm-f183d5c4bea6a96da6573ade7ee123a359019bd1.zip | |
enhance the "alloca is just a memcpy from constant global"
to ignore calls that obviously can't modify the alloca
because they are readonly/readnone.
llvm-svn: 119683
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 6f4f17e20fb..fe40bcc22d5 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -34,6 +34,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/PromoteMemToReg.h" #include "llvm/Transforms/Utils/Local.h" +#include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/GetElementPtrTypeIterator.h" @@ -1810,6 +1811,12 @@ static bool isOnlyCopiedFromConstantGlobal(Value *V, MemTransferInst *&TheCopy, continue; } + // If this is a readonly/readnone call site, then we know it is just a load + // and we can ignore it. + if (CallSite CS = U) + if (CS.onlyReadsMemory()) + continue; + // If this is isn't our memcpy/memmove, reject it as something we can't // handle. MemTransferInst *MI = dyn_cast<MemTransferInst>(U); |

