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

Remove register allocator bug workaround #37572

Closed
dylanmckay opened this issue Jul 19, 2018 · 3 comments
Closed

Remove register allocator bug workaround #37572

dylanmckay opened this issue Jul 19, 2018 · 3 comments
Assignees
Labels
backend:AVR bugzilla Issues migrated from bugzilla

Comments

@dylanmckay
Copy link
Member

Bugzilla Link 38224
Version trunk
OS All

Extended Description

The register allocator does not handle certain functions that use the 'LDDWRdPtrQ' instructions which have high register pressure.

The error message is:

LLVM ERROR: ran out of registers during register allocation

In order to work around this, we restricted the allowable registers of LDDWRdPtrQ to disallow Z.

First noticed in avr-rust/rust-legacy-fork#37

@llvmbot
Copy link
Collaborator

llvmbot commented Nov 9, 2018

I think this is the same issues as llvm/llvm-bugzilla-archive#39391 . The proposed patch resolves this as well.

@dylanmckay
Copy link
Member Author

Huh, thanks for fixing the root cause Nirav.

I've raised avr-rust/rust-legacy-fork#126 to track the removal of our AVR-specific workaround (the DREGS_WITHOUT_Z_WORKAROUND register class).

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@benshi001 benshi001 self-assigned this Mar 24, 2022
@benshi001 benshi001 assigned benshi001 and unassigned benshi001 Jan 20, 2023
@benshi001
Copy link
Member

Now LDDWRdPtrQ can use Z as base address without any error.

int aff(int *arr) {
        return arr[4];
}

is compiled to

aff:                                    ; @aff
; %bb.0:                                ; %entry
        movw    r30, r24
        ldd     r24, Z+8
        ldd     r25, Z+9
        ret

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:AVR bugzilla Issues migrated from bugzilla
Projects
None yet
Development

No branches or pull requests

3 participants