[PATCH] D32571: InferAddressSpaces: Search constant expressions for addrspacecasts

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 13:02:46 PDT 2017


arsenm added inline comments.


================
Comment at: lib/Transforms/Scalar/InferAddressSpaces.cpp:843
+  for (const WeakVH &WVH : Postorder) {
+    assert(WVH && "value was unexpectedly deleted");
+    Value *V = WVH;
----------------
arsenm wrote:
> jlebar wrote:
> > If we expect that the Value*s won't be deleted while in this vector, why are we using WeakVH at all?  Are we trying to catch use-after-frees?
> > 
> > At least the choice to use WeakVH could use a comment somewhere, but if it's just fear of use-after-free's, is there some reason that this code is particularly dangerous as compared to other parts of LLVM, where we rely on asan/msan to catch this issue?
> It's possible to make it work without WeakVH, but it fails to handle more cases. The RAUW used for the handling of constants needs to be tracked
Earlier versions of the patch were more complicated and attempted to recursively handle all of the constants up front, but it ended up much more complicated than to just add WeakVH here.


https://reviews.llvm.org/D32571





More information about the llvm-commits mailing list