diff options
author | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-01-17 12:35:29 +0000 |
---|---|---|
committer | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-01-17 12:35:29 +0000 |
commit | f84dc06e5b4ba4f96fb6ef24b2df848c512f41d6 (patch) | |
tree | ef60cf0b47410ba11641cd6ca9e56c9f3b070dc6 /llvm/lib/Transforms/Scalar | |
parent | e1f273d900b004ac1d1331794079973f8949e78f (diff) | |
download | bcm5719-llvm-f84dc06e5b4ba4f96fb6ef24b2df848c512f41d6.tar.gz bcm5719-llvm-f84dc06e5b4ba4f96fb6ef24b2df848c512f41d6.zip |
Push isDereferenceableAndAlignedPointer down into isSafeToLoadUnconditionally
Reviewed By: reames
Differential Revision: http://reviews.llvm.org/D16226
llvm-svn: 258010
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/SROA.cpp | 11 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 11 |
2 files changed, 6 insertions, 16 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index bf3ec9616f1..dbbc1758b9f 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -1192,8 +1192,7 @@ static bool isSafePHIToSpeculate(PHINode &PN) { // If this pointer is always safe to load, or if we can prove that there // is already a load in the block, then we can move the load to the pred // block. - if (isDereferenceablePointer(InVal, DL) || - isSafeToLoadUnconditionally(InVal, MaxAlign, TI)) + if (isSafeToLoadUnconditionally(InVal, MaxAlign, TI)) continue; return false; @@ -1262,8 +1261,6 @@ static bool isSafeSelectToSpeculate(SelectInst &SI) { Value *TValue = SI.getTrueValue(); Value *FValue = SI.getFalseValue(); const DataLayout &DL = SI.getModule()->getDataLayout(); - bool TDerefable = isDereferenceablePointer(TValue, DL); - bool FDerefable = isDereferenceablePointer(FValue, DL); for (User *U : SI.users()) { LoadInst *LI = dyn_cast<LoadInst>(U); @@ -1273,11 +1270,9 @@ static bool isSafeSelectToSpeculate(SelectInst &SI) { // Both operands to the select need to be dereferencable, either // absolutely (e.g. allocas) or at this point because we can see other // accesses to it. - if (!TDerefable && - !isSafeToLoadUnconditionally(TValue, LI->getAlignment(), LI)) + if (!isSafeToLoadUnconditionally(TValue, LI->getAlignment(), LI)) return false; - if (!FDerefable && - !isSafeToLoadUnconditionally(FValue, LI->getAlignment(), LI)) + if (!isSafeToLoadUnconditionally(FValue, LI->getAlignment(), LI)) return false; } diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index 0fc6953350b..c89c763138f 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1141,8 +1141,6 @@ public: /// the select can be loaded unconditionally. static bool isSafeSelectToSpeculate(SelectInst *SI) { const DataLayout &DL = SI->getModule()->getDataLayout(); - bool TDerefable = isDereferenceablePointer(SI->getTrueValue(), DL); - bool FDerefable = isDereferenceablePointer(SI->getFalseValue(), DL); for (User *U : SI->users()) { LoadInst *LI = dyn_cast<LoadInst>(U); @@ -1150,12 +1148,10 @@ static bool isSafeSelectToSpeculate(SelectInst *SI) { // Both operands to the select need to be dereferencable, either absolutely // (e.g. allocas) or at this point because we can see other accesses to it. - if (!TDerefable && - !isSafeToLoadUnconditionally(SI->getTrueValue(), LI->getAlignment(), + if (!isSafeToLoadUnconditionally(SI->getTrueValue(), LI->getAlignment(), LI)) return false; - if (!FDerefable && - !isSafeToLoadUnconditionally(SI->getFalseValue(), LI->getAlignment(), + if (!isSafeToLoadUnconditionally(SI->getFalseValue(), LI->getAlignment(), LI)) return false; } @@ -1229,8 +1225,7 @@ static bool isSafePHIToSpeculate(PHINode *PN) { // If this pointer is always safe to load, or if we can prove that there is // already a load in the block, then we can move the load to the pred block. - if (isDereferenceablePointer(InVal, DL) || - isSafeToLoadUnconditionally(InVal, MaxAlign, Pred->getTerminator())) + if (isSafeToLoadUnconditionally(InVal, MaxAlign, Pred->getTerminator())) continue; return false; |