thumb2 folding of constant addresses unhelpful

When addresses are a displacement from a constant (this can happen in device drivers), the resulting address gets folded rather than using base+displacement addressing. This results in code bloat. Example test attached.

const-addr.ll (522 Bytes)

Right. I am aware of this problem but am not sure about what to do about it. It's common for a number 32-bit immediates in the same block with the same lower or higher 16-bit. Since the immediates will not be split until late in codegen, the target independent optimizer will not CSE them.

Please file a bug, I need to think about a proper solution.

Evan

I'm not authorized to file bugs. Would someone please enter this?

Thank you, bagel

Evan Cheng wrote:

Anyone can create an account at llvm.org/bugs/ and file a bug.

-Eli