[LoopUnrollAndJam] Visit phi operand dependencies in post-order
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. Differential Revision: https://reviews.llvm.org/D140255
Loading
Please sign in to comment