[PATCH] D129666: [SDAG] Remove single-result restriction on commutative CSE
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 11:07:09 PDT 2022
craig.topper added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1872
- if (!RV.getNode() && TLI.isCommutativeBinOp(N->getOpcode()) &&
- N->getNumValues() == 1) {
SDValue N0 = N->getOperand(0);
----------------
craig.topper wrote:
> craig.topper wrote:
> > RKSimon wrote:
> > > Do we know why this limit was here in the first place?
> > At the time that was added, the commutable binops with 2 values were SMUL_LOHI/UMUL_LOHI/ADDC/ADDE.
> >
> > Am I unsure if its safe to do this for ADDC/ADDE which use Glue results. CSEing would increase the use count of the Glue. Maybe that's what it was protecting?
> Oops "Am I unsure" -> "I am unsure".
So it's probably safer as
```
if (!RV.getNode() && TLI.isCommutativeBinOp(N->getOpcode()) &&
N->getValueType(N->getNumValues()-1) != MVT::Glue) {
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129666/new/
https://reviews.llvm.org/D129666
More information about the llvm-commits
mailing list