[all-commits] [llvm/llvm-project] 1847fd: [DSE] Fix for a dangling point bug in DeadStoreEli...

Florian Hahn via All-commits all-commits at lists.llvm.org
Thu Dec 5 09:54:20 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1847fd9d85506ecee692230cb2500e3774ec628e
      https://github.com/llvm/llvm-project/commit/1847fd9d85506ecee692230cb2500e3774ec628e
  Author: Ankit <quic_aankit at quicinc.com>
  Date:   2019-12-05 (Thu, 05 Dec 2019)

  Changed paths:
    M llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
    A llvm/test/Transforms/DeadStoreElimination/DeleteThrowableInst.ll

  Log Message:
  -----------
  [DSE] Fix for a dangling point bug in DeadStoreElimination.

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.

Patch by Ankit <quic_aankit at quicinc.com>

Reviewers: fhahn, bcahoon, efriedma

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D65326




More information about the All-commits mailing list