[llvm] [AArch64] Sink vscale calls into loops for better isel (PR #70304)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 26 03:17:51 PDT 2023


================
@@ -14623,12 +14636,29 @@ bool AArch64TargetLowering::shouldSinkOperands(
     }
   }
 
-  if (!I->getType()->isVectorTy())
-    return false;
-
   switch (I->getOpcode()) {
   case Instruction::Sub:
   case Instruction::Add: {
+    // If the subtarget wants to make use of sve inc* instructions, then sink
+    // vscale intrinsic (along with any shifts or multiplies) so that the
+    // appropriate folds can be made.
+    if (Subtarget->useScalarIncVL()) {
+      bool Sink = false;
+      if (shouldSinkVScale(I->getOperand(0), Ops)) {
----------------
paulwalker-arm wrote:

Is there a use case for lowering the first operand of a subtract? Is there a vscale equivalent of subf? I guess there could be other reasons to lower this but that just backs up my first comment that perhaps we shouldn't be guarding the lowering with useScalarIncVL.

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


More information about the llvm-commits mailing list