Skip to content

[sparcv9] null often spilled to constant pool #740

@llvmbot

Description

@llvmbot
Bugzilla Link 368
Resolution FIXED
Resolved on Feb 22, 2010 12:54
Version 1.2
OS Solaris
Reporter LLVM Bugzilla Contributor

Extended Description

I have noticed that the 64-bit constant pointer null is often spilled to the
constant pool in the sparcv9 backend, requiring a 7-instruction sequence to
load it out of the constant pool. This is a pretty serious pessimization. For
an example of this behavior, try running llc -print-machineinstrs on the
following code:

implementation

void %foobar (sbyte* %arg) {
ret void
}

void %caller () {
call void %foobar (sbyte* null)
ret void
}

For %caller, SunPRO cc with -O on the C-backend code produces the following
(ignoring prolog/epilog instrs):

/* 0x0004 / or %g0,0,%o0
/
0x0008 */ call foobar ! params = %o0 ! Result = ! (tail call)

llc produces the following:

sethi   %hh(.CPI_caller_0), %o1
sethi   %lm(.CPI_caller_0), %o0
or  %o1, %hm(.CPI_caller_0), %o1
sllx    %o1, 32, %o1
or  %o0, %o1, %o0
or  %o0, %lo(.CPI_caller_0), %o0
ldx [%o0+0], %o0
call    foobar

.CPI_caller_0:
.xword 0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions