[PATCH] D105061: [IR] Fix replaceUsesWithIf ponetial issue with constants

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 28 14:43:36 PDT 2021


rampitec added inline comments.


================
Comment at: llvm/lib/IR/Value.cpp:534
 
+  SetVector<Constant*> Consts;
+
----------------
efriedma wrote:
> I think you need a TrackingVH here, instead of a raw pointer.  Suppose you have something like the following:
> 
> ConstantStruct(ConstantStruct(C, C), C)
> 
> Say we replaceUsesWithIf on C.  Calling handleOperandChange on the inner ConstantStruct will invalidate pointers to the outer CostantStruct.  So depending on the use-list order, you might have a dangling pointer.
Like in the updated patch?


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

https://reviews.llvm.org/D105061



More information about the llvm-commits mailing list