Delete temporarily constructed node uses for analysis after it's use,
holding onto original input nodes. Ideally this would be rewritten
without making nodes, but this appears relatively complex.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
18677 ↗ | (On Diff #185851) | Could we replace this with a call to SelectionDAG::FoldSetCC()? That should only ever constant fold which AFAICT is what we're after. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
18677 ↗ | (On Diff #185851) | Actually it looks like there's a tiny bit of commutation code (moves single constant to RHS) that probably needs pulling out of FoldSetCC into getNode - but that's trivial compared to the TLI.SimplifySetCC monster. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
18677 ↗ | (On Diff #185851) | Confirmed, this gives the same result and is a lot cleaner: // Determine if the condition we're dealing with is constant. if (SDValue SCC = DAG.FoldSetCC(VT, N0, N1, CC, DL)) { if (auto *SCCC = dyn_cast<ConstantSDNode>(SCC)) { // fold select_cc true, x, y -> x // fold select_cc false, x, y -> y return !SCCC->isNullValue() ? N2 : N3; } } |
Comment Actions
It fell off the end of my work queue, but yes.
There's also a natural followup replacing another instance of SimplifySetCC, which seems to have similar wins that I'll put up in a bit.