[llvm] Apply the `AdjustICmpImmAndPred` optimization when it results in a one-instruction immediate materialization over a two-instruction materialization. (PR #83218)

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 23:27:52 PDT 2024


================
@@ -658,9 +659,12 @@ tryAdjustICmpImmAndPred(Register RHS, CmpInst::Predicate P,
   // predicate if it is.
   if (Size == 32)
     C = static_cast<uint32_t>(C);
-  if (!isLegalArithImmed(C))
-    return std::nullopt;
-  return {{C, P}};
+  if (isLegalArithImmed(C))
+    return {{C, P}};
+  if (AArch64_AM::isLogicalImmediate(C, Size) &&
+      !AArch64_AM::isLogicalImmediate(OriginalC, Size))
----------------
ornata wrote:

ping on this comment? @resistor

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


More information about the llvm-commits mailing list