Skip to content

Conversation

@jfurtek
Copy link
Contributor

@jfurtek jfurtek commented Nov 5, 2025

This MR modifies side effect traits of some integer arithmetic operations in the LLVM dialect.

Prior to this MR, the LLVM dialect sdiv and udiv operations were marked as Pure through tblgen inheritance of the LLVM_ArithmeticOpBase class. The Pure trait allowed incorrect hoisting of sdiv/udiv operations by the loop-independent-code-motion pass.

This MR modifies the sdiv and udiv LLVM operations to have traits and code motion behavior identical to their counterparts in the arith dialect, which were established by the commit/review below.

ed39825
https://reviews.llvm.org/D137814

@llvmbot
Copy link
Member

llvmbot commented Nov 5, 2025

@llvm/pr-subscribers-mlir

Author: Jeremy Furtek (jfurtek)

Changes

This MR modifies side effect traits of some integer arithmetic operations in the LLVM dialect.

Prior to this MR, the LLVM dialect sdiv and udiv operations were marked as Pure through tblgen inheritance of the LLVM_ArithmeticOpBase class. The Pure trait allowed incorrect hoisting of sdiv/udiv operations by the loop-independent-code-motion pass.

This MR modifies the sdiv and udiv LLVM operations to have traits and code motion behavior identical to their counterparts in the arith dialect, which were established by the commit/review below.

ed39825
https://reviews.llvm.org/D137814


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

4 Files Affected:

  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td (+18-15)
  • (modified) mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp (+28)
  • (modified) mlir/test/Transforms/loop-invariant-code-motion.mlir (+145)
  • (modified) mlir/unittests/Dialect/LLVMIR/CMakeLists.txt (+1)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index e425e16a4b1a6..971710fa3ee13 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -39,7 +39,7 @@ class LLVM_TerminatorOp<string mnemonic, list<Trait> traits = []> :
 class LLVM_ArithmeticOpBase<Type type, string mnemonic,
                             string instName, list<Trait> traits = []> :
     LLVM_Op<mnemonic,
-           !listconcat([Pure, SameOperandsAndResultType], traits)>,
+           !listconcat([SameOperandsAndResultType, NoMemoryEffect], traits)>,
     LLVM_Builder<"$res = builder.Create" # instName # "($lhs, $rhs);"> {
   dag commonArgs = (ins LLVM_ScalarOrVectorOf<type>:$lhs,
                     LLVM_ScalarOrVectorOf<type>:$rhs);
@@ -116,7 +116,8 @@ class LLVM_IntArithmeticOpWithDisjointFlag<string mnemonic, string instName,
 class LLVM_FloatArithmeticOp<string mnemonic, string instName,
                              list<Trait> traits = []> :
     LLVM_ArithmeticOpBase<LLVM_AnyFloat, mnemonic, instName,
-    !listconcat([DeclareOpInterfaceMethods<FastmathFlagsInterface>], traits)> {
+    !listconcat([DeclareOpInterfaceMethods<FastmathFlagsInterface>, Pure],
+                 traits)> {
   dag fmfArg = (
     ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
   let arguments = !con(commonArgs, fmfArg);
@@ -149,24 +150,26 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
 
 // Integer binary operations.
 def LLVM_AddOp : LLVM_IntArithmeticOpWithOverflowFlag<"add", "Add",
-    [Commutative]>;
-def LLVM_SubOp : LLVM_IntArithmeticOpWithOverflowFlag<"sub", "Sub", []>;
+    [Commutative, Pure]>;
+def LLVM_SubOp : LLVM_IntArithmeticOpWithOverflowFlag<"sub", "Sub", [Pure]>;
 def LLVM_MulOp : LLVM_IntArithmeticOpWithOverflowFlag<"mul", "Mul",
-    [Commutative]>;
-def LLVM_UDivOp : LLVM_IntArithmeticOpWithExactFlag<"udiv", "UDiv">;
-def LLVM_SDivOp : LLVM_IntArithmeticOpWithExactFlag<"sdiv", "SDiv">;
-def LLVM_URemOp : LLVM_IntArithmeticOp<"urem", "URem">;
-def LLVM_SRemOp : LLVM_IntArithmeticOp<"srem", "SRem">;
-def LLVM_AndOp : LLVM_IntArithmeticOp<"and", "And">;
-def LLVM_OrOp : LLVM_IntArithmeticOpWithDisjointFlag<"or", "Or"> {
+    [Commutative, Pure]>;
+def LLVM_UDivOp : LLVM_IntArithmeticOpWithExactFlag<"udiv", "UDiv",
+    [DeclareOpInterfaceMethods<ConditionallySpeculatable>]>;
+def LLVM_SDivOp : LLVM_IntArithmeticOpWithExactFlag<"sdiv", "SDiv",
+    [DeclareOpInterfaceMethods<ConditionallySpeculatable>]>;
+def LLVM_URemOp : LLVM_IntArithmeticOp<"urem", "URem", [Pure]>;
+def LLVM_SRemOp : LLVM_IntArithmeticOp<"srem", "SRem", [Pure]>;
+def LLVM_AndOp : LLVM_IntArithmeticOp<"and", "And", [Pure]>;
+def LLVM_OrOp : LLVM_IntArithmeticOpWithDisjointFlag<"or", "Or", [Pure]> {
   let hasFolder = 1;
 }
-def LLVM_XOrOp : LLVM_IntArithmeticOp<"xor", "Xor">;
-def LLVM_ShlOp : LLVM_IntArithmeticOpWithOverflowFlag<"shl", "Shl", []> {
+def LLVM_XOrOp : LLVM_IntArithmeticOp<"xor", "Xor", [Pure]>;
+def LLVM_ShlOp : LLVM_IntArithmeticOpWithOverflowFlag<"shl", "Shl", [Pure]> {
   let hasFolder = 1;
 }
-def LLVM_LShrOp : LLVM_IntArithmeticOpWithExactFlag<"lshr", "LShr">;
-def LLVM_AShrOp : LLVM_IntArithmeticOpWithExactFlag<"ashr", "AShr">;
+def LLVM_LShrOp : LLVM_IntArithmeticOpWithExactFlag<"lshr", "LShr", [Pure]>;
+def LLVM_AShrOp : LLVM_IntArithmeticOpWithExactFlag<"ashr", "AShr", [Pure]>;
 
 // Base class for compare operations. A compare operation takes two operands
 // of the same type and returns a boolean result. If the operands are
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 2731069d6ef54..da82809a9ddb0 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -4225,6 +4225,34 @@ LogicalResult InlineAsmOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// UDivOp
+//===----------------------------------------------------------------------===//
+Speculation::Speculatability UDivOp::getSpeculatability() {
+  // X / 0 => UB
+  Value divisor = getRhs();
+  if (matchPattern(divisor, m_IntRangeWithoutZeroU()))
+    return Speculation::Speculatable;
+
+  return Speculation::NotSpeculatable;
+}
+
+//===----------------------------------------------------------------------===//
+// SDivOp
+//===----------------------------------------------------------------------===//
+Speculation::Speculatability SDivOp::getSpeculatability() {
+  // This function conservatively assumes that all signed division by -1 are
+  // not speculatable.
+  // X / 0 => UB
+  // INT_MIN / -1 => UB
+  Value divisor = getRhs();
+  if (matchPattern(divisor, m_IntRangeWithoutZeroS()) &&
+      matchPattern(divisor, m_IntRangeWithoutNegOneS()))
+    return Speculation::Speculatable;
+
+  return Speculation::NotSpeculatable;
+}
+
 //===----------------------------------------------------------------------===//
 // LLVMDialect initialization, type parsing, and registration.
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/Transforms/loop-invariant-code-motion.mlir b/mlir/test/Transforms/loop-invariant-code-motion.mlir
index c1604e226a334..31a4f64dd7de0 100644
--- a/mlir/test/Transforms/loop-invariant-code-motion.mlir
+++ b/mlir/test/Transforms/loop-invariant-code-motion.mlir
@@ -880,6 +880,18 @@ func.func @no_speculate_divui(
   return
 }
 
+func.func @no_speculate_udiv(
+// CHECK-LABEL: @no_speculate_udiv(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.udiv
+    %val = llvm.udiv %num, %denom : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_divsi(
 // CHECK-LABEL: @no_speculate_divsi(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -892,6 +904,18 @@ func.func @no_speculate_divsi(
   return
 }
 
+func.func @no_speculate_sdiv(
+// CHECK-LABEL: @no_speculate_sdiv(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.sdiv
+    %val = llvm.sdiv %num, %denom : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivui(
 // CHECK-LABEL: @no_speculate_ceildivui(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -928,6 +952,18 @@ func.func @no_speculate_divui_const(%num: i32, %lb: index, %ub: index, %step: in
   return
 }
 
+func.func @no_speculate_udiv_const(%num: i32, %lb: index, %ub: index, %step: index) {
+// CHECK-LABEL: @no_speculate_udiv_const(
+  %c0 = arith.constant 0 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.udiv
+    %val = llvm.udiv %num, %c0 : i32
+  }
+
+  return
+}
+
 func.func @speculate_divui_const(
 // CHECK-LABEL: @speculate_divui_const(
     %num: i32, %lb: index, %ub: index, %step: index) {
@@ -941,6 +977,19 @@ func.func @speculate_divui_const(
   return
 }
 
+func.func @speculate_udiv_const(
+// CHECK-LABEL: @speculate_udiv_const(
+    %num: i32, %lb: index, %ub: index, %step: index) {
+  %c5 = llvm.mlir.constant(5 : i32) : i32
+// CHECK: llvm.udiv
+// CHECK: scf.for
+  scf.for %i = %lb to %ub step %step {
+    %val = llvm.udiv %num, %c5 : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivui_const(%num: i32, %lb: index, %ub: index, %step: index) {
 // CHECK-LABEL: @no_speculate_ceildivui_const(
   %c0 = arith.constant 0 : i32
@@ -979,6 +1028,19 @@ func.func @no_speculate_divsi_const0(
   return
 }
 
+func.func @no_speculate_sdiv_const0(
+// CHECK-LABEL: @no_speculate_sdiv_const0(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  %c0 = arith.constant 0 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.sdiv
+    %val = llvm.sdiv %num, %c0 : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_divsi_const_minus1(
 // CHECK-LABEL: @no_speculate_divsi_const_minus1(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -992,6 +1054,19 @@ func.func @no_speculate_divsi_const_minus1(
   return
 }
 
+func.func @no_speculate_sdiv_const_minus1(
+// CHECK-LABEL: @no_speculate_sdiv_const_minus1(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  %cm1 = arith.constant -1 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.sdiv
+    %val = llvm.sdiv %num, %cm1 : i32
+  }
+
+  return
+}
+
 func.func @speculate_divsi_const(
 // CHECK-LABEL: @speculate_divsi_const(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -1005,6 +1080,19 @@ func.func @speculate_divsi_const(
   return
 }
 
+func.func @speculate_sdiv_const(
+// CHECK-LABEL: @speculate_sdiv_const(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  %c5 = arith.constant 5 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: llvm.sdiv
+// CHECK: scf.for
+    %val = llvm.sdiv %num, %c5 : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivsi_const0(
 // CHECK-LABEL: @no_speculate_ceildivsi_const0(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -1057,6 +1145,19 @@ func.func @no_speculate_divui_range(
   return
 }
 
+func.func @no_speculate_udiv_range(
+// CHECK-LABEL: @no_speculate_udiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom = test.with_bounds {smax = 127 : i8, smin = -128 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.udiv
+    %val = llvm.udiv %num, %denom : i8
+  }
+
+  return
+}
+
 func.func @no_speculate_divsi_range(
 // CHECK-LABEL: @no_speculate_divsi_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
@@ -1072,6 +1173,21 @@ func.func @no_speculate_divsi_range(
   return
 }
 
+func.func @no_speculate_sdiv_range(
+// CHECK-LABEL: @no_speculate_sdiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom0 = test.with_bounds {smax = -1: i8, smin = -128 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  %denom1 = test.with_bounds {smax = 127 : i8, smin = 0 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK-COUNT-2: llvm.sdiv
+    %val0 = llvm.sdiv %num, %denom0 : i8
+    %val1 = llvm.sdiv %num, %denom1 : i8
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivui_range(
 // CHECK-LABEL: @no_speculate_ceildivui_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
@@ -1113,6 +1229,19 @@ func.func @speculate_divui_range(
   return
 }
 
+func.func @speculate_udiv_range(
+// CHECK-LABEL: @speculate_udiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom = test.with_bounds {smax = 127 : i8, smin = -128 : i8, umax = 255 : i8, umin = 1 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK: llvm.udiv
+// CHECK: scf.for
+    %val = llvm.udiv %num, %denom : i8
+  }
+
+  return
+}
+
 func.func @speculate_divsi_range(
 // CHECK-LABEL: @speculate_divsi_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
@@ -1129,6 +1258,22 @@ func.func @speculate_divsi_range(
   return
 }
 
+func.func @speculate_sdiv_range(
+// CHECK-LABEL: @speculate_sdiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom0 = test.with_bounds {smax = 127 : i8, smin = 1 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  %denom1 = test.with_bounds {smax = -2 : i8, smin = -128 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK-COUNT-2: llvm.sdiv
+// CHECK: scf.for
+    %val0 = llvm.sdiv %num, %denom0 : i8
+    %val1 = llvm.sdiv %num, %denom1 : i8
+
+  }
+
+  return
+}
+
 func.func @speculate_ceildivui_range(
 // CHECK-LABEL: @speculate_ceildivui_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
diff --git a/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt b/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
index 7cc130d02ad74..568126fd342cc 100644
--- a/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
@@ -4,4 +4,5 @@ add_mlir_unittest(MLIRLLVMIRTests
 mlir_target_link_libraries(MLIRLLVMIRTests
   PRIVATE
   MLIRLLVMDialect
+  MLIRInferIntRangeInterface
   )

@llvmbot
Copy link
Member

llvmbot commented Nov 5, 2025

@llvm/pr-subscribers-mlir-llvm

Author: Jeremy Furtek (jfurtek)

Changes

This MR modifies side effect traits of some integer arithmetic operations in the LLVM dialect.

Prior to this MR, the LLVM dialect sdiv and udiv operations were marked as Pure through tblgen inheritance of the LLVM_ArithmeticOpBase class. The Pure trait allowed incorrect hoisting of sdiv/udiv operations by the loop-independent-code-motion pass.

This MR modifies the sdiv and udiv LLVM operations to have traits and code motion behavior identical to their counterparts in the arith dialect, which were established by the commit/review below.

ed39825
https://reviews.llvm.org/D137814


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

4 Files Affected:

  • (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td (+18-15)
  • (modified) mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp (+28)
  • (modified) mlir/test/Transforms/loop-invariant-code-motion.mlir (+145)
  • (modified) mlir/unittests/Dialect/LLVMIR/CMakeLists.txt (+1)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index e425e16a4b1a6..971710fa3ee13 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -39,7 +39,7 @@ class LLVM_TerminatorOp<string mnemonic, list<Trait> traits = []> :
 class LLVM_ArithmeticOpBase<Type type, string mnemonic,
                             string instName, list<Trait> traits = []> :
     LLVM_Op<mnemonic,
-           !listconcat([Pure, SameOperandsAndResultType], traits)>,
+           !listconcat([SameOperandsAndResultType, NoMemoryEffect], traits)>,
     LLVM_Builder<"$res = builder.Create" # instName # "($lhs, $rhs);"> {
   dag commonArgs = (ins LLVM_ScalarOrVectorOf<type>:$lhs,
                     LLVM_ScalarOrVectorOf<type>:$rhs);
@@ -116,7 +116,8 @@ class LLVM_IntArithmeticOpWithDisjointFlag<string mnemonic, string instName,
 class LLVM_FloatArithmeticOp<string mnemonic, string instName,
                              list<Trait> traits = []> :
     LLVM_ArithmeticOpBase<LLVM_AnyFloat, mnemonic, instName,
-    !listconcat([DeclareOpInterfaceMethods<FastmathFlagsInterface>], traits)> {
+    !listconcat([DeclareOpInterfaceMethods<FastmathFlagsInterface>, Pure],
+                 traits)> {
   dag fmfArg = (
     ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
   let arguments = !con(commonArgs, fmfArg);
@@ -149,24 +150,26 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
 
 // Integer binary operations.
 def LLVM_AddOp : LLVM_IntArithmeticOpWithOverflowFlag<"add", "Add",
-    [Commutative]>;
-def LLVM_SubOp : LLVM_IntArithmeticOpWithOverflowFlag<"sub", "Sub", []>;
+    [Commutative, Pure]>;
+def LLVM_SubOp : LLVM_IntArithmeticOpWithOverflowFlag<"sub", "Sub", [Pure]>;
 def LLVM_MulOp : LLVM_IntArithmeticOpWithOverflowFlag<"mul", "Mul",
-    [Commutative]>;
-def LLVM_UDivOp : LLVM_IntArithmeticOpWithExactFlag<"udiv", "UDiv">;
-def LLVM_SDivOp : LLVM_IntArithmeticOpWithExactFlag<"sdiv", "SDiv">;
-def LLVM_URemOp : LLVM_IntArithmeticOp<"urem", "URem">;
-def LLVM_SRemOp : LLVM_IntArithmeticOp<"srem", "SRem">;
-def LLVM_AndOp : LLVM_IntArithmeticOp<"and", "And">;
-def LLVM_OrOp : LLVM_IntArithmeticOpWithDisjointFlag<"or", "Or"> {
+    [Commutative, Pure]>;
+def LLVM_UDivOp : LLVM_IntArithmeticOpWithExactFlag<"udiv", "UDiv",
+    [DeclareOpInterfaceMethods<ConditionallySpeculatable>]>;
+def LLVM_SDivOp : LLVM_IntArithmeticOpWithExactFlag<"sdiv", "SDiv",
+    [DeclareOpInterfaceMethods<ConditionallySpeculatable>]>;
+def LLVM_URemOp : LLVM_IntArithmeticOp<"urem", "URem", [Pure]>;
+def LLVM_SRemOp : LLVM_IntArithmeticOp<"srem", "SRem", [Pure]>;
+def LLVM_AndOp : LLVM_IntArithmeticOp<"and", "And", [Pure]>;
+def LLVM_OrOp : LLVM_IntArithmeticOpWithDisjointFlag<"or", "Or", [Pure]> {
   let hasFolder = 1;
 }
-def LLVM_XOrOp : LLVM_IntArithmeticOp<"xor", "Xor">;
-def LLVM_ShlOp : LLVM_IntArithmeticOpWithOverflowFlag<"shl", "Shl", []> {
+def LLVM_XOrOp : LLVM_IntArithmeticOp<"xor", "Xor", [Pure]>;
+def LLVM_ShlOp : LLVM_IntArithmeticOpWithOverflowFlag<"shl", "Shl", [Pure]> {
   let hasFolder = 1;
 }
-def LLVM_LShrOp : LLVM_IntArithmeticOpWithExactFlag<"lshr", "LShr">;
-def LLVM_AShrOp : LLVM_IntArithmeticOpWithExactFlag<"ashr", "AShr">;
+def LLVM_LShrOp : LLVM_IntArithmeticOpWithExactFlag<"lshr", "LShr", [Pure]>;
+def LLVM_AShrOp : LLVM_IntArithmeticOpWithExactFlag<"ashr", "AShr", [Pure]>;
 
 // Base class for compare operations. A compare operation takes two operands
 // of the same type and returns a boolean result. If the operands are
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 2731069d6ef54..da82809a9ddb0 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -4225,6 +4225,34 @@ LogicalResult InlineAsmOp::verify() {
   return success();
 }
 
+//===----------------------------------------------------------------------===//
+// UDivOp
+//===----------------------------------------------------------------------===//
+Speculation::Speculatability UDivOp::getSpeculatability() {
+  // X / 0 => UB
+  Value divisor = getRhs();
+  if (matchPattern(divisor, m_IntRangeWithoutZeroU()))
+    return Speculation::Speculatable;
+
+  return Speculation::NotSpeculatable;
+}
+
+//===----------------------------------------------------------------------===//
+// SDivOp
+//===----------------------------------------------------------------------===//
+Speculation::Speculatability SDivOp::getSpeculatability() {
+  // This function conservatively assumes that all signed division by -1 are
+  // not speculatable.
+  // X / 0 => UB
+  // INT_MIN / -1 => UB
+  Value divisor = getRhs();
+  if (matchPattern(divisor, m_IntRangeWithoutZeroS()) &&
+      matchPattern(divisor, m_IntRangeWithoutNegOneS()))
+    return Speculation::Speculatable;
+
+  return Speculation::NotSpeculatable;
+}
+
 //===----------------------------------------------------------------------===//
 // LLVMDialect initialization, type parsing, and registration.
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/Transforms/loop-invariant-code-motion.mlir b/mlir/test/Transforms/loop-invariant-code-motion.mlir
index c1604e226a334..31a4f64dd7de0 100644
--- a/mlir/test/Transforms/loop-invariant-code-motion.mlir
+++ b/mlir/test/Transforms/loop-invariant-code-motion.mlir
@@ -880,6 +880,18 @@ func.func @no_speculate_divui(
   return
 }
 
+func.func @no_speculate_udiv(
+// CHECK-LABEL: @no_speculate_udiv(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.udiv
+    %val = llvm.udiv %num, %denom : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_divsi(
 // CHECK-LABEL: @no_speculate_divsi(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -892,6 +904,18 @@ func.func @no_speculate_divsi(
   return
 }
 
+func.func @no_speculate_sdiv(
+// CHECK-LABEL: @no_speculate_sdiv(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.sdiv
+    %val = llvm.sdiv %num, %denom : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivui(
 // CHECK-LABEL: @no_speculate_ceildivui(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -928,6 +952,18 @@ func.func @no_speculate_divui_const(%num: i32, %lb: index, %ub: index, %step: in
   return
 }
 
+func.func @no_speculate_udiv_const(%num: i32, %lb: index, %ub: index, %step: index) {
+// CHECK-LABEL: @no_speculate_udiv_const(
+  %c0 = arith.constant 0 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.udiv
+    %val = llvm.udiv %num, %c0 : i32
+  }
+
+  return
+}
+
 func.func @speculate_divui_const(
 // CHECK-LABEL: @speculate_divui_const(
     %num: i32, %lb: index, %ub: index, %step: index) {
@@ -941,6 +977,19 @@ func.func @speculate_divui_const(
   return
 }
 
+func.func @speculate_udiv_const(
+// CHECK-LABEL: @speculate_udiv_const(
+    %num: i32, %lb: index, %ub: index, %step: index) {
+  %c5 = llvm.mlir.constant(5 : i32) : i32
+// CHECK: llvm.udiv
+// CHECK: scf.for
+  scf.for %i = %lb to %ub step %step {
+    %val = llvm.udiv %num, %c5 : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivui_const(%num: i32, %lb: index, %ub: index, %step: index) {
 // CHECK-LABEL: @no_speculate_ceildivui_const(
   %c0 = arith.constant 0 : i32
@@ -979,6 +1028,19 @@ func.func @no_speculate_divsi_const0(
   return
 }
 
+func.func @no_speculate_sdiv_const0(
+// CHECK-LABEL: @no_speculate_sdiv_const0(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  %c0 = arith.constant 0 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.sdiv
+    %val = llvm.sdiv %num, %c0 : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_divsi_const_minus1(
 // CHECK-LABEL: @no_speculate_divsi_const_minus1(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -992,6 +1054,19 @@ func.func @no_speculate_divsi_const_minus1(
   return
 }
 
+func.func @no_speculate_sdiv_const_minus1(
+// CHECK-LABEL: @no_speculate_sdiv_const_minus1(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  %cm1 = arith.constant -1 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.sdiv
+    %val = llvm.sdiv %num, %cm1 : i32
+  }
+
+  return
+}
+
 func.func @speculate_divsi_const(
 // CHECK-LABEL: @speculate_divsi_const(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -1005,6 +1080,19 @@ func.func @speculate_divsi_const(
   return
 }
 
+func.func @speculate_sdiv_const(
+// CHECK-LABEL: @speculate_sdiv_const(
+    %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
+  %c5 = arith.constant 5 : i32
+  scf.for %i = %lb to %ub step %step {
+// CHECK: llvm.sdiv
+// CHECK: scf.for
+    %val = llvm.sdiv %num, %c5 : i32
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivsi_const0(
 // CHECK-LABEL: @no_speculate_ceildivsi_const0(
     %num: i32, %denom: i32, %lb: index, %ub: index, %step: index) {
@@ -1057,6 +1145,19 @@ func.func @no_speculate_divui_range(
   return
 }
 
+func.func @no_speculate_udiv_range(
+// CHECK-LABEL: @no_speculate_udiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom = test.with_bounds {smax = 127 : i8, smin = -128 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK: llvm.udiv
+    %val = llvm.udiv %num, %denom : i8
+  }
+
+  return
+}
+
 func.func @no_speculate_divsi_range(
 // CHECK-LABEL: @no_speculate_divsi_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
@@ -1072,6 +1173,21 @@ func.func @no_speculate_divsi_range(
   return
 }
 
+func.func @no_speculate_sdiv_range(
+// CHECK-LABEL: @no_speculate_sdiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom0 = test.with_bounds {smax = -1: i8, smin = -128 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  %denom1 = test.with_bounds {smax = 127 : i8, smin = 0 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK: scf.for
+// CHECK-COUNT-2: llvm.sdiv
+    %val0 = llvm.sdiv %num, %denom0 : i8
+    %val1 = llvm.sdiv %num, %denom1 : i8
+  }
+
+  return
+}
+
 func.func @no_speculate_ceildivui_range(
 // CHECK-LABEL: @no_speculate_ceildivui_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
@@ -1113,6 +1229,19 @@ func.func @speculate_divui_range(
   return
 }
 
+func.func @speculate_udiv_range(
+// CHECK-LABEL: @speculate_udiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom = test.with_bounds {smax = 127 : i8, smin = -128 : i8, umax = 255 : i8, umin = 1 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK: llvm.udiv
+// CHECK: scf.for
+    %val = llvm.udiv %num, %denom : i8
+  }
+
+  return
+}
+
 func.func @speculate_divsi_range(
 // CHECK-LABEL: @speculate_divsi_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
@@ -1129,6 +1258,22 @@ func.func @speculate_divsi_range(
   return
 }
 
+func.func @speculate_sdiv_range(
+// CHECK-LABEL: @speculate_sdiv_range(
+    %num: i8, %lb: index, %ub: index, %step: index) {
+  %denom0 = test.with_bounds {smax = 127 : i8, smin = 1 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  %denom1 = test.with_bounds {smax = -2 : i8, smin = -128 : i8, umax = 255 : i8, umin = 0 : i8} : i8
+  scf.for %i = %lb to %ub step %step {
+// CHECK-COUNT-2: llvm.sdiv
+// CHECK: scf.for
+    %val0 = llvm.sdiv %num, %denom0 : i8
+    %val1 = llvm.sdiv %num, %denom1 : i8
+
+  }
+
+  return
+}
+
 func.func @speculate_ceildivui_range(
 // CHECK-LABEL: @speculate_ceildivui_range(
     %num: i8, %lb: index, %ub: index, %step: index) {
diff --git a/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt b/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
index 7cc130d02ad74..568126fd342cc 100644
--- a/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
+++ b/mlir/unittests/Dialect/LLVMIR/CMakeLists.txt
@@ -4,4 +4,5 @@ add_mlir_unittest(MLIRLLVMIRTests
 mlir_target_link_libraries(MLIRLLVMIRTests
   PRIVATE
   MLIRLLVMDialect
+  MLIRInferIntRangeInterface
   )

@dcaballe dcaballe merged commit 9349a10 into llvm:main Nov 17, 2025
13 checks passed
@joker-eph
Copy link
Collaborator

These seems legit build failures: https://lab.llvm.org/buildbot/#/builders/138/builds/21929
Can you look into it?

@jfurtek
Copy link
Contributor Author

jfurtek commented Nov 17, 2025

Looking into it now...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 17, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-8-cmake-build-only running on rocm-docker-rhel-8 while building mlir at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/flang/lib/Optimizer/CodeGen/CodeGen.cpp:288:77:   required from here
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/SmallVector.h:204:45: warning: parameter ‘From’ set but not used [-Wunused-but-set-parameter]
   void assertSafeToReferenceAfterClear(ItTy From, ItTy To) {
                                        ~~~~~^~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/SmallVector.h:204:56: warning: parameter ‘To’ set but not used [-Wunused-but-set-parameter]
   void assertSafeToReferenceAfterClear(ItTy From, ItTy To) {
                                                   ~~~~~^~
cc1plus: warning: unrecognized command line option ‘-Wno-ctad-maybe-unsupported’
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
[7015/8207] Linking CXX shared library lib/libMLIRLLVMDialect.so.22.0git
FAILED: lib/libMLIRLLVMDialect.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-array-bounds -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRLLVMDialect.so.22.0git -o lib/libMLIRLLVMDialect.so.22.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/FunctionCallUtils.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMAttrs.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMInterfaces.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMMemorySlot.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypes.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypeSyntax.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialectBytecode.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRPtrMemorySpaceInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  -lpthread  lib/libLLVMBinaryFormat.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0x7): undefined reference to `mlir::ConstantIntRanges::umin() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::operator()(mlir::ConstantIntRanges const&) const':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0xa): undefined reference to `mlir::ConstantIntRanges::umin() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutZeroS()::{lambda(mlir::ConstantIntRanges const&)#1}::operator()(mlir::ConstantIntRanges const&) const':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0xb): undefined reference to `mlir::ConstantIntRanges::smin() const'
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0x44): undefined reference to `mlir::ConstantIntRanges::smax() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutNegOneS()::{lambda(mlir::ConstantIntRanges const&)#1}::operator()(mlir::ConstantIntRanges const&) const':
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0xb): undefined reference to `mlir::ConstantIntRanges::smin() const'
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0x79): undefined reference to `mlir::ConstantIntRanges::smax() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::detail::constant_int_range_predicate_matcher::match(mlir::Operation*)':
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x54): undefined reference to `mlir::ConstantIntRanges::constant(llvm::APInt const&)'
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x127): undefined reference to `mlir::IntegerValueRange::getMaxRange(mlir::Value)'
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x190): undefined reference to `mlir::InferIntRangeInterface::inferResultRangesFromOptional(llvm::ArrayRef<mlir::IntegerValueRange>, llvm::function_ref<void (mlir::Value, mlir::IntegerValueRange const&)>)'
collect2: error: ld returned 1 exit status
[7016/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o
[7017/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o
[7018/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/openmp-utils.cpp.o
[7019/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/IntrinsicCall.cpp.o
[7020/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-reduction.cpp.o
[7021/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o
[7022/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics-library.cpp.o
[7023/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/parse-tree.cpp.o
[7024/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/expr-parsers.cpp.o
[7025/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/preprocessor.cpp.o
[7026/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/prescan.cpp.o
[7027/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/type.cpp.o
[7028/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/variable.cpp.o
[7029/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/io-parsers.cpp.o
[7030/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o
[7031/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/parsing.cpp.o
[7032/8207] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/cmake_pch.hxx.gch
[7033/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-character.cpp.o
[7034/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o
[7035/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/openacc-parsers.cpp.o
[7036/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/executable-parsers.cpp.o
[7037/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/flang/lib/Optimizer/CodeGen/CodeGen.cpp:288:77:   required from here
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/SmallVector.h:204:45: warning: parameter ‘From’ set but not used [-Wunused-but-set-parameter]
   void assertSafeToReferenceAfterClear(ItTy From, ItTy To) {
                                        ~~~~~^~~~
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/llvm/include/llvm/ADT/SmallVector.h:204:56: warning: parameter ‘To’ set but not used [-Wunused-but-set-parameter]
   void assertSafeToReferenceAfterClear(ItTy From, ItTy To) {
                                                   ~~~~~^~
cc1plus: warning: unrecognized command line option ‘-Wno-ctad-maybe-unsupported’
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
[7015/8207] Linking CXX shared library lib/libMLIRLLVMDialect.so.22.0git
FAILED: lib/libMLIRLLVMDialect.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-array-bounds -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRLLVMDialect.so.22.0git -o lib/libMLIRLLVMDialect.so.22.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/FunctionCallUtils.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMAttrs.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMInterfaces.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMMemorySlot.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypes.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypeSyntax.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialectBytecode.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRPtrMemorySpaceInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  -lpthread  lib/libLLVMBinaryFormat.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0x7): undefined reference to `mlir::ConstantIntRanges::umin() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::operator()(mlir::ConstantIntRanges const&) const':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0xa): undefined reference to `mlir::ConstantIntRanges::umin() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutZeroS()::{lambda(mlir::ConstantIntRanges const&)#1}::operator()(mlir::ConstantIntRanges const&) const':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0xb): undefined reference to `mlir::ConstantIntRanges::smin() const'
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0x44): undefined reference to `mlir::ConstantIntRanges::smax() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::m_IntRangeWithoutNegOneS()::{lambda(mlir::ConstantIntRanges const&)#1}::operator()(mlir::ConstantIntRanges const&) const':
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0xb): undefined reference to `mlir::ConstantIntRanges::smin() const'
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENKUlRKNS_17ConstantIntRangesEE_clES2_]+0x79): undefined reference to `mlir::ConstantIntRanges::smax() const'
tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: In function `mlir::detail::constant_int_range_predicate_matcher::match(mlir::Operation*)':
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x54): undefined reference to `mlir::ConstantIntRanges::constant(llvm::APInt const&)'
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x127): undefined reference to `mlir::IntegerValueRange::getMaxRange(mlir::Value)'
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x190): undefined reference to `mlir::InferIntRangeInterface::inferResultRangesFromOptional(llvm::ArrayRef<mlir::IntegerValueRange>, llvm::function_ref<void (mlir::Value, mlir::IntegerValueRange const&)>)'
collect2: error: ld returned 1 exit status
[7016/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o
[7017/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o
[7018/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/openmp-utils.cpp.o
[7019/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/IntrinsicCall.cpp.o
[7020/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-reduction.cpp.o
[7021/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o
[7022/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics-library.cpp.o
[7023/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/parse-tree.cpp.o
[7024/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/expr-parsers.cpp.o
[7025/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/preprocessor.cpp.o
[7026/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/prescan.cpp.o
[7027/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/type.cpp.o
[7028/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/variable.cpp.o
[7029/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/io-parsers.cpp.o
[7030/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o
[7031/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/parsing.cpp.o
[7032/8207] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/cmake_pch.hxx.gch
[7033/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-character.cpp.o
[7034/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o
[7035/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/openacc-parsers.cpp.o
[7036/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/executable-parsers.cpp.o
[7037/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 17, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-ubuntu-22-cmake-build-only running on rocm-docker-ubu-22 while building mlir at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[7094/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/CUFCommon.cpp.o
[7095/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/common.cpp.o
[7096/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/complex.cpp.o
[7097/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/IntrinsicCall.cpp.o
[7098/8207] Building CXX object tools/flang/lib/FrontendTool/CMakeFiles/flangFrontendTool.dir/ExecuteCompilerInvocation.cpp.o
[7099/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/host.cpp.o
[7100/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/openacc-parsers.cpp.o
[7101/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o
[7102/8207] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o
[7103/8207] Linking CXX shared library lib/libMLIRLLVMDialect.so.22.0git
FAILED: lib/libMLIRLLVMDialect.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRLLVMDialect.so.22.0git -o lib/libMLIRLLVMDialect.so.22.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/FunctionCallUtils.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMAttrs.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMInterfaces.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMMemorySlot.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypes.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypeSyntax.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialectBytecode.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRPtrMemorySpaceInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMBinaryFormat.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0xb): undefined reference to `mlir::ConstantIntRanges::umin() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x10): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x8e): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutNegOneS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x10): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x48): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::detail::constant_int_range_predicate_matcher::match(mlir::Operation*)':
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x84): undefined reference to `mlir::ConstantIntRanges::constant(llvm::APInt const&)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x153): undefined reference to `mlir::IntegerValueRange::getMaxRange(mlir::Value)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x1ad): undefined reference to `mlir::InferIntRangeInterface::inferResultRangesFromOptional(llvm::ArrayRef<mlir::IntegerValueRange>, llvm::function_ref<void (mlir::Value, mlir::IntegerValueRange const&)>)'
collect2: error: ld returned 1 exit status
[7104/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/integer.cpp.o
[7105/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/executable-parsers.cpp.o
[7106/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/unparse.cpp.o
[7107/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/program-parsers.cpp.o
[7108/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/logical.cpp.o
[7109/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/CUDAIntrinsicCall.cpp.o
[7110/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/static-data.cpp.o
[7111/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/call.cpp.o
[7112/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/target.cpp.o
[7113/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/real.cpp.o
[7114/8207] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
[7115/8207] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/assignment.cpp.o
[7116/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/PPCIntrinsicCall.cpp.o
[7117/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o
[7118/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/Fortran-parsers.cpp.o
[7119/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/expression.cpp.o
[7120/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o
[7121/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o
[7122/8207] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/cmake_pch.hxx.gch
[7123/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-reduction.cpp.o
[7124/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o
[7125/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics-library.cpp.o
[7126/8207] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/cmake_pch.hxx.gch
[7127/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o
Step 7 (build cmake config) failure: build cmake config (failure)
...
[7094/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/CUFCommon.cpp.o
[7095/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/common.cpp.o
[7096/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/complex.cpp.o
[7097/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/IntrinsicCall.cpp.o
[7098/8207] Building CXX object tools/flang/lib/FrontendTool/CMakeFiles/flangFrontendTool.dir/ExecuteCompilerInvocation.cpp.o
[7099/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/host.cpp.o
[7100/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/openacc-parsers.cpp.o
[7101/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o
[7102/8207] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o
[7103/8207] Linking CXX shared library lib/libMLIRLLVMDialect.so.22.0git
FAILED: lib/libMLIRLLVMDialect.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRLLVMDialect.so.22.0git -o lib/libMLIRLLVMDialect.so.22.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/FunctionCallUtils.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMAttrs.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMInterfaces.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMMemorySlot.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypes.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypeSyntax.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialectBytecode.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRPtrMemorySpaceInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMBinaryFormat.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0xb): undefined reference to `mlir::ConstantIntRanges::umin() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x10): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x8e): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutNegOneS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x10): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x48): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::detail::constant_int_range_predicate_matcher::match(mlir::Operation*)':
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x84): undefined reference to `mlir::ConstantIntRanges::constant(llvm::APInt const&)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x153): undefined reference to `mlir::IntegerValueRange::getMaxRange(mlir::Value)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x1ad): undefined reference to `mlir::InferIntRangeInterface::inferResultRangesFromOptional(llvm::ArrayRef<mlir::IntegerValueRange>, llvm::function_ref<void (mlir::Value, mlir::IntegerValueRange const&)>)'
collect2: error: ld returned 1 exit status
[7104/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/integer.cpp.o
[7105/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/executable-parsers.cpp.o
[7106/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/unparse.cpp.o
[7107/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/program-parsers.cpp.o
[7108/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/logical.cpp.o
[7109/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/CUDAIntrinsicCall.cpp.o
[7110/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/static-data.cpp.o
[7111/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/call.cpp.o
[7112/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/target.cpp.o
[7113/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/real.cpp.o
[7114/8207] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
[7115/8207] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/assignment.cpp.o
[7116/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/PPCIntrinsicCall.cpp.o
[7117/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o
[7118/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/Fortran-parsers.cpp.o
[7119/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/expression.cpp.o
[7120/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o
[7121/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o
[7122/8207] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/cmake_pch.hxx.gch
[7123/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-reduction.cpp.o
[7124/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o
[7125/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics-library.cpp.o
[7126/8207] Building CXX object tools/flang/lib/Lower/CMakeFiles/FortranLower.dir/cmake_pch.hxx.gch
[7127/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/intrinsics.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 17, 2025

LLVM Buildbot has detected a new failure on builder amdgpu-offload-rhel-9-cmake-build-only running on rocm-docker-rhel-9 while building mlir at step 4 "annotate".

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

Here is the relevant piece of the build log for the reference
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[7096/8207] Building CXX object tools/flang/lib/Optimizer/CodeGen/CMakeFiles/FIRCodeGen.dir/CodeGen.cpp.o
[7097/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/IR/CMakeFiles/HLFIRDialect.dir/HLFIRDialect.cpp.o
[7098/8207] Building CXX object tools/flang/lib/Optimizer/OpenMP/CMakeFiles/FlangOpenMPTransforms.dir/MapInfoFinalization.cpp.o
[7099/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/instrumented-parser.cpp.o
[7100/8207] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o
[7101/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/FIRToSCF.cpp.o
[7102/8207] Building CXX object tools/flang/lib/Optimizer/OpenACC/Support/CMakeFiles/FIROpenACCSupport.dir/FIROpenACCTypeInterfaces.cpp.o
[7103/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/ControlFlowConverter.cpp.o
[7104/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/CUFComputeSharedMemoryOffsetsAndSize.cpp.o
[7105/8207] Linking CXX shared library lib/libMLIRLLVMDialect.so.22.0git
FAILED: lib/libMLIRLLVMDialect.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRLLVMDialect.so.22.0git -o lib/libMLIRLLVMDialect.so.22.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/FunctionCallUtils.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMAttrs.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMInterfaces.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMMemorySlot.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypes.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypeSyntax.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialectBytecode.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRPtrMemorySpaceInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMBinaryFormat.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x7): undefined reference to `mlir::ConstantIntRanges::umin() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0xc): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x8e): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutNegOneS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0xc): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x44): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::detail::constant_int_range_predicate_matcher::match(mlir::Operation*)':
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x6b): undefined reference to `mlir::ConstantIntRanges::constant(llvm::APInt const&)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x126): undefined reference to `mlir::IntegerValueRange::getMaxRange(mlir::Value)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x180): undefined reference to `mlir::InferIntRangeInterface::inferResultRangesFromOptional(llvm::ArrayRef<mlir::IntegerValueRange>, llvm::function_ref<void (mlir::Value, mlir::IntegerValueRange const&)>)'
collect2: error: ld returned 1 exit status
[7106/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/common.cpp.o
[7107/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/AffineDemotion.cpp.o
[7108/8207] Building CXX object tools/flang/lib/Optimizer/OpenMP/CMakeFiles/FlangOpenMPTransforms.dir/MapsForPrivatizedSymbols.cpp.o
[7109/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/complex.cpp.o
[7110/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/ArrayValueCopy.cpp.o
[7111/8207] Building CXX object tools/flang/lib/Optimizer/Passes/CMakeFiles/flangPasses.dir/Pipelines.cpp.o
[7112/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/IntrinsicCall.cpp.o
[7113/8207] Building CXX object tools/flang/lib/FrontendTool/CMakeFiles/flangFrontendTool.dir/ExecuteCompilerInvocation.cpp.o
[7114/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/IR/CMakeFiles/HLFIRDialect.dir/HLFIROps.cpp.o
[7115/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o
[7116/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/host.cpp.o
[7117/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/integer.cpp.o
[7118/8207] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[7119/8207] Building CXX object tools/flang/lib/Utils/CMakeFiles/FortranUtils.dir/OpenMP.cpp.o
[7120/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/Transforms/CMakeFiles/HLFIRTransforms.dir/LowerHLFIRIntrinsics.cpp.o
[7121/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/call.cpp.o
[7122/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/PPCIntrinsicCall.cpp.o
[7123/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/Transforms/CMakeFiles/HLFIRTransforms.dir/SimplifyHLFIRIntrinsics.cpp.o
[7124/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o
[7125/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o
[7126/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o
[7127/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/expression.cpp.o
[7128/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o
[7129/8207] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/cmake_pch.hxx.gch
Step 7 (build cmake config) failure: build cmake config (failure)
...
[7096/8207] Building CXX object tools/flang/lib/Optimizer/CodeGen/CMakeFiles/FIRCodeGen.dir/CodeGen.cpp.o
[7097/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/IR/CMakeFiles/HLFIRDialect.dir/HLFIRDialect.cpp.o
[7098/8207] Building CXX object tools/flang/lib/Optimizer/OpenMP/CMakeFiles/FlangOpenMPTransforms.dir/MapInfoFinalization.cpp.o
[7099/8207] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/instrumented-parser.cpp.o
[7100/8207] Building CXX object tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o
[7101/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/FIRToSCF.cpp.o
[7102/8207] Building CXX object tools/flang/lib/Optimizer/OpenACC/Support/CMakeFiles/FIROpenACCSupport.dir/FIROpenACCTypeInterfaces.cpp.o
[7103/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/ControlFlowConverter.cpp.o
[7104/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/CUFComputeSharedMemoryOffsetsAndSize.cpp.o
[7105/8207] Linking CXX shared library lib/libMLIRLLVMDialect.so.22.0git
FAILED: lib/libMLIRLLVMDialect.so.22.0git 
: && /usr/bin/c++ -fPIC -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG  -Wl,-z,defs -Wl,-z,nodelete   -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/./lib  -Wl,--gc-sections -shared -Wl,-soname,libMLIRLLVMDialect.so.22.0git -o lib/libMLIRLLVMDialect.so.22.0git tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/FunctionCallUtils.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMAttrs.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMInterfaces.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMMemorySlot.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypes.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMTypeSyntax.cpp.o tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialectBytecode.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRPtrMemorySpaceInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libLLVMCore.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  lib/libLLVMBinaryFormat.so.22.0git  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib && :
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroU()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroUEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x7): undefined reference to `mlir::ConstantIntRanges::umin() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutZeroS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0xc): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir22m_IntRangeWithoutZeroSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x8e): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::m_IntRangeWithoutNegOneS()::{lambda(mlir::ConstantIntRanges const&)#1}::_FUN(mlir::ConstantIntRanges const&)':
LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0xc): undefined reference to `mlir::ConstantIntRanges::smin() const'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_[_ZZN4mlir24m_IntRangeWithoutNegOneSEvENUlRKNS_17ConstantIntRangesEE_4_FUNES2_]+0x44): undefined reference to `mlir::ConstantIntRanges::smax() const'
/usr/bin/ld: tools/mlir/lib/Dialect/LLVMIR/CMakeFiles/obj.MLIRLLVMDialect.dir/IR/LLVMDialect.cpp.o: in function `mlir::detail::constant_int_range_predicate_matcher::match(mlir::Operation*)':
LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x6b): undefined reference to `mlir::ConstantIntRanges::constant(llvm::APInt const&)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x126): undefined reference to `mlir::IntegerValueRange::getMaxRange(mlir::Value)'
/usr/bin/ld: LLVMDialect.cpp:(.text._ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE[_ZN4mlir6detail36constant_int_range_predicate_matcher5matchEPNS_9OperationE]+0x180): undefined reference to `mlir::InferIntRangeInterface::inferResultRangesFromOptional(llvm::ArrayRef<mlir::IntegerValueRange>, llvm::function_ref<void (mlir::Value, mlir::IntegerValueRange const&)>)'
collect2: error: ld returned 1 exit status
[7106/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/common.cpp.o
[7107/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/AffineDemotion.cpp.o
[7108/8207] Building CXX object tools/flang/lib/Optimizer/OpenMP/CMakeFiles/FlangOpenMPTransforms.dir/MapsForPrivatizedSymbols.cpp.o
[7109/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/complex.cpp.o
[7110/8207] Building CXX object tools/flang/lib/Optimizer/Transforms/CMakeFiles/FIRTransforms.dir/ArrayValueCopy.cpp.o
[7111/8207] Building CXX object tools/flang/lib/Optimizer/Passes/CMakeFiles/flangPasses.dir/Pipelines.cpp.o
[7112/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/IntrinsicCall.cpp.o
[7113/8207] Building CXX object tools/flang/lib/FrontendTool/CMakeFiles/flangFrontendTool.dir/ExecuteCompilerInvocation.cpp.o
[7114/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/IR/CMakeFiles/HLFIRDialect.dir/HLFIROps.cpp.o
[7115/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/constant.cpp.o
[7116/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/host.cpp.o
[7117/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/integer.cpp.o
[7118/8207] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[7119/8207] Building CXX object tools/flang/lib/Utils/CMakeFiles/FortranUtils.dir/OpenMP.cpp.o
[7120/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/Transforms/CMakeFiles/HLFIRTransforms.dir/LowerHLFIRIntrinsics.cpp.o
[7121/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/call.cpp.o
[7122/8207] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/PPCIntrinsicCall.cpp.o
[7123/8207] Building CXX object tools/flang/lib/Optimizer/HLFIR/Transforms/CMakeFiles/HLFIRTransforms.dir/SimplifyHLFIRIntrinsics.cpp.o
[7124/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/fold-designator.cpp.o
[7125/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/initial-image.cpp.o
[7126/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/formatting.cpp.o
[7127/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/expression.cpp.o
[7128/8207] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/characteristics.cpp.o
[7129/8207] Building CXX object tools/flang/lib/Frontend/CMakeFiles/flangFrontend.dir/cmake_pch.hxx.gch

dcaballe pushed a commit that referenced this pull request Nov 17, 2025
…face) (#168440)

This MR fixes a recent build breakage by this MR:
#166648

(Post-merge build error here:
https://lab.llvm.org/buildbot/#/builders/138/builds/21929)

The `MLIRInferIntRangeInterface` library is now a public dependency of
`MLIRLLVMDialect`.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 17, 2025
…tRangeInterface) (#168440)

This MR fixes a recent build breakage by this MR:
llvm/llvm-project#166648

(Post-merge build error here:
https://lab.llvm.org/buildbot/#/builders/138/builds/21929)

The `MLIRInferIntRangeInterface` library is now a public dependency of
`MLIRLLVMDialect`.
nekoshirro pushed a commit to nekoshirro/Alchemist-LLVM that referenced this pull request Nov 24, 2025
…face) (#168440)

This MR fixes a recent build breakage by this MR:
llvm/llvm-project#166648

(Post-merge build error here:
https://lab.llvm.org/buildbot/#/builders/138/builds/21929)

The `MLIRInferIntRangeInterface` library is now a public dependency of
`MLIRLLVMDialect`.
Signed-off-by: Hafidz Muzakky <[email protected]>
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
… marked as Pure (llvm#166648)

This MR modifies side effect traits of some integer arithmetic
operations in the LLVM dialect.

Prior to this MR, the LLVM dialect `sdiv` and `udiv` operations were
marked as `Pure` through `tblgen` inheritance of the
`LLVM_ArithmeticOpBase` class. The `Pure` trait allowed incorrect
hoisting of `sdiv`/`udiv` operations by the
`loop-independent-code-motion` pass.

This MR modifies the `sdiv` and `udiv` LLVM operations to have traits
and code motion behavior identical to their counterparts in the `arith`
dialect, which were established by the commit/review below.


llvm@ed39825
https://reviews.llvm.org/D137814
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
…face) (llvm#168440)

This MR fixes a recent build breakage by this MR:
llvm#166648

(Post-merge build error here:
https://lab.llvm.org/buildbot/#/builders/138/builds/21929)

The `MLIRInferIntRangeInterface` library is now a public dependency of
`MLIRLLVMDialect`.
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Nov 27, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 1, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 1, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 2, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 2, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 2, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 2, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

We also updated the scalarized_packed_fops to look specifically for
v_pk(add|mul|sub) because with updated llvm we can now vectorize mov
into v_pk_mov, which is unrelated to the scalarize pass.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 2, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

We also updated the scalarized_packed_fops to look specifically for
v_pk(add|mul|sub) because with updated llvm we can now vectorize mov
into v_pk_mov, which is unrelated to the scalarize pass.

Signed-off-by: Stanley Winata <[email protected]>
raikonenfnu added a commit to raikonenfnu/triton that referenced this pull request Dec 3, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
triton-lang@8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

We also updated the scalarized_packed_fops to look specifically for
v_pk(add|mul|sub) because with updated llvm we can now vectorize mov
into v_pk_mov, which is unrelated to the scalarize pass.

Signed-off-by: Stanley Winata <[email protected]>
ThomasRaoux pushed a commit to triton-lang/triton that referenced this pull request Dec 3, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up llvm/llvm-project#166648
which converted udiv and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test found in
8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer.
This PR Replaced it with urem which is similar class of op who still has Pure trait.

We also updated the scalarized_packed_fops to look specifically for
v_pk(add|mul|sub) because with updated llvm we can now vectorize mov
into v_pk_mov, which is unrelated to the scalarize pass.

Signed-off-by: Stanley Winata <[email protected]>
ThomasRaoux pushed a commit to triton-lang/triton that referenced this pull request Dec 3, 2025
This bump picks up llvm/llvm-project#169546
which resolves some register spilling in downstream use cases.

Additionally, we also pick up
llvm/llvm-project#166648 which converted udiv
and sdiv to non Pure attributes. This require changes on
warp_specialize_to_llvm.mlir `remat_subgraph` since the original test
found in
8601b39
was meant to test rematerializing some "pure ops" into partition region,
which the tested udiv is no longer. Replaced it with urem which is
similar class of op who still has Pure trait.

With latest change in LLVM, we are also vectorizing/packing `movs`. This
requires a test update, since the original test checks for any `v_pk`
while it is only scalarizing `v_pk_(add|mul|sub)` as seen on
https://github.com/triton-lang/triton/blob/91822318570f76e8952b9a49934df97e8871492e/third_party/amd/lib/TritonAMDGPUToLLVM/ScalarizePackedFOps.cpp#L46-L52

Signed-off-by: Stanley Winata <[email protected]>
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