[LLVMdev] StructType field names

Dan Gohman gohman at apple.com
Fri Mar 27 18:14:41 PDT 2009


On Mar 27, 2009, at 8:25 AM, Anthony Danalis wrote:

> Thanks Luke,
>
> I was afraid that this would be the case.  I can see why this
> information is useless for most people/optimizations.
> However, it is still useful if you are writing an analysis pass that
> is supposed to tell the developer things about her code, and you want
> the output messages to be human readable.

Debugging information (i.e., the llvm.dbg.* intrinsics) is the way that
LLVM IR is correlated with the user's source code.  If debugging
information for a variable is available, it will provide all the field
names, without being subject to type uniquing or name mangling.

However, support in LLVM for debug information in optimized code
is currently a work in progress.  This area is under active development.

> My question for the list is this:
> Are there any optimizations that could change a struct type?  That is,
> could llvm deduce that the first field of a given struct is never  
> used/
> defined and change the struct type (and all the offsets wherever they
> appear) so that this field does not exist anymore?

Basically, any transformation which preserves program behavior is
valid.  However, debugging information is not left inconsistent.
Transformations must either update debugging information
to describe how the code after the transformation corresponds with
the user's code, or they must delete it.

Dan




More information about the llvm-dev mailing list