Skip to content

[Local] Move OverflowTracking to Local.h, move logic to helpers (NFC) #140403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025

Conversation

fhahn
Copy link
Contributor

@fhahn fhahn commented May 17, 2025

Move parts of the logic used by Reassociate to OverflowTracking (mergeFlags & applyFlags) and move the definition to Local.h (not sure if there's a better place?).

For now it just moves the NUW/NSW handling, as this matches the uses in LICM. I'll look into the FP math handling separately, as it looks like there's a difference between Reassociate (takes all flags from I, while LICM takes the intersection of the flags on both instructions).

@llvmbot
Copy link
Member

llvmbot commented May 17, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Florian Hahn (fhahn)

Changes

Move parts of the logic used by Reassociate to OverflowTracking (mergeFlags & applyFlags) and move the definition to Local.h (not sure if there's a better place?).

For now it just moves the NUW/NSW handling, as this matches the uses in LICM. I'll look into the FP math handling separately, as it looks like there's a difference between Reassociate (takes all flags from I, while LICM takes the intersection of the flags on both instructions).


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

4 Files Affected:

  • (modified) llvm/include/llvm/Transforms/Scalar/Reassociate.h (+2-12)
  • (modified) llvm/include/llvm/Transforms/Utils/Local.h (+21)
  • (modified) llvm/lib/Transforms/Scalar/Reassociate.cpp (+3-14)
  • (modified) llvm/lib/Transforms/Utils/Local.cpp (+18)
diff --git a/llvm/include/llvm/Transforms/Scalar/Reassociate.h b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
index 23b70164d96a4..a5d137661e11e 100644
--- a/llvm/include/llvm/Transforms/Scalar/Reassociate.h
+++ b/llvm/include/llvm/Transforms/Scalar/Reassociate.h
@@ -39,6 +39,7 @@ class Function;
 class Instruction;
 class IRBuilderBase;
 class Value;
+struct OverflowTracking;
 
 /// A private "module" namespace for types and utilities used by Reassociate.
 /// These are implementation details and should not be used by clients.
@@ -64,17 +65,6 @@ struct Factor {
   Factor(Value *Base, unsigned Power) : Base(Base), Power(Power) {}
 };
 
-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;
-};
-
 class XorOpnd;
 
 } // end namespace reassociate
@@ -115,7 +105,7 @@ class ReassociatePass : public PassInfoMixin<ReassociatePass> {
   void ReassociateExpression(BinaryOperator *I);
   void RewriteExprTree(BinaryOperator *I,
                        SmallVectorImpl<reassociate::ValueEntry> &Ops,
-                       reassociate::OverflowTracking Flags);
+                       OverflowTracking Flags);
   Value *OptimizeExpression(BinaryOperator *I,
                             SmallVectorImpl<reassociate::ValueEntry> &Ops);
   Value *OptimizeAdd(Instruction *I,
diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h
index db064e1f41f02..d57e741aba206 100644
--- a/llvm/include/llvm/Transforms/Utils/Local.h
+++ b/llvm/include/llvm/Transforms/Utils/Local.h
@@ -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);
+
+  /// Apply the no-wrap flags to \p I if applicable.
+  void applyFlags(Instruction &I);
+};
+
 } // end namespace llvm
 
 #endif // LLVM_TRANSFORMS_UTILS_LOCAL_H
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index cb7a9ef9b6711..778a6a012556b 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -382,7 +382,7 @@ using RepeatedValue = std::pair<Value *, uint64_t>;
 static bool LinearizeExprTree(Instruction *I,
                               SmallVectorImpl<RepeatedValue> &Ops,
                               ReassociatePass::OrderedSet &ToRedo,
-                              reassociate::OverflowTracking &Flags) {
+                              OverflowTracking &Flags) {
   assert((isa<UnaryOperator>(I) || isa<BinaryOperator>(I)) &&
          "Expected a UnaryOperator or BinaryOperator!");
   LLVM_DEBUG(dbgs() << "LINEARIZE: " << *I << '\n');
@@ -431,10 +431,7 @@ static bool LinearizeExprTree(Instruction *I,
     // We examine the operands of this binary operator.
     auto [I, Weight] = Worklist.pop_back_val();
 
-    if (isa<OverflowingBinaryOperator>(I)) {
-      Flags.HasNUW &= I->hasNoUnsignedWrap();
-      Flags.HasNSW &= I->hasNoSignedWrap();
-    }
+    Flags.mergeFlags(*I);
 
     for (unsigned OpIdx = 0; OpIdx < I->getNumOperands(); ++OpIdx) { // Visit operands.
       Value *Op = I->getOperand(OpIdx);
@@ -734,15 +731,7 @@ void ReassociatePass::RewriteExprTree(BinaryOperator *I,
           ExpressionChangedStart->clearSubclassOptionalData();
           ExpressionChangedStart->setFastMathFlags(Flags);
         } else {
-          ExpressionChangedStart->clearSubclassOptionalData();
-          if (ExpressionChangedStart->getOpcode() == Instruction::Add ||
-              (ExpressionChangedStart->getOpcode() == Instruction::Mul &&
-               Flags.AllKnownNonZero)) {
-            if (Flags.HasNUW)
-              ExpressionChangedStart->setHasNoUnsignedWrap();
-            if (Flags.HasNSW && (Flags.AllKnownNonNegative || Flags.HasNUW))
-              ExpressionChangedStart->setHasNoSignedWrap();
-          }
+          Flags.applyFlags(*ExpressionChangedStart);
         }
       }
 
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 3dbd605e19c3a..4d168ce7cf591 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -4362,3 +4362,21 @@ bool llvm::inferAttributesFromOthers(Function &F) {
 
   return Changed;
 }
+
+void OverflowTracking::mergeFlags(Instruction &I) {
+  if (isa<OverflowingBinaryOperator>(&I)) {
+    HasNUW &= I.hasNoUnsignedWrap();
+    HasNSW &= I.hasNoSignedWrap();
+  }
+}
+
+void OverflowTracking::applyFlags(Instruction &I) {
+  I.clearSubclassOptionalData();
+  if (I.getOpcode() == Instruction::Add ||
+      (I.getOpcode() == Instruction::Mul && AllKnownNonZero)) {
+    if (HasNUW)
+      I.setHasNoUnsignedWrap();
+    if (HasNSW && (AllKnownNonNegative || HasNUW))
+      I.setHasNoSignedWrap();
+  }
+}

fhahn added a commit to fhahn/llvm-project that referenced this pull request May 17, 2025
This enables preserving NSW when both adds have NSW and NUW.

For now, set AllKnownNonNegative/AllKnownNonZero to false when using in
LICM.

https://alive2.llvm.org/ce/z/uu79Xc

Depends on llvm#140403 (included in
PR)
Copy link
Collaborator

@preames preames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'll note that leaving the AllKnownNonZero in Reasociate seems slightly odd, but we can be incremental here.

Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

struct OverflowTracking {
bool HasNUW = true;
bool HasNSW = true;
bool AllKnownNonNegative = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment indicating that the user is responsible for updating AllKnownNonNegative and AllKnownNonZero.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done thanks

OverflowTracking() = default;

/// Merge in the no-wrap flags from \p I.
void mergeFlags(Instruction &I);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Random thought - maybe we should have two merge routines, one for the interior nodes being reassociated, and one for the leaves? This would let us move all the KnownNonNegative and KnownNonZero logic out, and reuse it from LICM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will share a separate patch for that, thanks

fhahn added 2 commits May 19, 2025 20:39
Move parts of the logic used by Reassociate to OverflowTracking
(mergeFlags & applyFlags) and move the definition to Local.h (not sure
if there's a better place?).

For now it just moves the NUW/NSW handling, as this matches the uses in
LICM. I'll look into the FP math handling separately, as it looks like
there's a difference between Reassociate (takes all flags from I, while
LICM takes the intersection of the flags on both instructions).
@fhahn fhahn force-pushed the generalize-overflow-tracking branch from 545b4cd to 6902ceb Compare May 19, 2025 19:42
@fhahn fhahn merged commit c92ff61 into llvm:main May 19, 2025
9 of 11 checks passed
@fhahn fhahn deleted the generalize-overflow-tracking branch May 19, 2025 20:47
@llvm-ci
Copy link
Collaborator

llvm-ci commented May 19, 2025

LLVM Buildbot has detected a new failure on builder fuchsia-x86_64-linux running on fuchsia-debian-64-us-central1-a-1 while building llvm at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/15462

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure)
...
  Passed           : 46006 (97.92%)
  Expectedly Failed:    27 (0.06%)
[1368/1370] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[1369/1370] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/wasm-ld
-- Testing: 59209 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: LLVM :: tools/dsymutil/X86/op-convert-offset.test (52232 of 59209)
******************** TEST 'LLVM :: tools/dsymutil/X86/op-convert-offset.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
warning: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2025-05-19 16:31:35.914099972) and debug map (2022-07-12 20:49:30.000000000)
warning: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2025-05-19 16:31:35.914099972) and debug map (2022-07-12 20:49:30.000000000)
warning: cann't read address attribute value.
note: while processing op-convert-offset1.c

--
Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 # RUN: at line 23
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ # RUN: at line 24
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM # RUN: at line 25
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil --linker parallel -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs   /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset   -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 # RUN: at line 27
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil --linker parallel -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump    /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1    | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ # RUN: at line 30
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM # RUN: at line 33
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test:45:7: error: DSYM: expected string not found in input
DSYM: 0x00000084: DW_TAG_base_type
      ^
<stdin>:1:1: note: scanning from here
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM/Contents/Resources/DWARF/op-convert-offset: file format Mach-O 64-bit x86-64
^
<stdin>:16:1: note: possible intended match here
0x0000001e: DW_TAG_base_type
^
Step 7 (check) failure: check (failure)
...
  Passed           : 46006 (97.92%)
  Expectedly Failed:    27 (0.06%)
[1368/1370] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[1369/1370] Running the LLVM regression tests
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/ld.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using lld-link: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/lld-link
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using ld64.lld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/ld64.lld
llvm-lit: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/utils/lit/lit/llvm/config.py:520: note: using wasm-ld: /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/wasm-ld
-- Testing: 59209 tests, 60 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80..
FAIL: LLVM :: tools/dsymutil/X86/op-convert-offset.test (52232 of 59209)
******************** TEST 'LLVM :: tools/dsymutil/X86/op-convert-offset.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
warning: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2025-05-19 16:31:35.914099972) and debug map (2022-07-12 20:49:30.000000000)
warning: /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o: timestamp mismatch between object file (2025-05-19 16:31:35.914099972) and debug map (2022-07-12 20:49:30.000000000)
warning: cann't read address attribute value.
note: while processing op-convert-offset1.c

--
Command Output (stderr):
--
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 # RUN: at line 23
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ # RUN: at line 24
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM # RUN: at line 25
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil --linker parallel -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs   /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset   -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 # RUN: at line 27
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/dsymutil --linker parallel -oso-prepend-path /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset -o /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump    /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o 2>&1    | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ # RUN: at line 30
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/../Inputs/private/tmp/op-convert-offset/op-convert-offset.o
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix OBJ
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM 2>&1 | /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM # RUN: at line 33
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/llvm-dwarfdump /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM
+ /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/bin/FileCheck /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test --check-prefix DSYM
/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/llvm/test/tools/dsymutil/X86/op-convert-offset.test:45:7: error: DSYM: expected string not found in input
DSYM: 0x00000084: DW_TAG_base_type
      ^
<stdin>:1:1: note: scanning from here
/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-c1djeqzz/test/tools/dsymutil/X86/Output/op-convert-offset.test.tmp.dSYM/Contents/Resources/DWARF/op-convert-offset: file format Mach-O 64-bit x86-64
^
<stdin>:16:1: note: possible intended match here
0x0000001e: DW_TAG_base_type
^

llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 19, 2025
…lpers (NFC) (#140403)

Move parts of the logic used by Reassociate to OverflowTracking
(mergeFlags & applyFlags) and move the definition to Local.h.

For now it just moves the NUW/NSW handling, as this matches the uses in
LICM. I'll look into the FP math handling separately, as it looks like
there's a difference between Reassociate (takes all flags from I, while
LICM takes the intersection of the flags on both instructions).

PR: llvm/llvm-project#140403
fhahn added a commit to fhahn/llvm-project that referenced this pull request May 20, 2025
This enables preserving NSW when both adds have NSW and NUW.

For now, set AllKnownNonNegative/AllKnownNonZero to false when using in
LICM.

https://alive2.llvm.org/ce/z/uu79Xc

Depends on llvm#140403 (included in
PR)
fhahn added a commit that referenced this pull request May 20, 2025
…140404)

This enables preserving NSW when both adds have NSW and NUW.

For now, set AllKnownNonNegative/AllKnownNonZero to false when using in
LICM.

https://alive2.llvm.org/ce/z/uu79Xc

Depends on #140403.

PR: #140404
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 20, 2025
…ociating. (#140404)

This enables preserving NSW when both adds have NSW and NUW.

For now, set AllKnownNonNegative/AllKnownNonZero to false when using in
LICM.

https://alive2.llvm.org/ce/z/uu79Xc

Depends on llvm/llvm-project#140403.

PR: llvm/llvm-project#140404
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…llvm#140403)

Move parts of the logic used by Reassociate to OverflowTracking
(mergeFlags & applyFlags) and move the definition to Local.h.

For now it just moves the NUW/NSW handling, as this matches the uses in
LICM. I'll look into the FP math handling separately, as it looks like
there's a difference between Reassociate (takes all flags from I, while
LICM takes the intersection of the flags on both instructions).

PR: llvm#140403
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
…lvm#140404)

This enables preserving NSW when both adds have NSW and NUW.

For now, set AllKnownNonNegative/AllKnownNonZero to false when using in
LICM.

https://alive2.llvm.org/ce/z/uu79Xc

Depends on llvm#140403.

PR: llvm#140404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants