This is follow up of https://reviews.llvm.org/D71690.
In this patch, handle nsw as well
Paths
| Differential D72436
[SCEV] get a more accurate range for AddRecExpr with nsw flag ClosedPublic Authored by shchenz on Jan 8 2020, 10:34 PM.
Details
Diff Detail
Event Timeline
shchenz marked an inline comment as done. Comment Actionsoperand 0 does not required to be NonPos/NonNeg
Comment Actions Logic looks good to me. As @efriedma mentioned some extra tests would be good, especially for the different sign cases. The current test only covers negative start with negative step.
Comment Actions LGTM
This revision is now accepted and ready to land.Jan 11 2020, 1:42 AM Closed by commit rG569ccfc384a5: [SCEV] more accurate range for addrecexpr with nsw flag. (authored by shchenz). · Explain WhyJan 11 2020, 8:32 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 237526 llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/range_nw_flag.ll
|
With the new code, we can skip operand zero (start) here. We only need that the step operands have a known sign so the addrec moves in a known direction, but the sign of the start value doesn't matter.