[TTI] Treat AND/OR with widenable conditions as free of cost
authorMax Kazantsev <mkazantsev@azul.com>
Tue, 14 Mar 2023 13:26:29 +0000 (20:26 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Tue, 14 Mar 2023 13:55:17 +0000 (20:55 +0700)
commitd12af65d4626ac69faf8f56afd30971b8a2fc3b3
treeb5bfc7bcaa12cd3f23fcccaa8c979f986ada4a00
parent1f1fea6c380ef397f2a2416f14f8945d294a4682
[TTI] Treat AND/OR with widenable conditions as free of cost

Because widenable conditions with eventually lower into a constant, such instructions
as `and`, `or` etc. will also be optimized away. Treat them as free.

This is an important thing to have if we want that guards represented as experimental.guard
calls and in their explicit form (branch by `and` with widenable condition) have the same cost
for unroller and other passes like this.

Differential Revision: https://reviews.llvm.org/D146034
Reviewed By: nikic
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/test/Transforms/LoopUnroll/guard-cost-for-unrolling.ll