[LSR] Replace casts with an equivalent std::as_const (NFC) (#138980)

The casts / `std::as_const` are used here to select `const` overload of
`begin()`/`end()` so that the type of the returned iterator matches the
type of `J`, which is `const_iterator`.
This commit is contained in:
Sergei Barannikov
2025-05-08 13:36:37 +03:00
committed by GitHub
parent 356bd2c960
commit cedeef6707

View File

@@ -3946,10 +3946,8 @@ void LSRInstance::GenerateReassociationsImpl(LSRUse &LU, unsigned LUIdx,
continue;
// Collect all operands except *J.
SmallVector<const SCEV *, 8> InnerAddOps(
((const SmallVector<const SCEV *, 8> &)AddOps).begin(), J);
InnerAddOps.append(std::next(J),
((const SmallVector<const SCEV *, 8> &)AddOps).end());
SmallVector<const SCEV *, 8> InnerAddOps(std::as_const(AddOps).begin(), J);
InnerAddOps.append(std::next(J), std::as_const(AddOps).end());
// Don't leave just a constant behind in a register if the constant could
// be folded into an immediate field.