[llvm] ca38652 - [VPlan] Assert no users remaining when deleting a VPValue.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 1 09:45:57 PST 2020


Author: Florian Hahn
Date: 2020-11-01T17:44:53Z
New Revision: ca38652b9a58fc4e15b12e6f3914bfdb124cb6cd

URL: https://github.com/llvm/llvm-project/commit/ca38652b9a58fc4e15b12e6f3914bfdb124cb6cd
DIFF: https://github.com/llvm/llvm-project/commit/ca38652b9a58fc4e15b12e6f3914bfdb124cb6cd.diff

LOG: [VPlan] Assert no users remaining when deleting a VPValue.

When deleting a VPValue, all users must already by deleted. Add an
assertion to make sure and catch violations.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanValue.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index ec8c5bfaae9a..ba9228534a22 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -84,6 +84,10 @@ class VPValue {
   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.


        


More information about the llvm-commits mailing list