UGC NET CS 2016Theory of Computation and Compilers › Code Generation and Code OptimizationVerified
UGC NET CS 2016 PYQ: In compiler optimization, operator strength reduction uses mathematical identities to replace slow math…
In compiler optimization, operator strength reduction uses mathematical identities to replace slow math operations with faster operations. Which of the following code replacements is an illustration of operator strength reduction ?
- AReplace $P + P$ by $2 ^{*} P$ or Replace $3 + 4$ by 7.
- BReplace $P ^{*} 32$ by $P < < 5$Correct answer
- CReplace $P ^{*} 0$ by 0
- DReplace $(P < <4) - P$ by $P ^{*} 15$
Answer
(B) Replace $P ^{*} 32$ by $P < < 5$
Approach
Strength reduction replaces an expensive operation with an equivalent cheaper one.
Reviewed by UGC IQ Editorial Team.