[PATCH] D28749: Fix use-after-free bug in AffectedValueCallbackVH::allUsesReplacedWith

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 16 06:58:19 PST 2017


hfinkel marked an inline comment as done.
hfinkel added a comment.

In https://reviews.llvm.org/D28749#646897, @sanjoy wrote:

> The code lgtm, but
>
> - Can you easily test this using a C++ unit test?  I'll settle for something that normally runs "fine", but trips asan if the build is using asan.


I'll experiment with this today and commit one in follow-up. I might also be able to create an IR test case for instcombine if things work out just right.

> - `getAffectedValues` should be renamed to `getOrInsertAffectedValues`.

Sure.



================
Comment at: lib/Analysis/AssumptionCache.cpp:121
+  for (auto &A : AVI->second)
+    if (std::find(NAVV.begin(), NAVV.end(), A) == NAVV.end())
+      NAVV.push_back(A);
----------------
sanjoy wrote:
> Can you use `llvm::find` here (in a later change)?
Yes, I think so. I'd forgotten about that.


https://reviews.llvm.org/D28749





More information about the llvm-commits mailing list