[llvm] [Reassociate] Preserve NSW flags after expr tree rewriting (PR #93105)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat May 25 12:12:06 PDT 2024


================
@@ -63,6 +63,17 @@ struct Factor {
   Factor(Value *Base, unsigned Power) : Base(Base), Power(Power) {}
 };
 
+struct OverflowTracking {
+  bool HasNUW;
+  bool HasNSW;
+  bool AllKnownNonNegative;
+  // Note: AllKnownNegative can be true in a case where one of the operands
+  // is negative, but one the operators is not NSW. AllKnownNegative should
+  // not be used independently of HasNSW
+  OverflowTracking(void)
----------------
nikic wrote:

```suggestion
  OverflowTracking()
```
Not needed in C++.

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


More information about the llvm-commits mailing list