[llvm] [LSR] Recognize vscale-relative immediates (PR #88124)

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 05:08:34 PDT 2024


================
@@ -1698,47 +1786,53 @@ static bool isAMCompletelyFolded(const TargetTransformInfo &TTI,
 
     // If we have low-level target information, ask the target if it can fold an
     // integer immediate on an icmp.
-    if (BaseOffset != 0) {
+    if (BaseOffset.isNonZero()) {
       // We have one of:
       // ICmpZero     BaseReg + BaseOffset => ICmp BaseReg, -BaseOffset
       // ICmpZero -1*ScaleReg + BaseOffset => ICmp ScaleReg, BaseOffset
       // Offs is the ICmp immediate.
       if (Scale == 0)
         // The cast does the right thing with
         // std::numeric_limits<int64_t>::min().
-        BaseOffset = -(uint64_t)BaseOffset;
-      return TTI.isLegalICmpImmediate(BaseOffset);
+        BaseOffset = BaseOffset.getFixed((uint64_t)BaseOffset.getFixedValue());
----------------
SamTebbs33 wrote:

Looks like this removes the negation of the offset. Does that still have the same semantics?

https://github.com/llvm/llvm-project/pull/88124


More information about the llvm-commits mailing list