mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-28 07:05:03 +00:00
Move onlyUsedByLifetimeMarkers to ValueTracking so that it can be used by other
passes as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1baeb006d2
commit
99e0b2a8df
@ -158,6 +158,10 @@ namespace llvm {
|
|||||||
return GetUnderlyingObject(const_cast<Value *>(V), TD, MaxLookup);
|
return GetUnderlyingObject(const_cast<Value *>(V), TD, MaxLookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
|
||||||
|
/// are lifetime markers.
|
||||||
|
bool onlyUsedByLifetimeMarkers(const Value *V);
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1783,3 +1783,19 @@ llvm::GetUnderlyingObject(Value *V, const TargetData *TD, unsigned MaxLookup) {
|
|||||||
}
|
}
|
||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
|
||||||
|
/// are lifetime markers.
|
||||||
|
///
|
||||||
|
bool llvm::onlyUsedByLifetimeMarkers(const Value *V) {
|
||||||
|
for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
|
||||||
|
UI != UE; ++UI) {
|
||||||
|
const IntrinsicInst *II = dyn_cast<IntrinsicInst>(*UI);
|
||||||
|
if (!II) return false;
|
||||||
|
|
||||||
|
if (II->getIntrinsicID() != Intrinsic::lifetime_start &&
|
||||||
|
II->getIntrinsicID() != Intrinsic::lifetime_end)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "llvm/Analysis/DIBuilder.h"
|
#include "llvm/Analysis/DIBuilder.h"
|
||||||
#include "llvm/Analysis/Dominators.h"
|
#include "llvm/Analysis/Dominators.h"
|
||||||
#include "llvm/Analysis/InstructionSimplify.h"
|
#include "llvm/Analysis/InstructionSimplify.h"
|
||||||
|
#include "llvm/Analysis/ValueTracking.h"
|
||||||
#include "llvm/Transforms/Utils/Local.h"
|
#include "llvm/Transforms/Utils/Local.h"
|
||||||
#include "llvm/ADT/DenseMap.h"
|
#include "llvm/ADT/DenseMap.h"
|
||||||
#include "llvm/ADT/SmallPtrSet.h"
|
#include "llvm/ADT/SmallPtrSet.h"
|
||||||
@ -73,22 +74,6 @@ struct DenseMapInfo<std::pair<BasicBlock*, unsigned> > {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// onlyUsedByLifetimeMarkers - Return true if the only users of this pointer
|
|
||||||
/// are lifetime markers.
|
|
||||||
///
|
|
||||||
static bool onlyUsedByLifetimeMarkers(const Value *V) {
|
|
||||||
for (Value::const_use_iterator UI = V->use_begin(), UE = V->use_end();
|
|
||||||
UI != UE; ++UI) {
|
|
||||||
const IntrinsicInst *II = dyn_cast<IntrinsicInst>(*UI);
|
|
||||||
if (!II) return false;
|
|
||||||
|
|
||||||
if (II->getIntrinsicID() != Intrinsic::lifetime_start &&
|
|
||||||
II->getIntrinsicID() != Intrinsic::lifetime_end)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// isAllocaPromotable - Return true if this alloca is legal for promotion.
|
/// isAllocaPromotable - Return true if this alloca is legal for promotion.
|
||||||
/// This is true if there are only loads and stores to the alloca.
|
/// This is true if there are only loads and stores to the alloca.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user