[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)) {
+ Ops.push_back(&I->getOperandUse(0));
+ Sink = true;
----------------
paulwalker-arm wrote:
Can you just `return true` here? The only use case for `Sink` is when both operands are `vscale` related, and I'd expect such logic to be folded away. If you do this I recommend checking the second operand first given that's going to be the most common case.
https://github.com/llvm/llvm-project/pull/70304
More information about the llvm-commits
mailing list