[llvm] [SCEV] Introduce exact flag for UDiv (PR #225065)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 01:11:49 PDT 2026


================
@@ -346,8 +346,12 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
       BO->setHasNoUnsignedWrap();
     if (IsNSW)
       BO->setHasNoSignedWrap();
+    if (IsExact)
+      BO->setIsExact();
     return Builder.Insert(BO);
   }
+  if (IsExact)
+    return Builder.CreateExactBinOp(Opcode, LHS, RHS, IsExact);
----------------
david-arm wrote:

Are the `exact` and `nsw`/`nuw` flags mutually exclusive here? If so, is it worth asserting somewhere during the creation of SCEV nodes that we never set `exact` in combination with other flags?

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


More information about the llvm-commits mailing list