SCEV should be able to prove facts like x <u x+1<nuw>.
Details
Diff Detail
Event Timeline
Disregard. We return true if the predicate is known-true, and false in all other cases.
Looks reasonable to me.
llvm/lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
9302–9303 | It is unclear how much it matters in practice, but | |
9311 | Likely even less real-world, but likewise, i'd think we want to check |
llvm/lib/Analysis/ScalarEvolution.cpp | ||
---|---|---|
9302–9303 | I think such cases are handled in different aux functions of isKnownViaNonRecursiveReasoning. This one is specifically for constant offset. |
Reloaded with dedicated unit test to make it independent on underlying patches (the only dependency was test).
It is unclear how much it matters in practice, but
i don't think C needs to be a constant,
which means that we only need to check that RHS is an NUW SCEVAddExpr, and that
any_of(AE->operands(), [L](SCEV*Op){ return Op == L; }).