[llvm] [InstCombine][Docs] Update InstCombine contributor guide (PR #144228)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 00:58:47 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.
+
+Be careful with in-place operand/predicate changes, as poison-generating flags may not be valid for new
+operands. It is recommended to create a new instruction with carefully handling of flags. If not
----------------
nikic wrote:

```suggestion
operands. It is recommended to create a new instruction with careful handling of flags. If not
```

https://github.com/llvm/llvm-project/pull/144228


More information about the llvm-commits mailing list