[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 19:06:27 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfc2b4dfef2f1: [DAGCombiner] Add use check for VSCALE in visitSUB. (authored by Jimerlife).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132115/new/
https://reviews.llvm.org/D132115
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
Index: llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
===================================================================
--- llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
+++ llvm/test/CodeGen/AArch64/sve-vscale-combine.ll
@@ -76,10 +76,8 @@
define i64 @multiple_uses_sub_vscale_i64(i64 %x, i64 %y) nounwind {
; CHECK-LABEL: multiple_uses_sub_vscale_i64:
; CHECK-NEXT: rdvl x8, #1
-; CHECK-NEXT: rdvl x9, #-1
; CHECK-NEXT: lsr x8, x8, #4
-; CHECK-NEXT: asr x9, x9, #4
-; CHECK-NEXT: add x9, x0, x9
+; CHECK-NEXT: sub x9, x0, x8
; CHECK-NEXT: add x8, x1, x8
; CHECK-NEXT: mul x0, x9, x8
; CHECK-NEXT: ret
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.453862.patch
Type: text/x-patch
Size: 1181 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220819/688a3c2a/attachment.bin>
More information about the llvm-commits
mailing list