[LLVMdev] constants in text section for mips 16

Tim Northover t.p.northover at gmail.com
Mon Feb 25 11:57:31 PST 2013


Hi Reed,

On Mon, Feb 25, 2013 at 7:40 PM, Reed Kotler <rkotler at mips.com> wrote:
> Why did you take out the constant island code for Arm 64? Just did not need it?

It was more a case of there not being any strong evidence that we
*did* need it. That pass is extremely big and took me at least two
attempts to get correct, and that was basing my work on a copy/paste
from the 32-bit ARM code.

Jim Grosbach thought (and internal enquiries didn't refute) that there
could be microarchitectural implications to embedding arbitrary data
into code sequences (branch predictors and alignment constraints have
been mentioned as possible fallout). On the other hand, removing it
means that any litpool access goes from:

ldr w0, litpool

to:

adrp x0, litpool
ldr w0, [x0, #:lo12:litpool]

I decided that since even the most optimistic load takes a few cycles
on modern hardware, it wasn't worth worrying about that extra (fairly
trivial) arithmetic instruction unless there was good evidence it
improved performance. I didn't have such evidence. Of course MIPS16
could very easily lie on the other side of any performance decision
like that; it may be obvious that the work is worthwhile in your
domain.

So basically, it's resting on AArch64. If evidence comes in that it
really does help I'll go back to my original plan of resurrecting it
and merging the AArch32/AArch64 versions into a target-independent
pass with hooks for different backends. Meanwhile, I don't have to
maintain it or worry about it being a source of bugs.

The other major annoyance from my perspecive is that it's fused with
the branch fixup pass. They're two different jobs that affect one
another far too much for my liking. Not that I have a (efficient)
solution to that problem.

Cheers.

Tim.



More information about the llvm-dev mailing list