How do compilers use IR?

An intermediate language is the language of an abstract machine designed to aid in the analysis of computer programs. The term comes from their use in compilers, where the source code of a program is translated into a form more suitable for code-improving transformations before being used to generate object or machine code for a target machine.

Compilers translate the source code of a program to an intermediate representation (IR), which is a form more suitable for performing code transformations before generating object code for the target machine.