[all-commits] [llvm/llvm-project] cc28a7: Let EarlyCSE fold equivalent freeze instructions

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Fri Feb 28 03:35:26 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: cc28a754679a2c85625e719944154fe82491f008
      https://github.com/llvm/llvm-project/commit/cc28a754679a2c85625e719944154fe82491f008
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2020-02-28 (Fri, 28 Feb 2020)

  Changed paths:
    M llvm/lib/Transforms/Scalar/EarlyCSE.cpp
    M llvm/test/Transforms/EarlyCSE/basic.ll

  Log Message:
  -----------
  Let EarlyCSE fold equivalent freeze instructions

Summary:
This patch makes EarlyCSE fold equivalent freeze instructions.

Another optimization that I think will be useful is to remove freeze if its operand is used as a branch condition or at llvm.assume:

```
  %c = ...
  br i1 %c, label %A, ..
A:
  %d = freeze %c ; %d can be optimized to %c because %c cannot be poison or undef (or 'br %c' would be UB otherwise)
```

If it make sense for EarlyCSE to support this as well, I will make a patch for this.

Reviewers: spatel, reames, lebedev.ri

Reviewed By: lebedev.ri

Subscribers: lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list