According to the "LLVM Assembly Language Reference Manual": When constructing the data layout for a given target, LLVM starts with a default set of specifications which are then (possibly) overriden by the specifications in the datalayout keyword. The default specifications are given in this list: * E - big endian * p:32:64:64 - 32-bit pointers with 64-bit alignment Are these the specifications that are assumed by LLVM tools such as "opt" when a module doesn't have a target data specification? And does that mean that "opt", when given a module without a target data specification, might assume that GEP pointer-to-pointer, 1 should increment that pointer by eight bytes?
On Oct 20, 2009, at 9:26 AM, Kenneth Uildriks wrote:> According to the "LLVM Assembly Language Reference Manual": > > When constructing the data layout for a given target, LLVM starts with > a default set of specifications which are then (possibly) overriden by > the specifications in the datalayout keyword. The default > specifications are given in this list: > > * E - big endian > * p:32:64:64 - 32-bit pointers with 64-bit alignment > > > Are these the specifications that are assumed by LLVM tools such as > "opt" when a module doesn't have a target data specification? And > does that mean that "opt", when given a module without a target data > specification, might assume that GEP pointer-to-pointer, 1 should > increment that pointer by eight bytes?Unfortunately, yes. See PR4542. Progress has been made recently though -- the optimizers are now ready. The main things left to do is to update the documentation and update the testsuite to account for the change in the meaning of a module without a targetdata string. Dan
On Tue, Oct 20, 2009 at 11:26 AM, Kenneth Uildriks <kennethuil at gmail.com> wrote:> According to the "LLVM Assembly Language Reference Manual": > > When constructing the data layout for a given target, LLVM starts with > a default set of specifications which are then (possibly) overriden by > the specifications in the datalayout keyword. The default > specifications are given in this list: > > * E - big endian > * p:32:64:64 - 32-bit pointers with 64-bit alignment > > > Are these the specifications that are assumed by LLVM tools such as > "opt" when a module doesn't have a target data specification? And > does that mean that "opt", when given a module without a target data > specification, might assume that GEP pointer-to-pointer, 1 should > increment that pointer by eight bytes?If anyone else was waiting for the answer... The answer is yes. "opt" uses the same default target data layout regardless of what host machine it's being run on, and it'll trash any pointer indexing you're trying to do if you're running on a real machine whose target data layout is different from the universal default and your module doesn't have a target data layout specified. I hardcoded the layout by copying-and-pasting one generated by llvm-gcc. Now I'm off to dig up how to get the layout string for the platform you're running on...
On Tue, Oct 20, 2009 at 12:08 PM, Dan Gohman <gohman at apple.com> wrote:> Unfortunately, yes. See PR4542. Progress has been made recently > though -- the optimizers are now ready. The main things left to do > is to update the documentation and update the testsuite to account > for the change in the meaning of a module without a targetdata string. > > Dan > >So in the near future, the optimizers won't do any target-specific transformations in the absence of module target data?