[llvm] [CVP] Keep `ReachableCaseCount` in sync with range of condition (PR #142302)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 1 08:43:26 PDT 2025


dtcxzyw wrote:

> > #79993 assumes that a reachable case must be contained by `CR`. However, it doesn't hold for some edge cases.
> 
> Why doesn't it hold?

getValueInBlock(%phi, %loop3) = [-1, 2) = [-1, 1) U [1, 2)
The latter one is a bit strange. It is contributed by `LazyValueInfoImpl::getEdgeValueLocal`: https://github.com/llvm/llvm-project/blob/2a19efe7fe8adcb5d89d3587ee23d9f954b11896/llvm/lib/Analysis/LazyValueInfo.cpp#L1563
Thus, there are two reachable cases (0 and 1).

getConstantRangeAtUse(SI->getOperandUse(0)) = [-1, 0)
The case 0 is "reachable" but not included by CR.



https://github.com/llvm/llvm-project/pull/142302


More information about the llvm-commits mailing list