[PATCH] D16422: [opaque pointer types] [NFC] FindAvailableLoadedValue: take LoadInst instead of just the pointer.
Eduard Burtescu via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 21 11:21:03 PST 2016
eddyb created this revision.
eddyb added reviewers: mjacob, dblaikie.
eddyb added a subscriber: llvm-commits.
http://reviews.llvm.org/D16422
Files:
include/llvm/Analysis/Loads.h
lib/Analysis/Lint.cpp
lib/Analysis/Loads.cpp
lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
lib/Transforms/Scalar/JumpThreading.cpp
Index: lib/Transforms/Scalar/JumpThreading.cpp
===================================================================
--- lib/Transforms/Scalar/JumpThreading.cpp
+++ lib/Transforms/Scalar/JumpThreading.cpp
@@ -952,7 +952,7 @@
BasicBlock::iterator BBIt(LI);
if (Value *AvailableVal =
- FindAvailableLoadedValue(LoadedPtr, LoadBB, BBIt, DefMaxInstsToScan)) {
+ FindAvailableLoadedValue(LI, LoadBB, BBIt, DefMaxInstsToScan)) {
// If the value of the load is locally available within the block, just use
// it. This frequently occurs for reg2mem'd allocas.
//cerr << "LOAD ELIMINATED:\n" << *BBIt << *LI << "\n";
@@ -994,7 +994,7 @@
// Scan the predecessor to see if the value is available in the pred.
BBIt = PredBB->end();
AAMDNodes ThisAATags;
- Value *PredAvailable = FindAvailableLoadedValue(LoadedPtr, PredBB, BBIt,
+ Value *PredAvailable = FindAvailableLoadedValue(LI, PredBB, BBIt,
DefMaxInstsToScan,
nullptr, &ThisAATags);
if (!PredAvailable) {
Index: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
===================================================================
--- lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
+++ lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
@@ -791,7 +791,7 @@
BasicBlock::iterator BBI(LI);
AAMDNodes AATags;
if (Value *AvailableVal =
- FindAvailableLoadedValue(Op, LI.getParent(), BBI,
+ FindAvailableLoadedValue(&LI, LI.getParent(), BBI,
DefMaxInstsToScan, AA, &AATags)) {
if (LoadInst *NLI = dyn_cast<LoadInst>(AvailableVal)) {
unsigned KnownIDs[] = {
Index: lib/Analysis/Loads.cpp
===================================================================
--- lib/Analysis/Loads.cpp
+++ lib/Analysis/Loads.cpp
@@ -196,14 +196,15 @@
/// If \c AATags is non-null and a load or store is found, the AA tags from the
/// load or store are recorded there. If there are no AA tags or if no access is
/// found, it is left unmodified.
-Value *llvm::FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,
+Value *llvm::FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB,
BasicBlock::iterator &ScanFrom,
unsigned MaxInstsToScan,
AliasAnalysis *AA, AAMDNodes *AATags) {
if (MaxInstsToScan == 0)
MaxInstsToScan = ~0U;
- Type *AccessTy = cast<PointerType>(Ptr->getType())->getElementType();
+ Value *Ptr = Load->getPointerOperand();
+ Type *AccessTy = Load->getType();
const DataLayout &DL = ScanBB->getModule()->getDataLayout();
Index: lib/Analysis/Lint.cpp
===================================================================
--- lib/Analysis/Lint.cpp
+++ lib/Analysis/Lint.cpp
@@ -642,8 +642,7 @@
if (!VisitedBlocks.insert(BB).second)
break;
if (Value *U =
- FindAvailableLoadedValue(L->getPointerOperand(),
- BB, BBI, DefMaxInstsToScan, AA))
+ FindAvailableLoadedValue(L, BB, BBI, DefMaxInstsToScan, AA))
return findValueImpl(U, OffsetOk, Visited);
if (BBI != BB->begin()) break;
BB = BB->getUniquePredecessor();
Index: include/llvm/Analysis/Loads.h
===================================================================
--- include/llvm/Analysis/Loads.h
+++ include/llvm/Analysis/Loads.h
@@ -51,7 +51,7 @@
/// If AATags is non-null and a load or store is found, the AA tags from the
/// load or store are recorded there. If there are no AA tags or if no access
/// is found, it is left unmodified.
-Value *FindAvailableLoadedValue(Value *Ptr, BasicBlock *ScanBB,
+Value *FindAvailableLoadedValue(LoadInst *Load, BasicBlock *ScanBB,
BasicBlock::iterator &ScanFrom,
unsigned MaxInstsToScan = DefMaxInstsToScan,
AliasAnalysis *AA = nullptr,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16422.45572.patch
Type: text/x-patch
Size: 4071 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160121/a0dc3ff1/attachment.bin>
More information about the llvm-commits
mailing list