[PATCH] D126532: [SVE] Add a DAG combiner fold to visitADD for vscale with truncate
Paul Walker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 05:58:36 PDT 2022
paulwalker-arm added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2628-2629
+ // fold a+truncate(vscale(c1))+truncate(vscale(c2))
+ // to a+truncate(vscale(c1+c2))
+ if (VT.isScalarInteger() && (N0.getOpcode() == ISD::ADD) &&
----------------
Would the following combine be safe?
```
ty1 truncate(ty2 vscale(c1)) -> ty1 vscale(c1)
```
I ask because then the combine just above the new one would just work?
I guess the problem is that operation legalisation might be the thing introducing the truncate but then we can just limit the combine to before then. I wouldn't expect the combine to be all that useful after legalisation anyway, although am happy to be proven wrong if you've a test case.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:2630
+ // to a+truncate(vscale(c1+c2))
+ if (VT.isScalarInteger() && (N0.getOpcode() == ISD::ADD) &&
+ (N0.getOperand(1).getOpcode() == ISD::TRUNCATE) &&
----------------
Is the `VT.isScalarInteger()` check necessary? I figure the later `ISD::VSCALE` requirement will guaranteed such, plus I don't see anything in the if block that actually cares.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126532/new/
https://reviews.llvm.org/D126532
More information about the llvm-commits
mailing list