[PATCH] D77453: [GlobalISel] Simplify G_ADD when it has (0-X) on the LHS or RHS
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 11:25:40 PDT 2020
paquette marked an inline comment as done.
paquette added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1634
+ std::tie(SubLHS, SubRHS) = MatchInfo;
+ Builder.buildSub(MI.getOperand(0).getReg(), SubLHS, SubRHS);
+ MI.eraseFromParent();
----------------
arsenm wrote:
> Should this preserve any flags?
In the DAGCombiner, it doesn't seem to:
```
// fold ((0-A) + B) -> B-A
if (N0.getOpcode() == ISD::SUB && isNullOrNullSplat(N0.getOperand(0)))
return DAG.getNode(ISD::SUB, DL, VT, N1, N0.getOperand(1));
```
but maybe we should? It would make sense.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77453/new/
https://reviews.llvm.org/D77453
More information about the llvm-commits
mailing list