Computer Science EngineeringHard

Moving a computation whose value does not change inside a loop to before the loop is called

  1. A. loop-invariant code motion
  2. B. constant folding
  3. C. peephole optimization
  4. D. function inlining

Correct answer: A. loop-invariant code motion

Hoisting invariant expressions avoids recomputing them in every iteration.

More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions

Exams that ask this topic