Simple addressing mode generation for MOV instruction

Hi,

In a usecase, llvm is generating the complex address mov instruction over simple addresses.

GCC is generating the code with simple address mode.

Is the some pass or flag that need to turn ON the simple address mode?

Thanks,
Rohit Aggarwal

There are two aspects to this: one, what’s the fastest way to compute the address in isolation, and two, whether a loop should be rewritten by LSR to allow using a simpler addressing mode.

I don’t think there are currently flags for either of those on x86; there are flags to control usage of LEA, but not plain memory addressing. And off the top of my head, I’m not sure what benefit you’re hoping for with such a rewrite.

The relevant target hook for LSR is TargetTransformInfo::isLegalAddressingMode().

2 Likes