[PATCH] D77453: [GlobalISel] Simplify G_ADD when it has (0-X) on the LHS or RHS
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 11:27:42 PDT 2020
arsenm 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();
----------------
paquette wrote:
> 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.
>
>
Nobody ever really went back to preserve flags in DAGCombiner (to some degree for FP ops). I would check what InstCombine does
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77453/new/
https://reviews.llvm.org/D77453
More information about the llvm-commits
mailing list