Skip to content

[SelectionDAG] Use unaligned store to legalize EXTRACT_VECTOR_ELT type when Stack is non-realignable #98176

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

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,11 @@ Align SelectionDAG::getReducedAlign(EVT VT, bool UseABI) {
Align RedAlign2 = UseABI ? DL.getABITypeAlign(Ty) : DL.getPrefTypeAlign(Ty);
if (RedAlign2 < RedAlign)
RedAlign = RedAlign2;

if (!getMachineFunction().getFrameInfo().isStackRealignable())
// If the stack is not realignable, the alignment should be limited to the
// StackAlignment
RedAlign = std::min(RedAlign, StackAlign);
}

return RedAlign;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,22 @@ entry:
ret i32 %b
}

define i32 @foo2(i32 %arg1) #1 {
; CHECK-LABEL: foo2:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: # kill: def $edi killed $edi def $rdi
; CHECK-NEXT: vxorps %xmm0, %xmm0, %xmm0
; CHECK-NEXT: vmovups %ymm0, -{{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups %ymm0, -{{[0-9]+}}(%rsp)
; CHECK-NEXT: andl $31, %edi
; CHECK-NEXT: movzwl -72(%rsp,%rdi,2), %eax
; CHECK-NEXT: vzeroupper
; CHECK-NEXT: retq
entry:
%a = extractelement <32 x i16> zeroinitializer, i32 %arg1
%b = zext i16 %a to i32
ret i32 %b
}

attributes #0 = { "no-realign-stack" "target-cpu"="skylake-avx512" }
attributes #1 = { "no-realign-stack" "target-cpu"="skylake" }
Loading