[all-commits] [llvm/llvm-project] 2ff509: [ConstraintElim] Set NSW on sub when simplifying s...
Florian Hahn via All-commits
all-commits at lists.llvm.org
Mon Aug 3 10:34:51 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2ff5099be4ea2f88609c23037fdbe4e355739a04
https://github.com/llvm/llvm-project/commit/2ff5099be4ea2f88609c23037fdbe4e355739a04
Author: Florian Hahn <flo at fhahn.com>
Date: 2026-08-03 (Mon, 03 Aug 2026)
Changed paths:
M llvm/lib/Transforms/Scalar/ConstraintElimination.cpp
M llvm/test/Transforms/ConstraintElimination/ssub-with-overflow.ll
Log Message:
-----------
[ConstraintElim] Set NSW on sub when simplifying ssub.with.overflow. (#213532)
When simplifying ssub.with.overflow to a plain sub, we already proven
that the sub does not sign wrap. Replace it with `sub nsw`.
No changes on
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/842, but
there is very little usage of ssub.with.overflow in default C/C++
builds.
It improves optimizations for code where ssub.with.overflow is used more
widely, like Clang + UBSan or Swift where checked arithmetic is the
default.
A simple C example is https://clang.godbolt.org/z/cv5MbYsrz
PR: https://github.com/llvm/llvm-project/pull/213532
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