[PATCH] D65326: Fix for a dangling point bug in DeadStoreElimination pass

Ankit via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 06:04:02 PST 2019


quic_aankit marked an inline comment as done.
quic_aankit added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp:155
+  // Pop dead entries from back of ThrowableInst till we find an alive entry.
+  for (auto It = ThrowableInst.rbegin();
+       It != ThrowableInst.rend() && !It->second; ++It) {
----------------
fhahn wrote:
> Shouldn't we increment `It` early, as we remove the element `It` refers to? It does not seem to cause any issue, but FWIW, it seems that for SPEC and the test-suite, we always do at most 1 iteration of the loop.
I don't think that incrementing `It` after removing the element pointed by it should be an issue as we are not accessing the element in between. In the latest patch I've incremented `It` before removing the element.


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

https://reviews.llvm.org/D65326





More information about the llvm-commits mailing list