Skip to content

Win64 Does not codegen correctly alloca align 64 #9294

@ZviRackover

Description

@ZviRackover
Bugzilla Link 8922
Resolution FIXED
Resolved on Mar 09, 2011 05:11
Version trunk
OS Windows XP
Blocks llvm/llvm-bugzilla-archive#9100
Attachments Fix candidate patch, Reproducer test
CC @asl

Extended Description

The following test case produces the assertion below when running on the Win64 subtarget:

define noalias i32* @​factorial() nounwind readnone {
entry:
%a = alloca i32, align 64
ret i32* %a
}

Assertion failed: (-(Offset + StackSize)) % Align == 0, file ........\lib\Target\X86\X86FrameInfo.cpp, line 867

Explanation:

Win64 CodeGen adds an extra 32 bytes to frame size, to be used as a Red Zone for potential calls. This addition ruins the stack alignment in case the required alignment is greater than 32 bytes.

Proposed fix is to add max(32, MaxAlignment) bytes instead.
Attached are the testcase and patch.

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