[all-commits] [llvm/llvm-project] 629d88: [LoopUnrollAndJam] Visit phi operand dependencies ...

Joshua Cao via All-commits all-commits at lists.llvm.org
Thu Jan 5 00:11:50 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 629d880dc527cd7a8d692cd24af196db4ea8646b
      https://github.com/llvm/llvm-project/commit/629d880dc527cd7a8d692cd24af196db4ea8646b
  Author: Joshua Cao <cao.joshua at yahoo.com>
  Date:   2023-01-05 (Thu, 05 Jan 2023)

  Changed paths:
    M llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp
    A llvm/test/Transforms/LoopUnrollAndJam/dependencies_visit_order.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list