@@ -378,8 +378,8 @@ Instruction *MemCpyOptPass::tryMergingIntoMemset(Instruction *StartInst,
378
378
// after MemInsertPoint.
379
379
MemoryUseOrDef *MemInsertPoint = nullptr ;
380
380
for (++BI; !BI->isTerminator (); ++BI) {
381
- auto *CurrentAcc = cast_or_null<MemoryUseOrDef>(
382
- MSSAU-> getMemorySSA () ->getMemoryAccess (&*BI));
381
+ auto *CurrentAcc =
382
+ cast_or_null<MemoryUseOrDef>(MSSA ->getMemoryAccess (&*BI));
383
383
if (CurrentAcc)
384
384
MemInsertPoint = CurrentAcc;
385
385
@@ -605,13 +605,13 @@ bool MemCpyOptPass::moveUp(StoreInst *SI, Instruction *P, const LoadInst *LI) {
605
605
// TODO: Simplify this once P will be determined by MSSA, in which case the
606
606
// discrepancy can no longer occur.
607
607
MemoryUseOrDef *MemInsertPoint = nullptr ;
608
- if (MemoryUseOrDef *MA = MSSAU-> getMemorySSA () ->getMemoryAccess (P)) {
608
+ if (MemoryUseOrDef *MA = MSSA ->getMemoryAccess (P)) {
609
609
MemInsertPoint = cast<MemoryUseOrDef>(--MA->getIterator ());
610
610
} else {
611
611
const Instruction *ConstP = P;
612
612
for (const Instruction &I : make_range (++ConstP->getReverseIterator (),
613
613
++LI->getReverseIterator ())) {
614
- if (MemoryUseOrDef *MA = MSSAU-> getMemorySSA () ->getMemoryAccess (&I)) {
614
+ if (MemoryUseOrDef *MA = MSSA ->getMemoryAccess (&I)) {
615
615
MemInsertPoint = MA;
616
616
break ;
617
617
}
@@ -623,7 +623,7 @@ bool MemCpyOptPass::moveUp(StoreInst *SI, Instruction *P, const LoadInst *LI) {
623
623
LLVM_DEBUG (dbgs () << " Lifting " << *I << " before " << *P << " \n " );
624
624
I->moveBefore (P);
625
625
assert (MemInsertPoint && " Must have found insert point" );
626
- if (MemoryUseOrDef *MA = MSSAU-> getMemorySSA () ->getMemoryAccess (I)) {
626
+ if (MemoryUseOrDef *MA = MSSA ->getMemoryAccess (I)) {
627
627
MSSAU->moveAfter (MA, MemInsertPoint);
628
628
MemInsertPoint = MA;
629
629
}
@@ -697,8 +697,7 @@ bool MemCpyOptPass::processStoreOfLoad(StoreInst *SI, LoadInst *LI,
697
697
LLVM_DEBUG (dbgs () << " Promoting " << *LI << " to " << *SI << " => " << *M
698
698
<< " \n " );
699
699
700
- auto *LastDef =
701
- cast<MemoryDef>(MSSAU->getMemorySSA ()->getMemoryAccess (SI));
700
+ auto *LastDef = cast<MemoryDef>(MSSA->getMemoryAccess (SI));
702
701
auto *NewAccess = MSSAU->createMemoryAccessAfter (M, nullptr , LastDef);
703
702
MSSAU->insertDef (cast<MemoryDef>(NewAccess), /* RenameUses=*/ true );
704
703
@@ -1258,8 +1257,8 @@ bool MemCpyOptPass::processMemCpyMemCpyDependence(MemCpyInst *M,
1258
1257
CopySourceAlign, M->getLength (), M->isVolatile ());
1259
1258
NewM->copyMetadata (*M, LLVMContext::MD_DIAssignID);
1260
1259
1261
- assert (isa<MemoryDef>(MSSAU-> getMemorySSA () ->getMemoryAccess (M)));
1262
- auto *LastDef = cast<MemoryDef>(MSSAU-> getMemorySSA () ->getMemoryAccess (M));
1260
+ assert (isa<MemoryDef>(MSSA ->getMemoryAccess (M)));
1261
+ auto *LastDef = cast<MemoryDef>(MSSA ->getMemoryAccess (M));
1263
1262
auto *NewAccess = MSSAU->createMemoryAccessAfter (NewM, nullptr , LastDef);
1264
1263
MSSAU->insertDef (cast<MemoryDef>(NewAccess), /* RenameUses=*/ true );
1265
1264
@@ -1369,12 +1368,11 @@ bool MemCpyOptPass::processMemSetMemCpyDependence(MemCpyInst *MemCpy,
1369
1368
Builder.CreateMemSet (Builder.CreatePtrAdd (Dest, SrcSize),
1370
1369
MemSet->getOperand (1 ), MemsetLen, Alignment);
1371
1370
1372
- assert (isa<MemoryDef>(MSSAU-> getMemorySSA () ->getMemoryAccess (MemCpy)) &&
1371
+ assert (isa<MemoryDef>(MSSA ->getMemoryAccess (MemCpy)) &&
1373
1372
" MemCpy must be a MemoryDef" );
1374
1373
// The new memset is inserted before the memcpy, and it is known that the
1375
1374
// memcpy's defining access is the memset about to be removed.
1376
- auto *LastDef =
1377
- cast<MemoryDef>(MSSAU->getMemorySSA ()->getMemoryAccess (MemCpy));
1375
+ auto *LastDef = cast<MemoryDef>(MSSA->getMemoryAccess (MemCpy));
1378
1376
auto *NewAccess =
1379
1377
MSSAU->createMemoryAccessBefore (NewMemSet, nullptr , LastDef);
1380
1378
MSSAU->insertDef (cast<MemoryDef>(NewAccess), /* RenameUses=*/ true );
@@ -1479,8 +1477,7 @@ bool MemCpyOptPass::performMemCpyToMemSetOptzn(MemCpyInst *MemCpy,
1479
1477
Instruction *NewM =
1480
1478
Builder.CreateMemSet (MemCpy->getRawDest (), MemSet->getOperand (1 ),
1481
1479
CopySize, MemCpy->getDestAlign ());
1482
- auto *LastDef =
1483
- cast<MemoryDef>(MSSAU->getMemorySSA ()->getMemoryAccess (MemCpy));
1480
+ auto *LastDef = cast<MemoryDef>(MSSA->getMemoryAccess (MemCpy));
1484
1481
auto *NewAccess = MSSAU->createMemoryAccessAfter (NewM, nullptr , LastDef);
1485
1482
MSSAU->insertDef (cast<MemoryDef>(NewAccess), /* RenameUses=*/ true );
1486
1483
0 commit comments