[llvm] bed163e - [SCEV] Clarify nuw/nsw semantics for multi-operand nodes (#195826)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 5 08:26:59 PDT 2026
Author: Nikita Popov
Date: 2026-05-05T17:26:54+02:00
New Revision: bed163e8ac77c0cf105ab869f5448758b56bed15
URL: https://github.com/llvm/llvm-project/commit/bed163e8ac77c0cf105ab869f5448758b56bed15
DIFF: https://github.com/llvm/llvm-project/commit/bed163e8ac77c0cf105ab869f5448758b56bed15.diff
LOG: [SCEV] Clarify nuw/nsw semantics for multi-operand nodes (#195826)
nuw/nsw must hold for all subsets/orders of operands.
Added:
Modified:
llvm/include/llvm/Analysis/ScalarEvolution.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index 5c01da0855f66..54ea8dbe56dd6 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -72,7 +72,9 @@ LLVM_ABI extern bool VerifySCEV;
/// Add and Mul expressions may have no-unsigned-wrap <NUW> or
/// no-signed-wrap <NSW> properties, which are derived from the IR
/// operator. NSW is a misnomer that we use to mean no signed overflow or
-/// underflow.
+/// underflow. NUW and NSW must hold for all subsets and orders of
+/// Add/Mul operands. That is, in `(a + b + c)<nsw>`, all of `a + b`,
+/// `b + c`, `a + c` must be nsw as well.
///
/// AddRec expressions may have a no-self-wraparound <NW> property if, in
/// the integer domain, abs(step) * max-iteration(loop) <=
More information about the llvm-commits
mailing list