diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-07 22:42:05 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-07 22:42:05 +0000 |
commit | ce5de5b52768d0c3b9c0f6c4bc915a17e962202c (patch) | |
tree | 0b7f71c8564051fb4ed5f647f653b13a03a1ff69 | |
parent | c62482d4edecd416e6529e31427fa6fd8a9b7ece (diff) | |
download | external_llvm-ce5de5b52768d0c3b9c0f6c4bc915a17e962202c.zip external_llvm-ce5de5b52768d0c3b9c0f6c4bc915a17e962202c.tar.gz external_llvm-ce5de5b52768d0c3b9c0f6c4bc915a17e962202c.tar.bz2 |
Don't commit addresses of aggregate values. This avoids problems with
an aggregate store overlapping a different aggregate store, despite
the stores having distinct addresses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81164 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 71eeb75..86c5e29 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2024,6 +2024,11 @@ static Constant *getVal(DenseMap<Value*, Constant*> &ComputedValues, /// we punt. We basically just support direct accesses to globals and GEP's of /// globals. This should be kept up to date with CommitValueTo. static bool isSimpleEnoughPointerToCommit(Constant *C, LLVMContext &Context) { + // Conservatively, avoid aggregate types. This is because we don't + // want to worry about them partially overlapping other stores. + if (!cast<PointerType>(C->getType())->getElementType()->isSingleValueType()) + return false; + if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) // Do not allow weak/linkonce/dllimport/dllexport linkage or // external globals. |