which ir instructions have name

Hi everyone,

Some instructions in llvm have names and for some of them the name is empty. Now, I wanted to know which instructions have names?

Best,

Carlo

Names are optional and have overhead - we usually try not to emit names (Clang produces IR with names in an Asserts build, but otherwise it omits them - there’s not as much of that logic in the LLVM optimizers, so even starting with a non-Asserts Clang output you’ll still find the optimizers introduce names for instructions)

At some point we would want to try to more fully remove the construction of named instructions in the IR in non-Asserts builds across the stack, it’s just overhead we want to avoid in production execution.

That’s something I figured recently (too many calls to strlen on my non-assert profile…). The “switch” seems triggered on the IRBuilder (if I remember correctly), so any IRBuilder created instruction won’ t have a name in release build.
Should we favor the use of the IR builder in optimization that manipulates name? Or should we do something else to prevent the use of names in release build. Introduce a flag to build clang with the name field totally removed in “super released build”?

Names are optional and have overhead - we usually try not to emit names
(Clang produces IR with names in an Asserts build, but otherwise it omits
them - there's not as much of that logic in the LLVM optimizers, so even
starting with a non-Asserts Clang output you'll still find the optimizers
introduce names for instructions)

At some point we would want to try to more fully remove the construction
of named instructions in the IR in non-Asserts builds across the stack,
it's just overhead we want to avoid in production execution.

That's something I figured recently (too many calls to strlen on my
non-assert profile...). The "switch" seems triggered on the IRBuilder (if I
remember correctly), so any IRBuilder created instruction won' t have a
name in release build.
Should we favor the use of the IR builder in optimization that manipulates
name? Or should we do something else to prevent the use of names in release
build. Introduce a flag to build clang with the name field totally removed
in "super released build"?

Not sure what the right overall solution might be - I know Chandler's
expressed some thoughts on this before, including issues related to just
/building/ the names, even if we threw them away.