We can prove the scenario:
FoundLHS > FoundRHS => LHS = (FoundLHS + Offset) > RHS = (FoundRHS + Offset)
Or
FoundLHS < FoundRHS => LHS = (FoundLHS + Offset) < RHS = (FoundRHS + Offset)
This patch enhance isImpliedCondBalancedTypes with the formula.
Paths
| Differential D144718
[ScalarEvolution] Enhance Predicate implication from condition Needs RevisionPublic Authored by TiehuZhang on Feb 24 2023, 3:53 AM.
Details
Summary We can prove the scenario: FoundLHS > FoundRHS => LHS = (FoundLHS + Offset) > RHS = (FoundRHS + Offset) Or FoundLHS < FoundRHS => LHS = (FoundLHS + Offset) < RHS = (FoundRHS + Offset) This patch enhance isImpliedCondBalancedTypes with the formula.
Diff Detail
Event TimelineTiehuZhang retitled this revision from [ScalarEvolution] Precommit a test to [ScalarEvolution] Enhance Predicate implication from condition.Feb 24 2023, 3:55 AM mkazantsev added inline comments.
This revision now requires changes to proceed.Feb 27 2023, 8:35 PM
Revision Contents
Diff 500132 llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/add-like-or.ll
llvm/test/Analysis/ScalarEvolution/trip-count-implied-offset.ll
llvm/test/CodeGen/Thumb2/mve-vmovlloop.ll
llvm/test/Transforms/HardwareLoops/ARM/simple-do.ll
llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
llvm/test/Transforms/LoopUnroll/X86/high-cost-expansion.ll
|
This is incorrect in case of overflow. See isKnownPredicateViaNoOverflow.