HomePhabricator

[DAG] Set up infrastructure to avoid smart constructor-based dangling nodes

Description

[DAG] Set up infrastructure to avoid smart constructor-based dangling nodes

Summary:
Various SelectionDAG non-combine operations (e.g. the getNode smart
constructor and legalization) may leave dangling nodes by applying
optimizations without fully pruning unused result values. This results
in nodes that are never added to the worklist and therefore can not be
pruned.

Add a node inserter for the combiner to make sure such nodes have the
chance of being pruned. This allows a number of additional peephole
optimizations.

Reviewers: efriedma, RKSimon, craig.topper, jyknight

Reviewed By: jyknight

Subscribers: msearles, jyknight, sdardis, nemanjai, javed.absar, hiraditya, jrtc27, atanasyan, jsji, llvm-commits

Tags: #llvm

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

Details

Event Timeline

rupprecht added inline comments.
/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
651

Looks like this bit isn't needed:

SelectionDAG/DAGCombiner.cpp:651:16: warning: private field 'DC' is not used [-Wunused-private-field]                                          
  DAGCombiner &DC;

(just a warning, no revert needed)