[llvm] [InstCombine][Docs] Update InstCombine contributor guide (PR #144228)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 00:35:01 PDT 2025
================
@@ -531,6 +552,19 @@ need to add a one-use check for the inner instruction.
One-use checks can be performed using the `m_OneUse()` matcher, or the
`V->hasOneUse()` method.
+### Flag handling
+
+When possible, propagate poison-generating flags like `nuw` and `nsw` since they may be
+hard to salvage later. If it is not free (e.g. requires additional complexity like `willNotOverflow`
+or KnownBits queries), don't do that.
----------------
antoniofrighetto wrote:
```suggestion
When possible, favour propagation of poison-generating flags like `nuw` and `nsw` since they may be
hard to salvage later. Avoid doing so if it introduces additional complexity (e.g. requires querying `willNotOverflow`
or KnownBits).
```
https://github.com/llvm/llvm-project/pull/144228
More information about the llvm-commits
mailing list