[all-commits] [llvm/llvm-project] 6beb37: [InstCombine] Combine binary operator of two phi node

luxufan via All-commits all-commits at lists.llvm.org
Tue Mar 21 00:24:52 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6beb371e4c469801e04711b81d27cde6da11b032
      https://github.com/llvm/llvm-project/commit/6beb371e4c469801e04711b81d27cde6da11b032
  Author: luxufan <luxufan at iscas.ac.cn>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/phi.ll

  Log Message:
  -----------
  [InstCombine] Combine binary operator of two phi node

Combine binary operator of two phi node if there is at least one
specific constant value in phi0 and phi1's incoming values for each
same incoming block and this specific constant value can be used
to do optimization for specific binary operator.
For example:
```
%phi0 = phi i32 [0, %bb0], [%i, %bb1]
%phi1 = phi i32 [%j, %bb0], [0, %bb1]
%add = add i32 %phi0, %phi1
==>
%add = phi i32 [%j, %bb0], [%i, %bb1]
```

Fixes: https://github.com/llvm/llvm-project/issues/61137

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




More information about the All-commits mailing list