1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[MemCpyOpt] Avoid double invalidation (NFCI)

The removal of the cpy instruction is left to the caller of
performCallSlotOptzn(), including the invalidation of MD. Both
call-sites already do this.

Also handle incrementation of NumMemCpyInstr consistently at the
call-site. One of the call-site was already doing this, which
ended up incrementing the statistic twice.

This fix was part of D26739.
This commit is contained in:
Nikita Popov 2020-10-02 21:47:03 +02:00
parent 8e7f29d213
commit ce5df66011

View File

@ -953,10 +953,6 @@ bool MemCpyOptPass::performCallSlotOptzn(Instruction *cpy, Value *cpyDest,
LLVMContext::MD_access_group};
combineMetadata(C, cpy, KnownIDs, true);
// Remove the memcpy.
MD->removeInstruction(cpy);
++NumMemCpyInstr;
return true;
}
@ -1272,6 +1268,7 @@ bool MemCpyOptPass::processMemCpy(MemCpyInst *M, BasicBlock::iterator &BBI) {
MD->removeInstruction(M);
M->eraseFromParent();
++NumMemCpyInstr;
return true;
}
}