[llvm-commits] [llvm] r81164 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Dan Gohman
gohman at apple.com
Mon Sep 7 15:42:05 PDT 2009
Author: djg
Date: Mon Sep 7 17:42:05 2009
New Revision: 81164
URL: http://llvm.org/viewvc/llvm-project?rev=81164&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=81164&r1=81163&r2=81164&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Mon Sep 7 17:42:05 2009
@@ -2024,6 +2024,11 @@
/// 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.
More information about the llvm-commits
mailing list