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
/// the atomicity/volatility if needed.
struct LoadValue {
Value *Data;
Instruction *Inst;
unsigned Generation;
int MatchingId;
bool IsAtomic;
LoadValue()
: Data(nullptr), Generation(0), MatchingId(-1), IsAtomic(false) {}
LoadValue(Value *Data, unsigned Generation, unsigned MatchingId,
: Inst(nullptr), Generation(0), MatchingId(-1), IsAtomic(false) {}
LoadValue(Instruction *Inst, unsigned Generation, unsigned MatchingId,
bool IsAtomic)
: Data(Data), Generation(Generation), MatchingId(MatchingId),
: Inst(Inst), Generation(Generation), MatchingId(MatchingId),
IsAtomic(IsAtomic) {}
};
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
// generation, replace this instruction.
LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand());
if (InVal.Data != nullptr && InVal.Generation == CurrentGeneration &&
if (InVal.Inst != nullptr && InVal.Generation == CurrentGeneration &&
InVal.MatchingId == MemInst.getMatchingId() &&
// We don't yet handle removing loads with ordering of any kind.
!MemInst.isVolatile() && MemInst.isUnordered() &&
// We can't replace an atomic load with one which isn't also atomic.
InVal.IsAtomic >= MemInst.isAtomic()) {
Value *Op = getOrCreateResult(InVal.Data, Inst->getType());
Value *Op = getOrCreateResult(InVal.Inst, Inst->getType());
if (Op != nullptr) {
DEBUG(dbgs() << "EarlyCSE CSE LOAD: " << *Inst
<< " to: " << *InVal.Data << '\n');
<< " to: " << *InVal.Inst << '\n');
if (!Inst->use_empty())
Inst->replaceAllUsesWith(Op);
Inst->eraseFromParent();
@ -674,8 +674,8 @@ bool EarlyCSE::processNode(DomTreeNode *Node) {
// the store originally was.
if (MemInst.isValid() && MemInst.isStore()) {
LoadValue InVal = AvailableLoads.lookup(MemInst.getPointerOperand());
if (InVal.Data &&
InVal.Data == getOrCreateResult(Inst, InVal.Data->getType()) &&
if (InVal.Inst &&
InVal.Inst == getOrCreateResult(Inst, InVal.Inst->getType()) &&
InVal.Generation == CurrentGeneration &&
InVal.MatchingId == MemInst.getMatchingId() &&
// We don't yet handle removing stores with ordering of any kind.