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

[llc] incorrect stackmap generated for arm64 #117757

Open
lzheng5 opened this issue Nov 26, 2024 · 2 comments
Open

[llc] incorrect stackmap generated for arm64 #117757

lzheng5 opened this issue Nov 26, 2024 · 2 comments

Comments

@lzheng5
Copy link

lzheng5 commented Nov 26, 2024

Hello,

We believe the following generated stackmap for the attached case is wrong. This only happens on arm64. x64 is correct.

Please refer to https://llvm.org/docs/StackMaps.html#stackmap-format.

    uint8  : Register | Direct | Indirect | Constant | ConstantIndex
    uint8  : Reserved (expected to be 0)
    uint16 : Location Size
    uint16 : Dwarf RegNum
    uint16 : Reserved (expected to be 0)
    int32  : Offset or SmallConstant

[bad]

Ltmp9-_next_criticals967_code7BCE

        .byte	3 # Indirect
	.byte	0 
	.short	8
	.short	19 # RegNum (wrong)
	.short	0
	.long	56 # Offset (wrong)

[good]

Ltmp9-_next_criticals967_code7BCE

        .byte	3 # Indirect
	.byte	0 
	.short	8
	.short	29 # RegNum (correct)
	.short	0
	.long	-56 # Offset (correct)

r29 should the frame register on arm64. And the offset should be negative.

llc --version
LLVM (http://llvm.org/):
  LLVM version 17.0.2
  Optimized build.
  Default target: arm64-apple-darwin23.6.0
  Host CPU: apple-m1

Thanks,
Ling

@lzheng5
Copy link
Author

lzheng5 commented Nov 26, 2024

case.txt
bad.txt
good.txt

@lzheng5
Copy link
Author

lzheng5 commented Nov 26, 2024

One related question:

  uint64 : Function Address
  uint64 : Stack Size (or UINT64_MAX if not statically known)
  uint64 : Record Count
	.quad	_next_criticals967_code7BCE
	.quad	-1 # Stack Size
	.quad	33

I wonder why in this case on both arm64 and x64 I got -1 for the stack size? Even though I have many statepoints and a few more alloca instructions.

Thanks,
Ling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant