[llvm] [Reassociate] Move Disjoint flag handling to OverflowTracking. (PR #140406)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Sat May 17 17:56:45 PDT 2025


================
@@ -4368,6 +4368,8 @@ void OverflowTracking::mergeFlags(Instruction &I) {
     HasNUW &= I.hasNoUnsignedWrap();
     HasNSW &= I.hasNoSignedWrap();
   }
+  if (auto *DisjointOp = dyn_cast<PossiblyDisjointInst>(&I))
----------------
preames wrote:

This adds a really subtle usage error - imagine you call mergeFlags on first an add, and then a or.  Do we need to have overflow tracking keep track of the instruction opcode it's being used on?  Or alternative, promote the disjoint to the corresponding meaning on the add (in my previous example)?

(This is okay as a follow up, the current usage doesn't hit this case.)

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


More information about the llvm-commits mailing list