[PATCH] D68488: [PATCH 03/27] [noalias] [IR] Introduce ptr_provenance for LoadInst/StoreInst

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 17 23:58:08 PDT 2020


jeroen.dobbelaere marked an inline comment as done.
jeroen.dobbelaere added inline comments.


================
Comment at: llvm/include/llvm/IR/Instructions.h:210
 
+  ~LoadInst() {
+    setLoadInstNumOperands(2); // needed by operator delete
----------------
lebedev.ri wrote:
> Are there `Instruction`/`Value` subclasses already, that define non-trivial destructor?
> I think this may be a problem for bumpptr allocators.
> Are there `Instruction`/`Value` subclasses already, that define non-trivial destructor?
> I think this may be a problem for bumpptr allocators.

How would that interfere ?

The non-trivial destructor is is handled in `Value::deleteValue()`  (https://github.com/llvm/llvm-project/blob/master/llvm/lib/IR/Value.cpp#L123).

I got the base idea by looking at `GlobalVariable` which uses the `OptionalOperandTraits`.
(See https://github.com/llvm/llvm-project/blob/3d65030c45971bf041b7cdeb4b3b1378cadc4abe/llvm/include/llvm/IR/GlobalVariable.h#L73 ; But it seems that in the mean time part of the implementation has moved to `operator delete`)

Of course `GlobalVariable` is a `Constant`, but in retrospect, it seems that an `Instruction` is handled in a similar way.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68488/new/

https://reviews.llvm.org/D68488



More information about the llvm-commits mailing list