Chapter 5 Generated Code Architecture© National Instruments Corporation 5-35 AutoCode Referenceelse {total = U->bsb_1;}Y->bsb_22_1 = total;INIT = 0;OptimizationsWhen translating a BlockScript block into source code, certainoptimizations are automatically done. These optimization can reduce directtraceability from the script to the code at the expense of tighter code.Constant Propagation/Hard-CodingA local variable that is assigned a constant value is replaced with its valuewhen code generates. The name of that constant local variable does notappear in the generated code. If it is important to see the symbolic name inthe generated code, consider using a parameter instead and -p option forcode generation.Dead Code EliminationCode that is guaranteed to never execute is called dead code. When deadcode is detected (as shown in Example 5-16), that code is not translated intogenerated source code. You can use this to your advantage by writing thescript in a more general way, taking advantage of special cases when theyoccur while not generating dead code. Dead code is most commonly usedby combining constants and if statements. If the guard of the if statementis a constant, then only one of the two branches is translated into generatedcode.Example 5-16 BlockScript Block Code with Dead CodeInputs: u;Outputs: y;float u(y.size),y(:);float threshold;threshold = 0.001;if threshold < 0.005 thenfor i = 1:y.size doy(i) = u(i) / threshold;endfor;else