[llvm] [Scalar] Use default member initialization in OverflowTracking (NFC) (PR #138412)

via llvm-commits llvm-commits at lists.llvm.org
Sat May 3 09:41:58 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/138412.diff


1 Files Affected:

- (modified) llvm/include/llvm/Transforms/Scalar/Reassociate.h (+5-7) 


``````````diff
diff --git a/llvm/include/llvm/Transforms/Scalar/Reassociate.h b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
index 6d56961a71019..23b70164d96a4 100644
--- a/llvm/include/llvm/Transforms/Scalar/Reassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
@@ -65,16 +65,14 @@ struct Factor {
 };
 
 struct OverflowTracking {
-  bool HasNUW;
-  bool HasNSW;
-  bool AllKnownNonNegative;
-  bool AllKnownNonZero;
+  bool HasNUW = true;
+  bool HasNSW = true;
+  bool AllKnownNonNegative = true;
+  bool AllKnownNonZero = true;
   // Note: AllKnownNonNegative can be true in a case where one of the operands
   // is negative, but one the operators is not NSW. AllKnownNonNegative should
   // not be used independently of HasNSW
-  OverflowTracking()
-      : HasNUW(true), HasNSW(true), AllKnownNonNegative(true),
-        AllKnownNonZero(true) {}
+  OverflowTracking() = default;
 };
 
 class XorOpnd;

``````````

</details>


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


More information about the llvm-commits mailing list