Skip to content

@llvm.experimental.stackmap intrinsic crashes when the second parameter (numShadowBytes) is a variable instead of a constant #115733

@DigOrDog

Description

@DigOrDog

Description

The llvm.experimental.stackmap intrinsic currently crashes when the numShadowBytes parameter is provided as a variable rather than a constant. According to the syntax, llvm.experimental.stackmap is expected to record the location of specified values in the stack map without generating code. However, when attempting to pass a variable as the second argument (numShadowBytes), the compiler fails, leading to a segmentation fault during the X86 DAG->DAG Instruction Selection pass.

Example code that triggers the crash:

@G = global i16 0
@G.1 = global i32 2147483647

define void @f(i32 %nelems) {
entry:
  %B = sub i32 %nelems, 65536
  %mem = alloca i32, i32 %nelems, align 4
  call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 %B, ptr %mem)
  ret void
}

; Function Attrs: nocallback nofree nosync willreturn
declare void @llvm.experimental.stackmap(i64, i32, ...) #0

attributes #0 = { nocallback nofree nosync willreturn }

https://godbolt.org/z/eM46jdv7r

Metadata

Metadata

Assignees

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]good first issuehttps://github.com/llvm/llvm-project/contributellvm:ir

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions