[LLVMdev] TargetData::getPreferredAlignment(const GlobalVariable *GV) is strange ...

Fabian Scheler fabian.scheler at gmail.com
Thu Mar 10 04:23:54 PST 2011


> Ah, I really vaguely remember this.  IIRC, there was some fortran benchmark (that was running through f2c) which had a large array of doubles.  On X86, double is only 4-byte aligned, and the huge array was getting put at a "mod 16=4" offset.  This caused really really awful performance.
>
> A reasonable solution to this was to bump up the alignment of stuff proactively, but you don't want to do this for everything, because this ends up wasting lots of memory.  GCC has a similar policy IIRC.
>
> Is there some problem that this is causing?

Well, LLVM generates assembly that is not acepted by the binutils for
the TriCore processor I am using if the program contains large
structs. If LLVM-targets had a "maxAlign"-property this could be tuned
according to the needs of the specific target.

Ciao, Fabian




More information about the llvm-dev mailing list