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

Assertion failed: (!MBB.isLiveIn(X86::EFLAGS) && "Stack probe calls will clobber live EFLAGS."), function emitStackProbeCall #59121

Closed
dcci opened this issue Nov 22, 2022 · 4 comments

Comments

@dcci
Copy link
Member

dcci commented Nov 22, 2022

% ./llc ./a.ll
Assertion failed: (!MBB.isLiveIn(X86::EFLAGS) && "Stack probe calls will clobber live EFLAGS."), function emitStackProbeCall, file X86FrameLowering.cpp, line 1116.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: ./llc ./a.ll
1.	Running pass 'Function Pass Manager' on module './a.ll'.
% cat a.ll 
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64h-apple-macosx13.0.0"

define void @patatino(i64 %length) #0 {
entry:
  %cmp4 = icmp eq i64 %length, 0
  br i1 %cmp4, label %cleanup78, label %if.end6

if.end6:                                          ; preds = %entry
  %0 = tail call i64 @llvm.smax.i64(i64 %length, i64 -1)
  %vla = alloca i8, i64 %0, align 16
  br label %cleanup78

cleanup78:
  ret void
}

declare i64 @llvm.smax.i64(i64, i64)
attributes #0 = { "probe-stack"="__chkstk_darwin" }
@dcci
Copy link
Member Author

dcci commented Nov 22, 2022

cc: @RKSimon

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 22, 2022

@llvm/issue-subscribers-backend-x86

@TNorthover
Copy link
Contributor

Looks like the assertion is a bit overzealous. It's inserting the call at a DYN_ALLOCA_64 later in the block so that's where the liveness of EFLAGS matters. That instruction is already marked as clobbering the register so it would be invalid MIR if it triggers, but that's what assertions are there to catch so that's fine.

@TNorthover
Copy link
Contributor

Patch in review: https://reviews.llvm.org/D138486

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

4 participants