Currently in some cases FP_EXTEND lowering for SVE fixed types can
introduce EXTRACT_SUBVECTOR nodes between purely fixed types. Lowering
these is less than ideal as it may involve going through memory.
Instead, we can push an extra extend into a load feeding the FP_EXTEND,
so as to ensure the load gets split into the same number of components
as the FP_EXTEND. The extra truncate required to do this can then be
combined with an extend that is introduced during FP_EXTEND lowering.
The net result of this is that the extends produced by the FP_EXTEND
lowering are folded into an extending load, and requirement for
EXTRACT_SUBVECTOR nodes is removed.
DAGCombiner::visitFP_EXTEND tries to do something similar, but unfortunately it is a bit too conservative. Look for:
It seems logical to reuse that code, rather than reimplementing the same thing here. Perhaps you can use something like isVectorLoadExtDesirable instead of isLoadExtLegal to determine whether to fold this.