[all-commits] [llvm/llvm-project] 0d95b2: [LICM] Reassociate & hoist add expressions
Max Kazantsev via All-commits
all-commits at lists.llvm.org
Sun May 21 23:22:37 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0d95b20b63d7acc459dc0b2a7b2e4f9924c0adce
https://github.com/llvm/llvm-project/commit/0d95b20b63d7acc459dc0b2a7b2e4f9924c0adce
Author: Max Kazantsev <mkazantsev at azul.com>
Date: 2023-05-22 (Mon, 22 May 2023)
Changed paths:
M llvm/lib/Transforms/Scalar/LICM.cpp
M llvm/test/Transforms/LICM/hoist-add-sub.ll
Log Message:
-----------
[LICM] Reassociate & hoist add expressions
This patch allows LICM to reassociate and hoist following expressions:
```
loop:
%sum = add nsw %iv, %C1
%cmp = icmp <signed pred> %sum, C2
```
where `C1` and `C2` are loop invariants. The reassociated version looks like
```
preheader:
%inv_sum = C2 - C1
...
loop:
%cmp = icmp <signed pred> %iv, %inv_sum
```
In order to prove legality, we need both initial addition and the newly created subtraction
to happen without overflow.
Differential Revision: https://reviews.llvm.org/D149132
Reviewed By: skatkov
More information about the All-commits
mailing list