Hi,
First: a Turboshaft phase that uses OptimizationPhase creates a copy of the graph. The old graph is referred to as input_graph and the newly created graph is the output_graph. This works by reducing each operation one by one (where each reduction creates a new operation in the output_graph), always reducing the inputs before their uses.
REDUCE takes as argument the already lowered arguments of the operation (the same arguments as the constructor). This means that the OpIndex arguments of REDUCE belong to the output_graph rather than the input_graph. This is typically useful when a lowering/reduction is only based on what the inputs of the operation are, but not on information further away down the graph. For instance, MachineLoweringReducer (
https://crsrc.org/c/v8/src/compiler/turboshaft/machine-lowering-reducer-inl.h) lowers Simplified operations to Machine operations, which doesn't require any knowledge beyond the inputs of each operation, and thus uses REDUCE methods.
REDUCE methods can't easily look down the graph, because their inputs belong to the output_graph, but next operations of the input_graph haven't been lowered yet, so they don't appear in the output_graph yet.
I hope that helps, let us know if you have other questions or need more details. Also, feel free to let us know what optimization/reducer/lowering you're trying to implement, so that we can give a more focused reply :)
Cheers,
Darius