• SCEV struggles to infer nsw flags for AddRec subscripts in conditional stores. • Example loop uses i to index array with conditions. • Current SCEV cannot deduce overflow behavior for conditional GEPs. • Recent PRs aim to add use‑specific SCEV requests for GEPs. • Merge blockers include compile‑time cost and potential ambiguity. • Question seeks clarification on fundamental limitations and opt‑in solutions.
Article Summaries:
- amehsan 1 IIUC, currently SCEV has some limitations when inferring nsw flags for an AddRec. (A related discussion is here: LLVM: Scalar evolution) In particular, for a loop like this for (int64_t i = 0; i < n; i++) { if (cond1(i)) { A[3i] = 1; } if (cond2(i)) { A[3i+1] = 1; } } currently SCEV cannot infer nsw flags for AddRecs corresponding to the subscripts that are used in conditional stores. Also IIUC, there has been attempts to address this limitation (for example the latest one that I know of: patches like [SCEV] Add option to request use-specific SCEV for a GEP expr (WIP). by fhahn · P
Sources: