[llvm] [Local] Move OverflowTracking to Local.h, move logic to helpers (NFC) (PR #140403)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon May 19 13:17:05 PDT 2025
================
@@ -556,6 +556,27 @@ Value *invertCondition(Value *Condition);
/// function, explicitly materialize the maximal set in the IR.
bool inferAttributesFromOthers(Function &F);
+//===----------------------------------------------------------------------===//
+// Helpers to track and update flags on instructions.
+//
+
+struct OverflowTracking {
+ 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() = default;
+
+ /// Merge in the no-wrap flags from \p I.
+ void mergeFlags(Instruction &I);
----------------
fhahn wrote:
Will share a separate patch for that, thanks
https://github.com/llvm/llvm-project/pull/140403
More information about the llvm-commits
mailing list