[PATCH] D113561: [SelectionDAG] Replace the Chain in LOAD->VP_LOAD widening
Fraser Cormack via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 10 09:58:10 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb1d8d70b9dea: [SelectionDAG] Replace the Chain in LOAD->VP_LOAD widening (authored by frasercrmck).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113561/new/
https://reviews.llvm.org/D113561
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
llvm/test/CodeGen/RISCV/rvv/legalize-load-sdnode.ll
Index: llvm/test/CodeGen/RISCV/rvv/legalize-load-sdnode.ll
===================================================================
--- llvm/test/CodeGen/RISCV/rvv/legalize-load-sdnode.ll
+++ llvm/test/CodeGen/RISCV/rvv/legalize-load-sdnode.ll
@@ -31,3 +31,19 @@
%v = load <vscale x 5 x half>, <vscale x 5 x half>* %ptr
ret <vscale x 5 x half> %v
}
+
+define <vscale x 7 x half> @load_nxv7f16(<vscale x 7 x half>* %ptr, <vscale x 7 x half>* %out) {
+; CHECK-LABEL: load_nxv7f16:
+; CHECK: # %bb.0:
+; CHECK-NEXT: csrr a2, vlenb
+; CHECK-NEXT: srli a2, a2, 3
+; CHECK-NEXT: slli a3, a2, 3
+; CHECK-NEXT: sub a2, a3, a2
+; CHECK-NEXT: vsetvli zero, a2, e16, m2, ta, mu
+; CHECK-NEXT: vle16.v v8, (a0)
+; CHECK-NEXT: vse16.v v8, (a1)
+; CHECK-NEXT: ret
+ %v = load <vscale x 7 x half>, <vscale x 7 x half>* %ptr
+ store <vscale x 7 x half> %v, <vscale x 7 x half>* %out
+ ret <vscale x 7 x half> %v
+}
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -4214,9 +4214,16 @@
SDValue EVL =
DAG.getVScale(DL, EVLVT, APInt(EVLVT.getScalarSizeInBits(), NumVTElts));
const auto *MMO = LD->getMemOperand();
- return DAG.getLoadVP(WideVT, DL, LD->getChain(), LD->getBasePtr(), Mask,
- EVL, MMO->getPointerInfo(), MMO->getAlign(),
- MMO->getFlags(), MMO->getAAInfo());
+ SDValue NewLoad =
+ DAG.getLoadVP(WideVT, DL, LD->getChain(), LD->getBasePtr(), Mask, EVL,
+ MMO->getPointerInfo(), MMO->getAlign(), MMO->getFlags(),
+ MMO->getAAInfo());
+
+ // Modified the chain - switch anything that used the old chain to use
+ // the new one.
+ ReplaceValueWith(SDValue(N, 1), NewLoad.getValue(1));
+
+ return NewLoad;
}
report_fatal_error("Unable to widen vector load");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113561.386213.patch
Type: text/x-patch
Size: 2025 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211110/454372e0/attachment.bin>
More information about the llvm-commits
mailing list