summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Loads.cpp
diff options
context:
space:
mode:
authorAnna Thomas <anna@azul.com>2016-07-08 22:15:08 +0000
committerAnna Thomas <anna@azul.com>2016-07-08 22:15:08 +0000
commit9ad45adfd76a17d4631f491e5ad33cb1e312c256 (patch)
treebb5783324abf760bf28ec8ca7c09c77eef223e1d /llvm/lib/Analysis/Loads.cpp
parentbe6092deecc55d98290f9afbcd2f14ec77ece875 (diff)
downloadbcm5719-llvm-9ad45adfd76a17d4631f491e5ad33cb1e312c256.tar.gz
bcm5719-llvm-9ad45adfd76a17d4631f491e5ad33cb1e312c256.zip
Revert "InstCombine rule to fold truncs whose value is available"
This reverts commit r274853. Caused failure in ppcBE build llvm-svn: 274943
Diffstat (limited to 'llvm/lib/Analysis/Loads.cpp')
-rw-r--r--llvm/lib/Analysis/Loads.cpp43
1 files changed, 16 insertions, 27 deletions
diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp
index 1a2f8e76c87..309a1d95efb 100644
--- a/llvm/lib/Analysis/Loads.cpp
+++ b/llvm/lib/Analysis/Loads.cpp
@@ -297,17 +297,27 @@ llvm::DefMaxInstsToScan("available-load-scan-limit", cl::init(6), cl::Hidden,
"to scan backward from a given instruction, when searching for "
"available loaded value"));
-
-Value *llvm::FindAvailableLoadedValue(Value *Ptr, Type *AccessTy,
- bool IsAtomicMemOp, BasicBlock *ScanBB,
+Value *llvm::FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB,
BasicBlock::iterator &ScanFrom,
unsigned MaxInstsToScan,
AliasAnalysis *AA, AAMDNodes *AATags,
bool *IsLoadCSE) {
-
if (MaxInstsToScan == 0)
MaxInstsToScan = ~0U;
+
+ Value *Ptr = Load->getPointerOperand();
+ Type *AccessTy = Load->getType();
+
+ // We can never remove a volatile load
+ if (Load->isVolatile())
+ return nullptr;
+
+ // Anything stronger than unordered is currently unimplemented.
+ if (!Load->isUnordered())
+ return nullptr;
+
const DataLayout &DL = ScanBB->getModule()->getDataLayout();
+
// Try to get the store size for the type.
uint64_t AccessSize = DL.getTypeStoreSize(AccessTy);
@@ -338,7 +348,7 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, Type *AccessTy,
// We can value forward from an atomic to a non-atomic, but not the
// other way around.
- if (LI->isAtomic() < IsAtomicMemOp)
+ if (LI->isAtomic() < Load->isAtomic())
return nullptr;
if (AATags)
@@ -359,7 +369,7 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, Type *AccessTy,
// We can value forward from an atomic to a non-atomic, but not the
// other way around.
- if (SI->isAtomic() < IsAtomicMemOp)
+ if (SI->isAtomic() < Load->isAtomic())
return nullptr;
if (AATags)
@@ -403,24 +413,3 @@ Value *llvm::FindAvailableLoadedValue(Value *Ptr, Type *AccessTy,
// block.
return nullptr;
}
-
-
-Value *llvm::FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB,
- BasicBlock::iterator &ScanFrom,
- unsigned MaxInstsToScan,
- AliasAnalysis *AA, AAMDNodes *AATags,
- bool *IsLoadCSE) {
-
- // We can never remove a volatile load
- if (Load->isVolatile())
- return nullptr;
-
- // Anything stronger than unordered is currently unimplemented.
- if (!Load->isUnordered())
- return nullptr;
-
- // Return the full value of the load if available.
- return FindAvailableLoadedValue(Load->getPointerOperand(), Load->getType(),
- Load->isAtomic(), ScanBB, ScanFrom,
- MaxInstsToScan, AA, AATags, IsLoadCSE);
-}
OpenPOWER on IntegriCloud