[llvm] [LSR] Recognize vscale-relative immediates (PR #88124)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 08:35:01 PDT 2024
================
@@ -4004,27 +4160,29 @@ void LSRInstance::GenerateICmpZeroScales(LSRUse &LU, unsigned LUIdx,
if (!ConstantInt::isValueValidForType(IntTy, Factor))
continue;
// Check that the multiplication doesn't overflow.
- if (Base.BaseOffset == std::numeric_limits<int64_t>::min() && Factor == -1)
+ if (Base.BaseOffset.isMin() && Factor == -1)
continue;
- int64_t NewBaseOffset = (uint64_t)Base.BaseOffset * Factor;
+ Immediate NewBaseOffset =
+ Immediate::getFixed((uint64_t)Base.BaseOffset.getFixedValue() * Factor);
assert(Factor != 0 && "Zero factor not expected!");
- if (NewBaseOffset / Factor != Base.BaseOffset)
+ if (NewBaseOffset.getFixedValue() / Factor !=
+ Base.BaseOffset.getFixedValue())
continue;
// If the offset will be truncated at this use, check that it is in bounds.
if (!IntTy->isPointerTy() &&
- !ConstantInt::isValueValidForType(IntTy, NewBaseOffset))
+ !ConstantInt::isValueValidForType(IntTy, NewBaseOffset.getFixedValue()))
continue;
// Check that multiplying with the use offset doesn't overflow.
- int64_t Offset = LU.MinOffset;
- if (Offset == std::numeric_limits<int64_t>::min() && Factor == -1)
+ Immediate Offset = LU.MinOffset;
+ if (Offset.isMin() && Factor == -1)
continue;
- Offset = (uint64_t)Offset * Factor;
- if (Offset / Factor != LU.MinOffset)
+ Offset = Immediate::getFixed((uint64_t)Offset.getFixedValue() * Factor);
+ if (Offset.getFixedValue() / Factor != LU.MinOffset.getFixedValue())
----------------
huntergr-arm wrote:
Fixed specific, it's generating terms for ICmpZero uses (for which we won't have any legal scalable offsets)
https://github.com/llvm/llvm-project/pull/88124
More information about the llvm-commits
mailing list