reland: [DAG] Fix PR45049: LegalizeTypes crash
authorJonathan Roelofs <jroelofs@jroelofs.com>
Sat, 28 Mar 2020 18:55:51 +0000 (12:55 -0600)
committerJon Roelofs <jroelofs@jroelofs.com>
Sun, 12 Apr 2020 15:52:17 +0000 (09:52 -0600)
commit41f13f1f64d2074ae7512fb23656c22585e912bd
tree1b4f08ba335ab934bf437dfecbad83cd3ed468c0
parentd2f1cd5d9712276730f09745825fb6d71c51e639
reland: [DAG] Fix PR45049: LegalizeTypes crash

Sometimes LegalizeTypes knows about common subexpressions before SelectionDAG
does, leading to accidental SDValue removal before its reference count was
truly zero.

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

Reviewed-By: bjope
Fixes: https://bugs.llvm.org/show_bug.cgi?id=45049

Reverted in 3ce77142a6452d76d6f97c9a6c2da193e78841ba because the previous patch
broke the expensive-checks bots. The new patch removes the broken check.
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/test/CodeGen/X86/legalize-types-remapid.ll