[llvm] [VPlan] Add initial anlysis to infer scalar type of VPValues. (PR #69013)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 05:34:18 PDT 2023


================
@@ -738,7 +739,19 @@ void VPWidenRecipe::execute(VPTransformState &State) {
                       << Instruction::getOpcodeName(Opcode));
     llvm_unreachable("Unhandled instruction!");
   } // end of switch.
+
+#if !defined(NDEBUG)
+  // Verify that VPlan type inference results agree with the type of the
+  // generated values.
+  VPTypeAnalysis A(State.Builder.GetInsertBlock()->getContext());
----------------
ayalz wrote:

Caching types is unhelpful and even harmful time-wise if a VPTypeAnalysis is built for every call of inferScalarType().
For validation here it may be fine, but better avoid having it as the only usage example. Worth building one instance to be used across VPlan execution, possibly stored in State?

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


More information about the llvm-commits mailing list