Skip to content

16 byte Aligned load generated to load 32 byte wide AVX register from stack memory #98044

Closed
@Nirhar

Description

@Nirhar

Problematic IR:

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
target triple = "x86_64-unknown-linux-gnu"

define i32 @foo(i32 %arg1) #0 {
bci_0:
  %a = extractelement <32 x i16> zeroinitializer, i32 %arg1
  %b = zext i16 %a to i32
  ret i32 %b
}

attributes #0 = { "no-realign-stack" "target-cpu"="znver2" }

generates:

foo:                                    # @foo
        vxorps  %xmm0, %xmm0, %xmm0
        andl    $31, %edi
        vmovaps %ymm0, -40(%rsp)
        vmovaps %ymm0, -72(%rsp)
        movzwl  -72(%rsp,%rdi,2), %eax
        vzeroupper
        retq

when run with llc. This leads to the generation of a vmovdqa instruction, which can lead to a General Protection Fault. Here is the link to the godbolt demo: https://godbolt.org/z/33h7YGc5K

The problem seems to be in instruction selection again, similar to #77730

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions