[llvm] [RISCV][DAG][TLI] Avoid scalarizing length decreasing shuffles (PR #115532)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 25 09:01:04 PST 2024
================
@@ -545,6 +545,11 @@ class TargetLoweringBase {
return DefinedValues < 3;
}
+ // In SDAG construction, should length decreasing shuffles be expanded
+ // to a sequence of extracts and inserts if they can't be recognized
+ // via the two extracted operand form?
+ virtual bool shouldScalarizeLengthDecreasingShuffle() const { return true; }
----------------
preames wrote:
> Do something unconditionally and fix it up in a combiner if preferred, like anything else.
I agree this is the goal. My hope was that once this initial step is in, we'd move the scalarization into a DAG combine. It's a bit tricky because of the difference between a one time and iterative decision. The other direction we can approach this is to unconditional scalarize, but I would argue that the simpler IR should be the initial canonical form.
> Failing that, at minimum a TLI hook needs some kind of context if it's not going to be a simple bool field
Are you saying you'd rather see this be a boolean field on TargetLoweringBase to avoid the virtual dispatch? If so, I'm happy to make that change. I'm just not clear on what you're asking for.
I'll also note that I was thinking ahead to the next piece I mentioned previously, and that a profitability hook for the scalarization in DAG will almost certainly require a type based hook.
https://github.com/llvm/llvm-project/pull/115532
More information about the llvm-commits
mailing list