[PATCH] D132115: [DAGCombiner] Add use check for VSCALE in visitSUB.
WangLian via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 18 02:13:49 PDT 2022
Jimerlife created this revision.
Jimerlife added reviewers: RKSimon, craig.topper, sdesmalen, david-arm, benshi001.
Jimerlife added a project: LLVM.
Herald added subscribers: StephenFan, ecnelises, hiraditya.
Herald added a project: All.
Jimerlife requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
If there are multiple uses of VSCALE, then it may be more beneficial to keep origin form.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D132115
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3720,7 +3720,7 @@
}
// canonicalize (sub X, (vscale * C)) to (add X, (vscale * -C))
- if (N1.getOpcode() == ISD::VSCALE) {
+ if (N1.getOpcode() == ISD::VSCALE && N1.hasOneUse()) {
const APInt &IntVal = N1.getConstantOperandAPInt(0);
return DAG.getNode(ISD::ADD, DL, VT, N0, DAG.getVScale(DL, VT, -IntVal));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132115.453577.patch
Type: text/x-patch
Size: 557 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220818/f7b9ed1d/attachment.bin>
More information about the llvm-commits
mailing list