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

Ankit via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 03:38:04 PDT 2019


quic_aankit created this revision.
quic_aankit added reviewers: fhahn, bcahoon.
quic_aankit added a project: LLVM.
Herald added a subscriber: hiraditya.

The patch makes sure that the LastThrowing pointer does not point to any instruction deleted by call to DeleteDeadInstruction.

While iterating through the instructions the pass maintains a pointer to the lastThrowing Instruction. A call to deleteDeadInstruction deletes a dead store and other instructions feeding the original dead instruction which also become dead. The instruction pointed by the lastThrowing pointer could also be deleted by the call to DeleteDeadInstruction and thus it becomes a dangling pointer. Because of this, we see an error in the next iteration.

In the patch, we maintain a list of throwing instructions encountered previously and use the last non deleted throwing instruction from the container.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D65326

Files:
  llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
  llvm/test/Transforms/DeadStoreElimination/DeleteThrowableInst.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65326.211903.patch
Type: text/x-patch
Size: 8712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190726/768bcc88/attachment.bin>


More information about the llvm-commits mailing list