1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[EarlyCSE] Change LoadValue field Value *Data to Instruction *Inst. NFC.

Made in preparation for adding MemorySSA support to EarlyCSE.

llvm-svn: 267893
This commit is contained in:
Geoff Berry 2016-04-28 15:22:37 +00:00
parent f69f881341
commit 7a46345c15

View File

@ -279,15 +279,15 @@ public:
/// present the table; it is the responsibility of the consumer to inspect /// present the table; it is the responsibility of the consumer to inspect
/// the atomicity/volatility if needed. /// the atomicity/volatility if needed.
struct LoadValue { struct LoadValue {
Value *Data; Instruction *Inst;
unsigned Generation; unsigned Generation;
int MatchingId; int MatchingId;
bool IsAtomic; bool IsAtomic;
LoadValue() LoadValue()
: Data(nullptr), Generation(0), MatchingId(-1), IsAtomic(false) {} : Inst(nullptr), Generation(0), MatchingId(-1), IsAtomic(false) {}
LoadValue(Value *Data, unsigned Generation, unsigned MatchingId, LoadValue(Instruction *Inst, unsigned Generation, unsigned MatchingId,
bool IsAtomic) bool IsAtomic)
: Data(Data), Generation(Generation), MatchingId(MatchingId), : Inst(Inst), Generation(Generation), MatchingId(MatchingId),
IsAtomic(IsAtomic) {} IsAtomic(IsAtomic) {}
}; };
typedef RecyclingAllocator<BumpPtrAllocator, typedef RecyclingAllocator<BumpPtrAllocator,
@ -597,16 +597,16 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
// If we have an available version of this load, and if it is the right // If we have an available version of this load, and if it is the right
// generation, replace this instruction. // generation, replace this instruction.
LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand()); LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand());
if (InVal.Data != nullptr && InVal.Generation == CurrentGeneration && if (InVal.Inst != nullptr && InVal.Generation == CurrentGeneration &&
InVal.MatchingId == MemInst.getMatchingId() && InVal.MatchingId == MemInst.getMatchingId() &&
// We don't yet handle removing loads with ordering of any kind. // We don't yet handle removing loads with ordering of any kind.
!MemInst.isVolatile() && MemInst.isUnordered() && !MemInst.isVolatile() && MemInst.isUnordered() &&
// We can't replace an atomic load with one which isn't also atomic. // We can't replace an atomic load with one which isn't also atomic.
InVal.IsAtomic >= MemInst.isAtomic()) { InVal.IsAtomic >= MemInst.isAtomic()) {
Value *Op = getOrCreateResult(InVal.Data, Inst->getType()); Value *Op = getOrCreateResult(InVal.Inst, Inst->getType());
if (Op != nullptr) { if (Op != nullptr) {
DEBUG(dbgs() << "EarlyCSE CSE LOAD: " << *Inst DEBUG(dbgs() << "EarlyCSE CSE LOAD: " << *Inst
<< " to: " << *InVal.Data << '\n'); << " to: " << *InVal.Inst << '\n');
if (!Inst->use_empty()) if (!Inst->use_empty())
Inst->replaceAllUsesWith(Op); Inst->replaceAllUsesWith(Op);
Inst->eraseFromParent(); Inst->eraseFromParent();
@ -674,8 +674,8 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
// the store originally was. // the store originally was.
if (MemInst.isValid() && MemInst.isStore()) { if (MemInst.isValid() && MemInst.isStore()) {
LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand()); LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand());
if (InVal.Data && if (InVal.Inst &&
InVal.Data == getOrCreateResult(Inst, InVal.Data->getType()) && InVal.Inst == getOrCreateResult(Inst, InVal.Inst->getType()) &&
InVal.Generation == CurrentGeneration && InVal.Generation == CurrentGeneration &&
InVal.MatchingId == MemInst.getMatchingId() && InVal.MatchingId == MemInst.getMatchingId() &&
// We don't yet handle removing stores with ordering of any kind. // We don't yet handle removing stores with ordering of any kind.