[llvm] [IR] Add nowrap flags for trunc instruction (PR #85592)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 18 06:42:03 PDT 2024


================
@@ -946,6 +946,56 @@ class PossiblyNonNegInst : public CastInst {
   }
 };
 
+/// Cast Instruction that can have a nowrap flags (only trunc)
+class PossiblyNoWrapInst : public CastInst {
----------------
nikic wrote:

As things stand right now, yes, but it's very likely that nneg will be extended to more instructions in the future (lshr, udiv, uitofp, etc). I don't think we have any extensions for nuw/nsw planned that are sufficiently similar to the meaning they have for trunc. The only place I expect us to add them in the future is on getelementptr, but in that case they will have different semantics and be part of GEPOperator.

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


More information about the llvm-commits mailing list