imageworks/OpenShadingLanguage — pull request #185 by lgritz (2012-12-12 06:09:59+00:00)
Title: Fix subtle runtime optimization bug

Fix subtle optimizer bug -- add_constant and replace_param_value type issues.

Both of these methods took void*'s and assumed that the types of the blind data had to match the known type where it was to be copied. Unfortunately, there was a particular series of optimization steps that could lead to these functions being applied to a "A=B" instruction where A and B differed in type. In the case I was chasing down, it was a float=int problem, and the int value was just being memcpy'd rather than properly converted to a float. So I overhauled both of these methods to handle the float=int, triple=float, and triple=int cases, as well as more robustly catching any other cases that it fails to handle.

Also added some improvements to my debugging logs in the process.