This patch addresses assertion failure in case when the only found formula for LSR
is 1*reg => reg which was supposed to be an impossible situation, however there
is a test that shows it is possible.
In this case, we can use scale register with scale of 1 as the missing base register.
We will still need to keep this logic unchanged.
BaseRegs could be erased in LSRInstance::GenerateReassociationsImpl(), it's possible to have a non-canonical formula 1*reg, which need to be canonicalized later on.
if (InnerSumSC && SE.getTypeSizeInBits(InnerSumSC->getType()) <= 64 && TTI.isLegalAddImmediate((uint64_t)F.UnfoldedOffset + InnerSumSC->getValue()->getZExtValue())) { F.UnfoldedOffset = (uint64_t)F.UnfoldedOffset + InnerSumSC->getValue()->getZExtValue(); if (IsScaledReg) F.ScaledReg = nullptr; else // This may create a non-canonical formula 1*reg F.BaseRegs.erase(F.BaseRegs.begin() + Idx); } else if (IsScaledReg) F.ScaledReg = InnerSum; else F.BaseRegs[Idx] = InnerSum;