Discussion
Common subexpression elimination requires the compiler to establish that
Answer: D
Correct answer: the operands of the repeated expression have not changed in between
Reusing a computed value is safe only if the value is still the same, so the compiler must establish that nothing between the two occurrences assigned to any operand.
That is a data-flow question, and an assignment through a pointer or a call to a function that might modify a variable will defeat it - which is why aliasing makes the analysis conservative. The number of occurrences is irrelevant, constants are the domain of folding, and register pressure affects whether the saving is worth taking rather than whether it is legal.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development