[LLVMdev] Question About the LLVM IR unnamed values!

Jim Grosbach grosbach at apple.com
Tue Jan 14 10:12:53 PST 2014

On Jan 14, 2014, at 12:41 AM, Tim Northover <t.p.northover at gmail.com> wrote:

> Hi Jin,
>> is that means the unnamed instructions like "%0 %1" all created by the
>> "load" instructions? is there any other type instructions can create unnamed
>> values?
> The names are chosen in clang rather than LLVM. When it's creating an
> instruction there's an optional "Name" field, which seems to mostly be
> filled in. So to answer that question, you'd have to look at all
> places in Clang that create instructions.
> I strongly suspect there are other cases that don't give a name, but
> the only ones I can think of at the moment are expansions of certain
> compiler builtins (e.g. SIMD intrinsics, probably va_arg and similar).
> Also, in release builds, the name is completely ignored and all
> instructions are anonymous.
> So you certainly shouldn't be relying on the fact that everything
> except loads are named. But I can't see any particular reason we'd
> turn down patches that added useful names in more cases.

Also, you can get names on the rest by running the instuction-namer pass (“opt -instnamer”) on the IR.

> Cheers.
> Tim.
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list