I could use some help reducing unnecessary register spilling in a fairly complex program. It seems to me that the compiler doesn’t re-use registers. Am I missing a switch or something?
A simplified example of the problem:
a = 5;
a = 7;
some more code
Obviously, “a” only needs one register, but when I look at the ptx code generated by the compiler, I see two registers used. The compiler doesn’t re-use the first one. This leads to register spilling in the “some more code” section. Of course, my program is more complex, but that’s the idea. I use only about 40 registers at any one time, but by the time the compiler is done, it needs over 512.