[llvm] [LV] Move check if any vector insts will be generated to VPlan. (PR #96622)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 6 14:40:26 PDT 2024
================
@@ -4795,9 +4783,98 @@ static void emitInvalidCostRemarks(SmallVector<InstructionVFPair> InvalidCosts,
} while (!Tail.empty());
}
+/// Check if any recipe of \p Plan will generate a vector value, which will be
+/// assigned a vector register.
+static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
+ const TargetTransformInfo &TTI) {
+ assert(VF.isVector() && "Checking a scalar VF?");
+ VPTypeAnalysis TypeInfo(Plan.getCanonicalIV()->getScalarType(),
+ Plan.getCanonicalIV()->getScalarType()->getContext());
+ DenseMap<Type *, bool> GeneratesVector;
+ for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+ vp_depth_first_shallow(Plan.getVectorLoopRegion()->getEntry()))) {
+ for (VPRecipeBase &R : *VPBB) {
+ // Continue early if the recipe is considered to not produce a vector
+ // result. Note that this includes VPInstruction, where some opcodes may
+ // produce a vector to preserve existing behavior originally as
----------------
ayalz wrote:
```suggestion
// result. Note that this includes VPInstruction where some opcodes may
// produce a vector, to preserve existing behavior as
```
https://github.com/llvm/llvm-project/pull/96622
More information about the llvm-commits
mailing list