The terminology of instruction sink


I’m looking for some paper or text book mention about instruction sink but there are nothing.

So, I think that instruction sink is not a formal term in compiler field.

I already searching some related words in text book like Randy Aleen & Ken Kennedy - Optimizing compilers for modern architectures and William Wulf, Richard Johnsson, Charles Weinstock, Steven Hobbs, Charles Geschke - The Design of an Optimizing Compiler.

And I search some key words like “compiler optimization execute when needed”, “compiler instruction sink” and “compiler combine source sink” (which source and sink are the terminology used in Optimizing compilers for modern architectures) on google, still nothing.

I know that this algorithm implemented in instcombine, which is also called peephole optimization. I google both of them and still get nothing.

Please help me about this issue. Searching some academic aricles about the optimization algorithm in LLVM is important for me.

Is it sink or sync? Sound identical but mean different things.

Sinking and peephole optimisations are totally different things. Sinking is about pushing instructions from outside loops or conditional statements into loops or conditional statements so as to avoid unnecessary computation when the condition is false and decrease register pressure. Peephole optimisation is about converting instruction sequences without control flow involved into equivalent, more optimal sequences (e.g. A + (-B) to A - B).

store sink and load hoist maybe?
or source vs sink suggests inputs and outputs (aka uses and defs)?

It is sink. It’s implemented in instcombine pass.

I found a possible paper.

KNOOP, Jens; RÜTHING, Oliver; STEFFEN, Bernhard. Partial dead code elimination. ACM SIGPLAN Notices, 1994, 29.6: 147-158.

The method they solved the examples are a little bit like instruction sink.

Thank you all!!