[PATCH] D90328: Eliminates dead store of an exisiting value
Daniel McCrevan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 16:51:24 PST 2020
dmccrevan added a comment.
So I tried to build the `check-llvm-transforms-deadstoreelimination` target, but it seems that 4 tests are failing:
********************
********************
Failed Tests (4):
LLVM :: Transforms/DeadStoreElimination/MSSA/multiblock-loops.ll
LLVM :: Transforms/DeadStoreElimination/MSSA/multiblock-memoryphis.ll
LLVM :: Transforms/DeadStoreElimination/MSSA/multiblock-simple.ll
LLVM :: Transforms/DeadStoreElimination/MSSA/simple.ll
I am not too sure how to interpret the test results, but I am attaching a file to this comment with the build output.
I also have my current implementation below incase you want to comment on anything you see to have issues
/// Eliminates writes to variables where the value that is being written
/// is already stored in the variable
bool eliminateDeadStoresOfExisitingValues() {
bool MadeChange = false;
LLVM_DEBUG(dbgs() << "Trying to eliminate MemoryDefs that write the "
"already exisiting value\n");
for (int I = MemDefs.size() - 1; I >= 0; I--) {
MemoryDef *Def = MemDefs[I];
if (SkipStores.find(Def) != SkipStores.end() ||
!isRemovable(Def->getMemoryInst()))
continue;
MemoryAccess *DefAccess = dyn_cast<MemoryAccess>(Def);
if (!DefAccess || isa<MemoryPhi>(DefAccess))
continue;
Instruction *DefInst = cast<MemoryUseOrDef>(DefAccess)->getMemoryInst();
if (!DefInst)
continue;
for (auto UI = DefAccess->use_begin(), IE = DefAccess->use_end();
UI != IE;) {
MemoryAccess *UseAccess = cast<MemoryAccess>((UI++)->getUser());
if (MemoryDef *UseDef = dyn_cast_or_null<MemoryDef>(UseAccess)) {
Instruction *UseInst = UseDef->getMemoryInst();
if (!UseInst)
continue;
if (UseInst->isIdenticalTo(DefInst)) {
deleteDeadInstruction(UseInst);
MadeChange = true;
}
}
}
}
return MadeChange;
}
F14485702: buildoutput.txt <https://reviews.llvm.org/F14485702>
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90328/new/
https://reviews.llvm.org/D90328
More information about the llvm-commits
mailing list