aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/Sink.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-11 16:21:47 +0000
committerDan Gohman <gohman@apple.com>2010-11-11 16:21:47 +0000
commit5aae3dcb53b89344d598eee7e1021dce7ec6345c (patch)
tree35c110b9311c64ac16cd3b628f23faae0fe1d17e /lib/Transforms/Scalar/Sink.cpp
parent2c71f18ff7f5e1504ffeff85f643314e84e6e5d9 (diff)
Make Sink tbaa-aware.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/Sink.cpp')
-rw-r--r--lib/Transforms/Scalar/Sink.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/Sink.cpp b/lib/Transforms/Scalar/Sink.cpp
index d6f1e93a81..a54ba8e0ae 100644
--- a/lib/Transforms/Scalar/Sink.cpp
+++ b/lib/Transforms/Scalar/Sink.cpp
@@ -15,6 +15,7 @@
#define DEBUG_TYPE "sink"
#include "llvm/Transforms/Scalar.h"
#include "llvm/IntrinsicInst.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -158,9 +159,11 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis *AA,
Value *Ptr = L->getPointerOperand();
uint64_t Size = AA->getTypeStoreSize(L->getType());
+ const MDNode *TBAAInfo = L->getMetadata(LLVMContext::MD_tbaa);
+ AliasAnalysis::Location Loc(Ptr, Size, TBAAInfo);
for (SmallPtrSet<Instruction *, 8>::iterator I = Stores.begin(),
E = Stores.end(); I != E; ++I)
- if (AA->getModRefInfo(*I, Ptr, Size) & AliasAnalysis::Mod)
+ if (AA->getModRefInfo(*I, Loc) & AliasAnalysis::Mod)
return false;
}