[DAGCombiner] `visitFREEZE()`: gracefully handle node invalidation
authorHanSheng Zhang <admin@mayuyu.io>
Fri, 13 Jan 2023 18:45:37 +0000 (21:45 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 13 Jan 2023 18:53:29 +0000 (21:53 +0300)
commit95414345d54ea714aceafb125541555ece31e876
tree0f6f05a510ea35b39216a15608b8820936a64288
parent5ffa8c401968be7eb950a3ed186dff2e7ce1ab9e
[DAGCombiner] `visitFREEZE()`: gracefully handle node invalidation

When we freeze operands of an operation that we are trying to freeze,
doing so may invalidate the original SDValue. We should just re-fetch
it from the ISD::FREEZE node, because if we bail, we'd hopefully just
revisit the node and do that again.

Fixes https://github.com/llvm/llvm-project/issues/59891

Differential Revision: https://reviews.llvm.org/D141256
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/pr59891-dagcombine-deleted-freeze.ll [new file with mode: 0644]