[all-commits] [llvm/llvm-project] 6b03ce: [LICM] Simplify (X < A && X < B) into (X < MIN(A, ...
Max Kazantsev via All-commits
all-commits at lists.llvm.org
Fri Mar 10 02:37:07 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 6b03ce374e0dc64868b4b6665056dfc3fda0e98f
https://github.com/llvm/llvm-project/commit/6b03ce374e0dc64868b4b6665056dfc3fda0e98f
Author: Max Kazantsev <mkazantsev at azul.com>
Date: 2023-03-10 (Fri, 10 Mar 2023)
Changed paths:
M llvm/lib/Transforms/Scalar/LICM.cpp
M llvm/test/CodeGen/AMDGPU/wave32.ll
M llvm/test/CodeGen/PowerPC/sms-cpy-1.ll
M llvm/test/Transforms/LICM/min_max.ll
Log Message:
-----------
[LICM] Simplify (X < A && X < B) into (X < MIN(A, B)) if MIN(A, B) is loop-invariant
We don't do this transform in InstCombine in general case for arbitrary values, because cost of
AND and 2 ICMP's isn't higher than of MIN and ICMP. However, LICM also has a notion
about the loop structure. This transform becomes profitable if `A` and `B` are loop-invariant and
`X` is not: by doing this, we can compute min outside the loop.
Differential Revision: https://reviews.llvm.org/D143726
Reviewed By: nikic
More information about the All-commits
mailing list