Splitting a loop to make range checks redundant is profitable only if the range check "never" fails. Make this fact a part of recognizing a range check -- a branch is a range check only if it is expected to pass (via branch_weights metadata).
|358 ↗||(On Diff #18796)|
Please don't access the branch_weights metadata directly. Use the BranchProbabilityInfo analysis (which also includes some useful static heuristics).