[all-commits] [llvm/llvm-project] c8c6c0: [flang] Drop nuw on XArrayCoor for non-positive sl...
Matsu via All-commits
all-commits at lists.llvm.org
Wed Jul 29 06:17:16 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c8c6c0ff7461a5a4c19c110d830945967bc97329
https://github.com/llvm/llvm-project/commit/c8c6c0ff7461a5a4c19c110d830945967bc97329
Author: Matsu <47756807+khaki3 at users.noreply.github.com>
Date: 2026-07-29 (Wed, 29 Jul 2026)
Changed paths:
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
M flang/test/Fir/array_coor_nuw_nusw.fir
M flang/test/Fir/convert-to-llvm.fir
Log Message:
-----------
[flang] Drop nuw on XArrayCoor for non-positive slice steps (#212639)
Example:
```fortran
z(:, 3:2:-1) = z(:, 1:2)
```
In this code, reverse-section indexing lowers `idx*step` / `diff+adj`
with `nuw`. A negative step can make the product negative, so `nuw` is
invalid and LLVM `-O2` can drop the stores.
Fix: keep `nsw|nuw` only for known positive steps; otherwise keep `nsw`
and drop `nuw` (negative, zero, or unknown).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list