CVP currently does not simplify cmps with instructions in the same block, because LVI getPredicateAt() currently does not really provide much useful information for that case (D69686 would change that, but is stuck.) However, if the instruction is a Phi node, then LVI can compute the result of the predicate by threading it into the predecessor blocks, which allows it simplify some conditions that nothing else can handle. Relevant code: https://github.com/llvm/llvm-project/blob/6d6a4590c5d4c7fc7445d72fe685f966b0a8cafb/llvm/lib/Analysis/LazyValueInfo.cpp#L1904-L1927
The example in the test case is reduced from a Rust test case that sees a major perf regression in LLVM 10 (https://bugs.llvm.org/show_bug.cgi?id=44461). This patch addresses part of the regression (though not all of it).