Fixes https://github.com/llvm/llvm-project/issues/58565
The previous implementation visits operands in pre-order, but this does
not guarantee an instruction is visited before its uses. This can cause
instructions to be copied in the incorrect order. For example:
a = ... b = add a, 1 c = add a, b d = add b, a
Pre-order visits does not guarantee the order in which a and b are
visited. LoopUnrollAndJam may incorrectly insert b before a.
This patch implements post-order visits. By visiting dependencies first,
we guarantee that an instruction's dependencies are visited first.
It can be:
Then is needn't pass ProcessInstr as a parameter.