Branch relaxation
The step where the assembler or compiler backend picks the shortest branch instruction that still reaches its target.
x86 has a two-byte jump with an 8-bit displacement and a five-byte one with 32 bits. A conditional branch on RISC-V only reaches ±4 KiB and has to become an inverted condition skipping over a jal when the target is further away. The problem is circular: lengthening one branch shifts all the code after it, which may force other branches to grow.
The fix is an iteration that starts with every branch short and only ever lengthens. Since nothing shrinks, it always reaches a fixed point. Thomas Szymanski showed in 1978 that the truly optimal assignment is NP-complete in general, so everyone settles for the simple version. LLVM has a dedicated pass for it on targets such as AArch64, where the test-and-branch instructions only reach ±32 KiB.