Variables in `@code_warntype` output not shown in Body


#1

I am trying to eliminate type instability in my function. When I perform @code_warntype to the function, some of the variables in the Variables: section of the output have names like #temp#@_130, T@_131, and A_1@_166, and they are typed ::Any and indicated red.

However, these unstable variables do not appear in the Body: section of the @code_warntype output, so it is difficult to figure out where these variables come from. I tried using @code_lowered following the suggestion here, but still have no luck figuring them out.

So, here are my questions:

  1. What do these T, A in the variables T@_131 and A_1@166 mean? Is there any documentation that summarizes the meanings of them?
  2. @yuyichao’s comment in this issue thread seems to suggest that these red variables are in fact harmless as long as they don’t appear in the Body: section of the @code_warntype output. Can I always consider the red variables harmless if they do not appear in the Body: section?

#2

There’s no special meaning. The name is whatever you use in the code, might be inlined from somewhere.

You can always ignore unused variables.


#3

Thanks for the confirmation! Just to make sure, by “unused variables” you mean any variables that appear in the Variables: section but don’t appear in the Body: section of the @code_warntype output, right?


#4

Those included. Also ones that are assigned to but not used.