mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
In my recent change to avoid use of underaligned memory I didn't notice that
cpyDest can be mutated in some cases, which would then cause a crash later if indeed the memory was underaligned. This brought down several buildbots, so I guess the underaligned case is much more common than I thought! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165228 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -692,15 +692,15 @@ bool MemCpyOpt::performCallSlotOptzn(Instruction *cpy,
|
||||
bool changedArgument = false;
|
||||
for (unsigned i = 0; i < CS.arg_size(); ++i)
|
||||
if (CS.getArgument(i)->stripPointerCasts() == cpySrc) {
|
||||
if (cpySrc->getType() != cpyDest->getType())
|
||||
cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(),
|
||||
cpyDest->getName(), C);
|
||||
Value *Dest = cpySrc->getType() == cpyDest->getType() ? cpyDest
|
||||
: CastInst::CreatePointerCast(cpyDest, cpySrc->getType(),
|
||||
cpyDest->getName(), C);
|
||||
changedArgument = true;
|
||||
if (CS.getArgument(i)->getType() == cpyDest->getType())
|
||||
CS.setArgument(i, cpyDest);
|
||||
if (CS.getArgument(i)->getType() == Dest->getType())
|
||||
CS.setArgument(i, Dest);
|
||||
else
|
||||
CS.setArgument(i, CastInst::CreatePointerCast(cpyDest,
|
||||
CS.getArgument(i)->getType(), cpyDest->getName(), C));
|
||||
CS.setArgument(i, CastInst::CreatePointerCast(Dest,
|
||||
CS.getArgument(i)->getType(), Dest->getName(), C));
|
||||
}
|
||||
|
||||
if (!changedArgument)
|
||||
|
Reference in New Issue
Block a user