[llvm] [VPlan] Verify scalar types in VPlanVerifier. NFCI (PR #122679)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 06:23:32 PST 2025


================
@@ -195,6 +197,9 @@ bool VPlanVerifier::verifyVPBasicBlock(const VPBasicBlock *VPBB) {
       return false;
     }
     for (const VPValue *V : R.definedValues()) {
+      // Verify that recipes' operands have matching types.
+      TypeInfo.inferScalarType(V);
----------------
david-arm wrote:

I guess if the verifier is only ever being called via an assert anyway then this is fine. I was also worried that the compiler may just drop the call to `inferScalarType` because the result is unused. However, it does look like `inferScalarType` is not marked as `const` and it does modify the cache so it should be fine. I guess it doesn't do any harm to add some code to report an error if it returns nullptr, even though we know it won't. :) That at least ensures the code gets executed.

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


More information about the llvm-commits mailing list