[all-commits] [llvm/llvm-project] c42772: [CodeMoverUtils] Enhance isSafeToMoveBefore() when...

CongzheUalberta via All-commits all-commits at lists.llvm.org
Mon Sep 27 15:38:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c42772752a51849d311d5a379a042528c75795a8
      https://github.com/llvm/llvm-project/commit/c42772752a51849d311d5a379a042528c75795a8
  Author: Congzhe Cao <congzhe.cao at huawei.com>
  Date:   2021-09-27 (Mon, 27 Sep 2021)

  Changed paths:
    M llvm/include/llvm/Transforms/Utils/CodeMoverUtils.h
    M llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
    M llvm/unittests/Transforms/Utils/CodeMoverUtilsTest.cpp

  Log Message:
  -----------
  [CodeMoverUtils] Enhance isSafeToMoveBefore() when control flow equivalence is satisfied

With improved analysis in determining CFG equivalence that does
not require strict dominance and post-dominance conditions, we
now relax  isSafeToMoveBefore() such that an instruction I can
be moved before InsertPoint even if they do not strictly dominate
each other, as long as they follow the same control flow path.

For example,  we can move Instruction 0 before Instruction 1,
and vice versa.

```
if (cond1)
   // Instruction 0: %add = add i32 1, 2
if (cond1)
   // Instruction 1: %add2 = add i32 2, 1
```

Reviewed By: Whitney

Differential Revision: https://reviews.llvm.org/D110456




More information about the All-commits mailing list