Index: lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp =================================================================== --- lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp +++ lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp @@ -780,7 +780,8 @@ .addOperand(getLdStRegOp(RtMI)) .addOperand(getLdStRegOp(Rt2MI)) .addOperand(BaseRegOp) - .addImm(OffsetImm); + .addImm(OffsetImm) + .setMemRefs(I->mergeMemRefsWith(*Paired)); } (void)MIB; @@ -1265,6 +1266,7 @@ .addOperand(getLdStRegOp(I)) .addOperand(getLdStBaseOp(I)) .addImm(Value); + MIB->setMemRefs(I->memoperands_begin(), I->memoperands_end()); } else { // Paired instruction. int Scale = getMemScale(I); @@ -1274,6 +1276,7 @@ .addOperand(getLdStRegOp(I, 1)) .addOperand(getLdStBaseOp(I)) .addImm(Value / Scale); + MIB->setMemRefs(I->memoperands_begin(), I->memoperands_end()); } (void)MIB;