Regarding the code optimization, choose the correct sequence A. Algebraic…

2025

Regarding the code optimization, choose the correct sequence
A. Algebraic Simplification
B. Use of machine idioms
C. Redundant - instruction elimination
D. Flow of control optimization
E. Improved target code
Choose the correct answer from the options given below:

  1. A.

    A, C, B, D, E

  2. B.

    B, C, D, A, E

  3. C.

    C, D, A, B, E

  4. D.

    D, B, A, C, E

Attempted by 24 students.

Show answer & explanation

Correct answer: C

Correct sequence: Redundant-instruction elimination → Flow of control optimization → Algebraic simplification → Use of machine idioms → Improved target code

  • Redundant-instruction elimination: Remove unnecessary or duplicate instructions early to reduce code size and expose further optimization opportunities.

  • Flow of control optimization: Reorganize branches and loops, merge basic blocks, and simplify control structures so later optimizations can work on a cleaner control-flow graph.

  • Algebraic simplification: Simplify arithmetic expressions and apply strength reduction to lower computational cost; doing this after flow improvements often exposes further simplifications.

  • Use of machine idioms: Apply target-specific patterns and instruction sequences to exploit hardware features; perform this after machine-independent optimizations to avoid tying early passes to a specific architecture.

  • Improved target code: Emit the final optimized target code, incorporating all prior improvements and any last-minute, target-aware adjustments.

Rationale: Perform machine-independent, general optimizations first (removing redundancies and improving control flow) so that algebraic simplifications and later machine-specific optimizations operate on a cleaner, smaller codebase. Finally, apply target-specific idioms and produce the final target code.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Nta Ugc Net Paper 2

Loading lesson…