[PATCH] D81708: [DAGCombine] Generalize the case (add (or x, c1), c2) -> (add x, (c1 + c2))
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 02:08:11 PDT 2020
RKSimon added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2193
+ DAG.FoldConstantArithmetic(ISD::ADD, DL, VT, {N1, N0.getOperand(1)});
return DAG.getNode(ISD::ADD, DL, VT, N0.getOperand(0), Add0);
}
----------------
Probably safer to assume FoldConstantArithmetic can fail:
```
if (SDValue Add0 = DAG.FoldConstantArithmetic(ISD::ADD, DL, VT, {N1, N0.getOperand(1)}))
return DAG.getNode(ISD::ADD, DL, VT, N0.getOperand(0), Add0);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81708/new/
https://reviews.llvm.org/D81708
More information about the llvm-commits
mailing list