[VPlan] Assert no users remaining when deleting a VPValue.
authorFlorian Hahn <flo@fhahn.com>
Sat, 3 Oct 2020 20:05:39 +0000 (21:05 +0100)
committerFlorian Hahn <flo@fhahn.com>
Sun, 1 Nov 2020 17:44:53 +0000 (17:44 +0000)
When deleting a VPValue, all users must already by deleted. Add an
assertion to make sure and catch violations.

llvm/lib/Transforms/Vectorize/VPlanValue.h

index ec8c5bf..ba92285 100644 (file)
@@ -84,6 +84,10 @@ public:
   VPValue(const VPValue &) = delete;
   VPValue &operator=(const VPValue &) = delete;
 
+  virtual ~VPValue() {
+    assert(Users.empty() && "trying to delete a VPValue with remaining users");
+  }
+
   /// \return an ID for the concrete type of this object.
   /// This is used to implement the classof checks. This should not be used
   /// for any other purpose, as the values may change as LLVM evolves.