[IndVars] Support AND/OR in optimizeLoopExitWithUnknownExitCount
authorMax Kazantsev <mkazantsev@azul.com>
Wed, 11 Jan 2023 04:12:11 +0000 (11:12 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Wed, 11 Jan 2023 04:36:02 +0000 (11:36 +0700)
commit9f37ecf8fae9a6fc87a216bee0c83d465e8466b4
tree656ee0bb1cce1177e5ae896644033130485dd360
parent5c0facff1f14a32288ad0214be216f801e366ad7
[IndVars] Support AND/OR in optimizeLoopExitWithUnknownExitCount

This patch allows optimizeLoopExitWithUnknownExitCount to deal with
branches by conditions that are not immediately ICmp's, but aggregates
of ICmp's joined by arithmetic or logical AND/OR. Each ICmp is optimized
independently.

Differential Revision: https://reviews.llvm.org/D139832
Reviewed By: nikic
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/test/Transforms/IndVarSimplify/eliminate-backedge.ll
llvm/test/Transforms/IndVarSimplify/turn-to-invariant.ll