Commits

Roman Levenstein committed 51ed0702b01
[globalopt] Propagate values of global let and static let variables into their uses. Values of static/global let variables are propagated into their uses and thus enable further optimizations like constant propagation, simplifications, etc. It is now possible to propagate the values of global and static let expressions like: class C { static let PI = 3.14 static let PI2 = PI * 2.0 } The optimization is applied if the initializer is simple enough, i.e. it should be a constant expression, containing literals and other let variables. This patch covers all cases, where static let variables are used. It also handles the case when global let variables are used, but only if the files are compiled as a part of a framework or a library. It does not support yet global lets in sources files, which are compiled in a script mode, because global variables are accessed slightly differently in this case (without using addressors). I'm going to support this in the subsequent patches. Swift SVN r30156