[PATCH] D83605: [SelectionDAG][WebAssembly] Recognize splat value ABS operations
Heejin Ahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 04:50:03 PDT 2020
aheejin added a comment.
Wouldn't we want to add `ISD::ABS` to `scalarizeSplatValue` method in DAGCombiner.cpp too? WebAssembly wouldn't benefit from it, but it can benefit other targets that have a scalar `abs` instruction, and it is also consistent.
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1749
+ if (VecOp.getOpcode() == ISD::ABS && VecOp.hasOneUse() &&
+ !DCI.isAfterLegalizeDAG() &&
+ DAG.isSplatValue(VecOp, /*AllowUndefs=*/true)) {
----------------
Why is this?
================
Comment at: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp:1758
+ return SDValue();
+}
+
----------------
Does this function run before `DAGCombiner::visitEXTRACT_VECTOR_ELT` or after it? Or does this replace it? If this runs once before or after it, we wouldn't be able to optimize patterns that mixes `abs` with `add` or `sub`, such as `abs(add(abs(v1) + abs(v2)))`, right?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83605/new/
https://reviews.llvm.org/D83605
More information about the llvm-commits
mailing list