[PATCH] D81159: CodeGenPrep: remove AssertingVH references before deleting dead instructions.

Tim Northover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 4 07:04:11 PDT 2020


t.p.northover created this revision.
Herald added subscribers: hiraditya, mcrosier.
Herald added a project: LLVM.

CodeGenPrepare keeps fairly close track of various instructions it's seen, particularly GEPs, in maps and vectors. However, sometimes those instructions become dead and get removed while it's still executing. This triggers AssertingVH references to them in an asserts build and could lead to miscompiles in a release build (I've only seen a later segfault though).

So this patch adds a callback to `RecursivelyDeleteTriviallyDeadInstructions` which can make sure the instruction about to be deleted is removed from CodeGenPrepare's data structures.

Surprised this took so long to actually happen TBH.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81159

Files:
  llvm/include/llvm/Transforms/Utils/Local.h
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/Transforms/CodeGenPrepare/ARM/dead-gep.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81159.268452.patch
Type: text/x-patch
Size: 9405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200604/a29a7c14/attachment.bin>


More information about the llvm-commits mailing list