This implements the fold (abs (sub nsw x, y)) -> abds(x, y). Providing the sub is nsw this appears to be valid without the extensions that are usually used for abds. https://alive2.llvm.org/ce/z/XHVaB3. The equivalent abdu combine seems to not be valid.
Details
Details
Diff Detail
Diff Detail
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
10168 | Worth moving this inside combineABSToABD? |
Comment Actions
LGTM - cheers
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
10120 | You can probably hoist this before the sext/zext test? |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
10120 | The idea is that if we have a sext/zext pair then is better to use them in the abd, creating the smaller type. We use the wrapping flags if that fails. |
You can probably hoist this before the sext/zext test?