[all-commits] [llvm/llvm-project] b00cba: [flang] do not set nuw flag in CSHIFT bound arithm...
jeanPerier via All-commits
all-commits at lists.llvm.org
Tue Feb 10 01:24:48 PST 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b00cba5804456dcc8634afa604712596c13f739a
https://github.com/llvm/llvm-project/commit/b00cba5804456dcc8634afa604712596c13f739a
Author: jeanPerier <jperier at nvidia.com>
Date: 2026-02-10 (Tue, 10 Feb 2026)
Changed paths:
M flang/include/flang/Optimizer/Builder/HLFIRTools.h
M flang/lib/Optimizer/Builder/HLFIRTools.cpp
M flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp
M flang/test/HLFIR/simplify-hlfir-intrinsics-cshift.fir
Log Message:
-----------
[flang] do not set nuw flag in CSHIFT bound arithmetic (#180520)
Fix https://github.com/llvm/llvm-project/issues/180374
I initially suspected an issue with some lower bound adjustment missing,
and indeed found an unrelated issue because gen1DSection was always
called with all-ones lower bounds because the genLowerbounds was called
on the result fir.shape.
But this is actually not relevant for the issue where this code path is
not exercised. The issue was `nuw` (no unsigned-wrap) was being set on
arithmetic inside the kernel generated for CSHIFT, but because this
arithmetic is dealing with user defined bounds, it may actually have to
deal with negative values (even if the offsets from the CSHIFT itself
are not negative).
This caused LLVM optimization to generate completely invalid code when
the lower bounds of CSHIFT input are zero or less.
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