Consider the following pattern: ``` C = op A B D = op C E = op D, C ``` As `E` is dead, we call `eraseInstruction(E)` and see if its operands become dead. `RecursivelyDeleteTriviallyDeadInstructions(D)` also erases `C`, which causes a UAF crash in the subsequent call `RecursivelyDeleteTriviallyDeadInstructions(C)`. This patch also adds deleted ops into the visit list to avoid double deletion. Closes https://github.com/llvm/llvm-project/issues/155543.