Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LegalizeTypes][AMDGPU]: Allow for scalarization of insert_subvector #104236

Merged
merged 6 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,10 +889,13 @@ SDValue DAGTypeLegalizer::ScalarizeVecOp_CONCAT_VECTORS(SDNode *N) {
/// instead.
SDValue DAGTypeLegalizer::ScalarizeVecOp_INSERT_SUBVECTOR(SDNode *N,
unsigned OpNo) {
auto Elt = GetScalarizedVector(N->getOperand(OpNo));
auto VecOp = N->getOperand(1 - OpNo);
return DAG.getNode(ISD::INSERT_VECTOR_ELT, SDLoc(N), VecOp.getValueType(),
VecOp, Elt, N->getOperand(2));
// We should not be attempting to scalarize the containing vector
assert(OpNo == 1);
SDValue Elt = GetScalarizedVector(N->getOperand(OpNo));
SDValue ContainingVec = N->getOperand(1 - OpNo);
jrbyrnes marked this conversation as resolved.
Show resolved Hide resolved
return DAG.getNode(ISD::INSERT_VECTOR_ELT, SDLoc(N),
ContainingVec.getValueType(), ContainingVec, Elt,
N->getOperand(2));
}

/// If the input is a vector that needs to be scalarized, it must be <1 x ty>,
Expand Down
4 changes: 1 addition & 3 deletions llvm/test/CodeGen/AMDGPU/scalarize-insert-subvector.ll
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 < %s | FileCheck -check-prefixes=GCN %s
; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx942 < %s | FileCheck -check-prefix=GCN %s

define void @scalarize_insert_subvector(ptr addrspace(3) %inptr, ptr addrspace(3) %inptr1, ptr addrspace(3) %outptr) {
; GCN-LABEL: scalarize_insert_subvector:
Expand All @@ -22,5 +22,3 @@ define void @scalarize_insert_subvector(ptr addrspace(3) %inptr, ptr addrspace(3
store <4 x half> %shuffle2, ptr addrspace(3) %outptr
ret void
}
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; SI: {{.*}}
Loading