[all-commits] [llvm/llvm-project] 369a91: Fix for a dangling point bug in DeadStoreEliminati...

Florian Hahn via All-commits all-commits at lists.llvm.org
Fri Jan 3 06:29:20 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 369a919514403196dcff7b6bdfa0668dcc733fee
      https://github.com/llvm/llvm-project/commit/369a919514403196dcff7b6bdfa0668dcc733fee
  Author: Ankit <quic_aankit at quicinc.com>
  Date:   2020-01-03 (Fri, 03 Jan 2020)

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

  Log Message:
  -----------
  Fix for a dangling point bug in DeadStoreElimination pass

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.

Reviewers: fhahn, bcahoon, efriedma

Reviewed By: fhahn

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




More information about the All-commits mailing list