Skip to content

Conversation

@NexMing
Copy link
Contributor

@NexMing NexMing commented Nov 28, 2025

When a scf.if directly precedes a scf.condition in the before region of a scf.while and both share the same condition, move the if into the after region of the loop. This helps simplify the control flow to enable uplifting scf.while to scf.for.

@llvmbot
Copy link
Member

llvmbot commented Nov 28, 2025

@llvm/pr-subscribers-mlir-scf

@llvm/pr-subscribers-mlir

Author: Ming Yan (NexMing)

Changes

When a scf.if directly precedes a scf.condition in the before region of a scf.while and both share the same condition, move the if into the after region of the loop. This helps simplify the control flow to enable uplifting scf.while to scf.for.


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

2 Files Affected:

  • (modified) mlir/lib/Dialect/SCF/IR/SCF.cpp (+124-1)
  • (modified) mlir/test/Dialect/SCF/canonicalize.mlir (+37)
diff --git a/mlir/lib/Dialect/SCF/IR/SCF.cpp b/mlir/lib/Dialect/SCF/IR/SCF.cpp
index 881e256a8797b..79dcf562db993 100644
--- a/mlir/lib/Dialect/SCF/IR/SCF.cpp
+++ b/mlir/lib/Dialect/SCF/IR/SCF.cpp
@@ -26,6 +26,7 @@
 #include "mlir/Interfaces/ParallelCombiningOpInterface.h"
 #include "mlir/Interfaces/ValueBoundsOpInterface.h"
 #include "mlir/Transforms/InliningUtils.h"
+#include "mlir/Transforms/RegionUtils.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
@@ -3687,6 +3688,127 @@ LogicalResult scf::WhileOp::verify() {
 }
 
 namespace {
+/// Move a scf.if op that is directly before the scf.condition op in the while
+/// before region, and whose condition matches the condition of the
+/// scf.condition op, down into the while after region.
+///
+/// scf.while (..) : (...) -> ... {
+///  %additional_used_values = ...
+///  %cond = ...
+///  ...
+///  %res = scf.if %cond -> (...) {
+///    use(%additional_used_values)
+///    ... // then block
+///    scf.yield %then_value
+///  } else {
+///    scf.yield %else_value
+///  }
+///  scf.condition(%cond) %res, ...
+/// } do {
+/// ^bb0(%res_arg, ...):
+///    use(%res_arg)
+///    ...
+///
+/// becomes
+/// scf.while (..) : (...) -> ... {
+///  %additional_used_values = ...
+///  %cond = ...
+///  ...
+///  scf.condition(%cond) %else_value, ..., %additional_used_values
+/// } do {
+/// ^bb0(%res_arg ..., %additional_args): :
+///    use(%additional_args)
+///    ... // if then block
+///    use(%then_value)
+///    ...
+struct WhileMoveIfDown : public OpRewritePattern<scf::WhileOp> {
+  using OpRewritePattern<scf::WhileOp>::OpRewritePattern;
+
+  LogicalResult matchAndRewrite(scf::WhileOp op,
+                                PatternRewriter &rewriter) const override {
+    auto conditionOp =
+        cast<scf::ConditionOp>(op.getBeforeBody()->getTerminator());
+    auto ifOp = dyn_cast_or_null<scf::IfOp>(conditionOp->getPrevNode());
+
+    // Check that the ifOp is directly before the conditionOp and that it
+    // matches the condition of the conditionOp. Also ensure that the ifOp has
+    // no else block with content, as that would complicate the transformation.
+    // TODO: support else blocks with content.
+    if (!ifOp || ifOp.getCondition() != conditionOp.getCondition() ||
+        (ifOp.elseBlock() && !ifOp.elseBlock()->without_terminator().empty()))
+      return failure();
+
+    assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
+                                 *ifOp->user_begin() == conditionOp) &&
+                                    "ifOp has unexpected uses");
+
+    Location loc = op.getLoc();
+
+    // Replace uses of ifOp results in the conditionOp with the yielded values
+    // from the ifOp branches.
+    for (auto [idx, arg] : llvm::enumerate(conditionOp.getArgs())) {
+      auto it = llvm::find(ifOp->getResults(), arg);
+      if (it != ifOp->getResults().end()) {
+        size_t ifOpIdx = it.getIndex();
+        Value thenValue = ifOp.thenYield()->getOperand(ifOpIdx);
+        Value elseValue = ifOp.elseYield()->getOperand(ifOpIdx);
+
+        rewriter.replaceAllUsesWith(ifOp->getResults()[ifOpIdx], elseValue);
+        rewriter.replaceAllUsesWith(op.getAfterArguments()[idx], thenValue);
+      }
+    }
+
+    // Collect additional used values from before region.
+    SetVector<Value> additionalUsedValues;
+    visitUsedValuesDefinedAbove(ifOp.getThenRegion(), [&](OpOperand *operand) {
+      if (op.getBefore().isAncestor(operand->get().getParentRegion()))
+        additionalUsedValues.insert(operand->get());
+    });
+
+    // Create new whileOp with additional used values as results.
+    auto additionalValueTypes = llvm::map_to_vector(
+        additionalUsedValues, [](Value val) { return val.getType(); });
+    size_t additionalValueSize = additionalUsedValues.size();
+    SmallVector<Type> newResultTypes(op.getResultTypes());
+    newResultTypes.append(additionalValueTypes);
+
+    auto newWhileOp =
+        scf::WhileOp::create(rewriter, loc, newResultTypes, op.getInits());
+
+    newWhileOp.getBefore().takeBody(op.getBefore());
+    newWhileOp.getAfter().takeBody(op.getAfter());
+    newWhileOp.getAfter().addArguments(
+        additionalValueTypes, SmallVector<Location>(additionalValueSize, loc));
+
+    SmallVector<Value> conditionArgs = conditionOp.getArgs();
+    llvm::append_range(conditionArgs, additionalUsedValues);
+
+    // Update conditionOp inside new whileOp before region.
+    rewriter.setInsertionPoint(conditionOp);
+    rewriter.replaceOpWithNewOp<scf::ConditionOp>(
+        conditionOp, conditionOp.getCondition(), conditionArgs);
+
+    // Replace uses of additional used values inside the ifOp then region with
+    // the whileOp after region arguments.
+    rewriter.replaceUsesWithIf(
+        additionalUsedValues.takeVector(),
+        newWhileOp.getAfterArguments().take_back(additionalValueSize),
+        [&](OpOperand &use) {
+          return ifOp.getThenRegion().isAncestor(
+              use.getOwner()->getParentRegion());
+        });
+
+    // Inline ifOp then region into new whileOp after region.
+    rewriter.eraseOp(ifOp.thenYield());
+    rewriter.inlineBlockBefore(ifOp.thenBlock(), newWhileOp.getAfterBody(),
+                               newWhileOp.getAfterBody()->begin());
+    rewriter.eraseOp(ifOp);
+    rewriter.replaceOp(op,
+                       newWhileOp->getResults().drop_back(additionalValueSize));
+    return success();
+  }
+};
+
 /// Replace uses of the condition within the do block with true, since otherwise
 /// the block would not be evaluated.
 ///
@@ -4399,7 +4521,8 @@ void WhileOp::getCanonicalizationPatterns(RewritePatternSet &results,
   results.add<RemoveLoopInvariantArgsFromBeforeBlock,
               RemoveLoopInvariantValueYielded, WhileConditionTruth,
               WhileCmpCond, WhileUnusedResult, WhileRemoveDuplicatedResults,
-              WhileRemoveUnusedArgs, WhileOpAlignBeforeArgs>(context);
+              WhileRemoveUnusedArgs, WhileOpAlignBeforeArgs, WhileMoveIfDown>(
+      context);
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/Dialect/SCF/canonicalize.mlir b/mlir/test/Dialect/SCF/canonicalize.mlir
index 084c3fc065de3..b02cbc07880b9 100644
--- a/mlir/test/Dialect/SCF/canonicalize.mlir
+++ b/mlir/test/Dialect/SCF/canonicalize.mlir
@@ -974,6 +974,43 @@ func.func @replace_if_with_cond3(%arg0 : i1, %arg2: i64) -> (i32, i64) {
 
 // -----
 
+// CHECK-LABEL: @while_move_if_down
+func.func @while_move_if_down() -> i32 {
+  %0 = scf.while () : () -> (i32) {
+    %additional_used_value = "test.get_some_value1" () : () -> (i32)
+    %else_value = "test.get_some_value2" () : () -> (i32)
+    %condition = "test.condition"() : () -> i1
+    %res = scf.if %condition -> (i32) {
+      "test.use1" (%additional_used_value) : (i32) -> ()
+      %then_value = "test.get_some_value3" () : () -> (i32)
+      scf.yield %then_value : i32
+    } else {
+      scf.yield %else_value : i32
+    }
+    scf.condition(%condition) %res : i32
+  } do {
+  ^bb0(%res_arg: i32):
+    "test.use2" (%res_arg) : (i32) -> ()
+    scf.yield
+  }
+  return %0 : i32
+}
+// CHECK-NEXT:      %[[WHILE_0:.*]]:2 = scf.while : () -> (i32, i32) {
+// CHECK-NEXT:        %[[VAL_0:.*]] = "test.get_some_value1"() : () -> i32
+// CHECK-NEXT:        %[[VAL_1:.*]] = "test.get_some_value2"() : () -> i32
+// CHECK-NEXT:        %[[VAL_2:.*]] = "test.condition"() : () -> i1
+// CHECK-NEXT:        scf.condition(%[[VAL_2]]) %[[VAL_1]], %[[VAL_0]] : i32, i32
+// CHECK-NEXT:      } do {
+// CHECK-NEXT:      ^bb0(%[[VAL_3:.*]]: i32, %[[VAL_4:.*]]: i32):
+// CHECK-NEXT:        "test.use1"(%[[VAL_4]]) : (i32) -> ()
+// CHECK-NEXT:        %[[VAL_5:.*]] = "test.get_some_value3"() : () -> i32
+// CHECK-NEXT:        "test.use2"(%[[VAL_5]]) : (i32) -> ()
+// CHECK-NEXT:        scf.yield
+// CHECK-NEXT:      }
+// CHECK-NEXT:      return %[[VAL_6:.*]]#0 : i32
+
+// -----
+
 // CHECK-LABEL: @while_cond_true
 func.func @while_cond_true() -> i1 {
   %0 = scf.while () : () -> i1 {

@joker-eph joker-eph changed the title Reland [MLIR][SCF] Sink scf.if from scf.while before region into after region. [MLIR][SCF] Canonicalize redundant scf.if from scf.while before region into after region Nov 28, 2025
@NexMing NexMing requested a review from joker-eph November 28, 2025 14:34
@NexMing NexMing merged commit 8ceeba8 into llvm:main Dec 1, 2025
10 checks passed
@NexMing NexMing deleted the dev/while-sink-if-down branch December 1, 2025 10:54
NexMing added a commit that referenced this pull request Dec 1, 2025
…er region in scf-uplift-while-to-for" (#169888)

Reverts #165216
It is implemented in #169892 .
@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 1, 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/30502

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)
...
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:27:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘virtual llvm::LogicalResult {anonymous}::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:3748:70: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 3747 |     assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 3748 |                                  *ifOp->user_begin() == conditionOp) &&
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 3749 |                                     "ifOp has unexpected uses");
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~        
[6847/8221] Linking CXX shared library lib/libMLIRSCFDialect.so.22.0git
FAILED: lib/libMLIRSCFDialect.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,libMLIRSCFDialect.so.22.0git -o lib/libMLIRSCFDialect.so.22.0git tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/DeviceMappingInterface.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRControlFlowDialect.so.22.0git  lib/libMLIRTensorDialect.so.22.0git  lib/libMLIRAffineDialect.so.22.0git  lib/libMLIRMemRefDialect.so.22.0git  lib/libMLIRValueBoundsOpInterface.so.22.0git  lib/libMLIRAnalysis.so.22.0git  lib/libMLIRLoopLikeInterface.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRPresburger.so.22.0git  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRInferStridedMetadataInterface.so.22.0git  lib/libMLIRMemOpInterfaces.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRArithUtils.so.22.0git  lib/libMLIRDialectUtils.so.22.0git  lib/libMLIRComplexDialect.so.22.0git  lib/libMLIRArithDialect.so.22.0git  lib/libMLIRCastInterfaces.so.22.0git  lib/libMLIRInferIntRangeCommon.so.22.0git  lib/libMLIRInferIntRangeInterface.so.22.0git  lib/libMLIRUBDialect.so.22.0git  lib/libMLIRDialect.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRDestinationStyleOpInterface.so.22.0git  lib/libMLIRParallelCombiningOpInterface.so.22.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git  lib/libMLIRShapedOpInterfaces.so.22.0git  lib/libMLIRViewLikeInterface.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.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/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o: in function `(anonymous namespace)::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const':
SCF.cpp:(.text._ZNK12_GLOBAL__N_115WhileMoveIfDown15matchAndRewriteEN4mlir3scf7WhileOpERNS1_15PatternRewriterE+0x535): undefined reference to `mlir::visitUsedValuesDefinedAbove(llvm::MutableArrayRef<mlir::Region>, llvm::function_ref<void (mlir::OpOperand*)>)'
collect2: error: ld returned 1 exit status
[6848/8221] Building AMDGPUGenAsmMatcher.inc...
[6849/8221] Building AMDGPUGenRegisterBank.inc...
[6850/8221] Building AMDGPUGenRegisterInfo.inc...
[6851/8221] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6852/8221] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6853/8221] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6854/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6855/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6856/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6857/8221] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6858/8221] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
Step 7 (build cmake config) failure: build cmake config (failure)
...
                 from /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:27:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘virtual llvm::LogicalResult {anonymous}::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:3748:70: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 3747 |     assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 3748 |                                  *ifOp->user_begin() == conditionOp) &&
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 3749 |                                     "ifOp has unexpected uses");
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~        
[6847/8221] Linking CXX shared library lib/libMLIRSCFDialect.so.22.0git
FAILED: lib/libMLIRSCFDialect.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,libMLIRSCFDialect.so.22.0git -o lib/libMLIRSCFDialect.so.22.0git tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/DeviceMappingInterface.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib:"  lib/libMLIRControlFlowDialect.so.22.0git  lib/libMLIRTensorDialect.so.22.0git  lib/libMLIRAffineDialect.so.22.0git  lib/libMLIRMemRefDialect.so.22.0git  lib/libMLIRValueBoundsOpInterface.so.22.0git  lib/libMLIRAnalysis.so.22.0git  lib/libMLIRLoopLikeInterface.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRPresburger.so.22.0git  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRInferStridedMetadataInterface.so.22.0git  lib/libMLIRMemOpInterfaces.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRArithUtils.so.22.0git  lib/libMLIRDialectUtils.so.22.0git  lib/libMLIRComplexDialect.so.22.0git  lib/libMLIRArithDialect.so.22.0git  lib/libMLIRCastInterfaces.so.22.0git  lib/libMLIRInferIntRangeCommon.so.22.0git  lib/libMLIRInferIntRangeInterface.so.22.0git  lib/libMLIRUBDialect.so.22.0git  lib/libMLIRDialect.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRDestinationStyleOpInterface.so.22.0git  lib/libMLIRParallelCombiningOpInterface.so.22.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git  lib/libMLIRShapedOpInterfaces.so.22.0git  lib/libMLIRViewLikeInterface.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.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/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o: in function `(anonymous namespace)::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const':
SCF.cpp:(.text._ZNK12_GLOBAL__N_115WhileMoveIfDown15matchAndRewriteEN4mlir3scf7WhileOpERNS1_15PatternRewriterE+0x535): undefined reference to `mlir::visitUsedValuesDefinedAbove(llvm::MutableArrayRef<mlir::Region>, llvm::function_ref<void (mlir::OpOperand*)>)'
collect2: error: ld returned 1 exit status
[6848/8221] Building AMDGPUGenAsmMatcher.inc...
[6849/8221] Building AMDGPUGenRegisterBank.inc...
[6850/8221] Building AMDGPUGenRegisterInfo.inc...
[6851/8221] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6852/8221] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6853/8221] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6854/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6855/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6856/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6857/8221] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6858/8221] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
program finished with exit code 0
elapsedTime=149.325719

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 1, 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/29292

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)
...
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:27:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘virtual llvm::LogicalResult {anonymous}::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:3748:70: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 3747 |     assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 3748 |                                  *ifOp->user_begin() == conditionOp) &&
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 3749 |                                     "ifOp has unexpected uses");
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~        
[6852/8221] Linking CXX shared library lib/libMLIRSCFDialect.so.22.0git
FAILED: lib/libMLIRSCFDialect.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,libMLIRSCFDialect.so.22.0git -o lib/libMLIRSCFDialect.so.22.0git tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/DeviceMappingInterface.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRControlFlowDialect.so.22.0git  lib/libMLIRTensorDialect.so.22.0git  lib/libMLIRAffineDialect.so.22.0git  lib/libMLIRMemRefDialect.so.22.0git  lib/libMLIRValueBoundsOpInterface.so.22.0git  lib/libMLIRAnalysis.so.22.0git  lib/libMLIRLoopLikeInterface.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRPresburger.so.22.0git  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRInferStridedMetadataInterface.so.22.0git  lib/libMLIRMemOpInterfaces.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRArithUtils.so.22.0git  lib/libMLIRDialectUtils.so.22.0git  lib/libMLIRComplexDialect.so.22.0git  lib/libMLIRArithDialect.so.22.0git  lib/libMLIRCastInterfaces.so.22.0git  lib/libMLIRInferIntRangeCommon.so.22.0git  lib/libMLIRInferIntRangeInterface.so.22.0git  lib/libMLIRUBDialect.so.22.0git  lib/libMLIRDialect.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRDestinationStyleOpInterface.so.22.0git  lib/libMLIRParallelCombiningOpInterface.so.22.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git  lib/libMLIRShapedOpInterfaces.so.22.0git  lib/libMLIRViewLikeInterface.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.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/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o: in function `(anonymous namespace)::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const':
SCF.cpp:(.text._ZNK12_GLOBAL__N_115WhileMoveIfDown15matchAndRewriteEN4mlir3scf7WhileOpERNS1_15PatternRewriterE+0x4e4): undefined reference to `mlir::visitUsedValuesDefinedAbove(llvm::MutableArrayRef<mlir::Region>, llvm::function_ref<void (mlir::OpOperand*)>)'
collect2: error: ld returned 1 exit status
[6853/8221] Building AMDGPUGenRegisterBank.inc...
[6854/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6855/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6856/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6857/8221] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6858/8221] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6859/8221] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6860/8221] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
Step 7 (build cmake config) failure: build cmake config (failure)
...
                 from /home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:27:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘virtual llvm::LogicalResult {anonymous}::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const’:
/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:3748:70: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
 3747 |     assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
 3748 |                                  *ifOp->user_begin() == conditionOp) &&
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 3749 |                                     "ifOp has unexpected uses");
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~        
[6852/8221] Linking CXX shared library lib/libMLIRSCFDialect.so.22.0git
FAILED: lib/libMLIRSCFDialect.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,libMLIRSCFDialect.so.22.0git -o lib/libMLIRSCFDialect.so.22.0git tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/DeviceMappingInterface.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/lib:"  lib/libMLIRControlFlowDialect.so.22.0git  lib/libMLIRTensorDialect.so.22.0git  lib/libMLIRAffineDialect.so.22.0git  lib/libMLIRMemRefDialect.so.22.0git  lib/libMLIRValueBoundsOpInterface.so.22.0git  lib/libMLIRAnalysis.so.22.0git  lib/libMLIRLoopLikeInterface.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRPresburger.so.22.0git  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRInferStridedMetadataInterface.so.22.0git  lib/libMLIRMemOpInterfaces.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRArithUtils.so.22.0git  lib/libMLIRDialectUtils.so.22.0git  lib/libMLIRComplexDialect.so.22.0git  lib/libMLIRArithDialect.so.22.0git  lib/libMLIRCastInterfaces.so.22.0git  lib/libMLIRInferIntRangeCommon.so.22.0git  lib/libMLIRInferIntRangeInterface.so.22.0git  lib/libMLIRUBDialect.so.22.0git  lib/libMLIRDialect.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRDestinationStyleOpInterface.so.22.0git  lib/libMLIRParallelCombiningOpInterface.so.22.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git  lib/libMLIRShapedOpInterfaces.so.22.0git  lib/libMLIRViewLikeInterface.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.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/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o: in function `(anonymous namespace)::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const':
SCF.cpp:(.text._ZNK12_GLOBAL__N_115WhileMoveIfDown15matchAndRewriteEN4mlir3scf7WhileOpERNS1_15PatternRewriterE+0x4e4): undefined reference to `mlir::visitUsedValuesDefinedAbove(llvm::MutableArrayRef<mlir::Region>, llvm::function_ref<void (mlir::OpOperand*)>)'
collect2: error: ld returned 1 exit status
[6853/8221] Building AMDGPUGenRegisterBank.inc...
[6854/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6855/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6856/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6857/8221] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6858/8221] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6859/8221] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6860/8221] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/build/../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-9-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
program finished with exit code 0
elapsedTime=105.166073

@llvm-ci
Copy link
Collaborator

llvm-ci commented Dec 1, 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/29313

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/mlir/lib/Dialect/SCF/IR/SCF.cpp:3748:70: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
     assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
                                  *ifOp->user_begin() == conditionOp) &&
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                     "ifOp has unexpected uses");
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~        
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
[6848/8221] Linking CXX shared library lib/libMLIRSCFDialect.so.22.0git
FAILED: lib/libMLIRSCFDialect.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,libMLIRSCFDialect.so.22.0git -o lib/libMLIRSCFDialect.so.22.0git tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/DeviceMappingInterface.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRControlFlowDialect.so.22.0git  lib/libMLIRTensorDialect.so.22.0git  lib/libMLIRAffineDialect.so.22.0git  lib/libMLIRMemRefDialect.so.22.0git  lib/libMLIRValueBoundsOpInterface.so.22.0git  lib/libMLIRAnalysis.so.22.0git  lib/libMLIRLoopLikeInterface.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRPresburger.so.22.0git  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRInferStridedMetadataInterface.so.22.0git  lib/libMLIRMemOpInterfaces.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRArithUtils.so.22.0git  lib/libMLIRDialectUtils.so.22.0git  lib/libMLIRComplexDialect.so.22.0git  lib/libMLIRArithDialect.so.22.0git  lib/libMLIRCastInterfaces.so.22.0git  lib/libMLIRInferIntRangeCommon.so.22.0git  lib/libMLIRInferIntRangeInterface.so.22.0git  lib/libMLIRUBDialect.so.22.0git  lib/libMLIRDialect.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRDestinationStyleOpInterface.so.22.0git  lib/libMLIRParallelCombiningOpInterface.so.22.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git  lib/libMLIRShapedOpInterfaces.so.22.0git  lib/libMLIRViewLikeInterface.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  -lpthread  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o: In function `(anonymous namespace)::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const':
SCF.cpp:(.text._ZNK12_GLOBAL__N_115WhileMoveIfDown15matchAndRewriteEN4mlir3scf7WhileOpERNS1_15PatternRewriterE+0x524): undefined reference to `mlir::visitUsedValuesDefinedAbove(llvm::MutableArrayRef<mlir::Region>, llvm::function_ref<void (mlir::OpOperand*)>)'
collect2: error: ld returned 1 exit status
[6849/8221] Building AMDGPUGenRegisterInfo.inc...
[6850/8221] Building AMDGPUGenRegisterBank.inc...
[6851/8221] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6852/8221] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6853/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6854/8221] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6855/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6856/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6857/8221] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6858/8221] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
@@@STEP_FAILURE@@@
Step 7 (build cmake config) failure: build cmake config (failure)
...
/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-project/mlir/lib/Dialect/SCF/IR/SCF.cpp:3748:70: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
     assert(ifOp->use_empty() || (llvm::all_equal(ifOp->getUsers()) &&
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
                                  *ifOp->user_begin() == conditionOp) &&
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                                     "ifOp has unexpected uses");
                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~        
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
[6848/8221] Linking CXX shared library lib/libMLIRSCFDialect.so.22.0git
FAILED: lib/libMLIRSCFDialect.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,libMLIRSCFDialect.so.22.0git -o lib/libMLIRSCFDialect.so.22.0git tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/DeviceMappingInterface.cpp.o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/ValueBoundsOpInterfaceImpl.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib:/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib:"  lib/libMLIRControlFlowDialect.so.22.0git  lib/libMLIRTensorDialect.so.22.0git  lib/libMLIRAffineDialect.so.22.0git  lib/libMLIRMemRefDialect.so.22.0git  lib/libMLIRValueBoundsOpInterface.so.22.0git  lib/libMLIRAnalysis.so.22.0git  lib/libMLIRLoopLikeInterface.so.22.0git  lib/libMLIRFunctionInterfaces.so.22.0git  lib/libMLIRSideEffectInterfaces.so.22.0git  lib/libMLIRCallInterfaces.so.22.0git  lib/libMLIRDataLayoutInterfaces.so.22.0git  lib/libMLIRPresburger.so.22.0git  lib/libMLIRControlFlowInterfaces.so.22.0git  lib/libMLIRInferStridedMetadataInterface.so.22.0git  lib/libMLIRMemOpInterfaces.so.22.0git  lib/libMLIRMemorySlotInterfaces.so.22.0git  lib/libMLIRArithUtils.so.22.0git  lib/libMLIRDialectUtils.so.22.0git  lib/libMLIRComplexDialect.so.22.0git  lib/libMLIRArithDialect.so.22.0git  lib/libMLIRCastInterfaces.so.22.0git  lib/libMLIRInferIntRangeCommon.so.22.0git  lib/libMLIRInferIntRangeInterface.so.22.0git  lib/libMLIRUBDialect.so.22.0git  lib/libMLIRDialect.so.22.0git  lib/libMLIRInferTypeOpInterface.so.22.0git  lib/libMLIRDestinationStyleOpInterface.so.22.0git  lib/libMLIRParallelCombiningOpInterface.so.22.0git  lib/libMLIRRuntimeVerifiableOpInterface.so.22.0git  lib/libMLIRShapedOpInterfaces.so.22.0git  lib/libMLIRViewLikeInterface.so.22.0git  lib/libMLIRIR.so.22.0git  lib/libMLIRSupport.so.22.0git  -lpthread  lib/libLLVMSupport.so.22.0git  -Wl,-rpath-link,/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/build/lib && :
tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o: In function `(anonymous namespace)::WhileMoveIfDown::matchAndRewrite(mlir::scf::WhileOp, mlir::PatternRewriter&) const':
SCF.cpp:(.text._ZNK12_GLOBAL__N_115WhileMoveIfDown15matchAndRewriteEN4mlir3scf7WhileOpERNS1_15PatternRewriterE+0x524): undefined reference to `mlir::visitUsedValuesDefinedAbove(llvm::MutableArrayRef<mlir::Region>, llvm::function_ref<void (mlir::OpOperand*)>)'
collect2: error: ld returned 1 exit status
[6849/8221] Building AMDGPUGenRegisterInfo.inc...
[6850/8221] Building AMDGPUGenRegisterBank.inc...
[6851/8221] Building CXX object tools/flang/lib/Support/CMakeFiles/FortranSupport.dir/OpenMP-utils.cpp.o
[6852/8221] Building CXX object tools/flang/lib/Evaluate/CMakeFiles/FortranEvaluate.dir/cmake_pch.hxx.gch
[6853/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/intrinsics.test.dir/intrinsics.cpp.o
[6854/8221] Building CXX object tools/flang/lib/Parser/CMakeFiles/FortranParser.dir/cmake_pch.hxx.gch
[6855/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/expression.test.dir/expression.cpp.o
[6856/8221] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/folding.test.dir/folding.cpp.o
[6857/8221] Building CXX object tools/flang/lib/Semantics/CMakeFiles/FortranSemantics.dir/cmake_pch.hxx.gch
[6858/8221] Building CXX object tools/flang/tools/f18-parse-demo/CMakeFiles/f18-parse-demo.dir/f18-parse-demo.cpp.o
ninja: build stopped: subcommand failed.
['ninja'] exited with return code 1.
The build step threw an exception...
Traceback (most recent call last):
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 62, in step
    yield
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 53, in main
    run_command(["ninja"])
  File "../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py", line 75, in run_command
    util.report_run_cmd(cmd, cwd=directory)
  File "/home/botworker/bbot/amdgpu-offload-rhel-8-cmake-build-only/llvm-zorg/zorg/buildbot/builders/annotated/util.py", line 49, in report_run_cmd
    subprocess.check_call(cmd, shell=shell, *args, **kwargs)
  File "/usr/lib64/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ninja']' returned non-zero exit status 1.
program finished with exit code 0
elapsedTime=96.812171

@jplehr
Copy link
Contributor

jplehr commented Dec 1, 2025

I put up #170107 to add the missing MLIR library in linking.

aahrun pushed a commit to aahrun/llvm-project that referenced this pull request Dec 1, 2025
…n into after region (llvm#169892)

When a `scf.if` directly precedes a `scf.condition` in the before region
of a `scf.while` and both share the same condition, move the if into the
after region of the loop. This helps simplify the control flow to enable
uplifting `scf.while` to `scf.for`.
aahrun pushed a commit to aahrun/llvm-project that referenced this pull request Dec 1, 2025
…er region in scf-uplift-while-to-for" (llvm#169888)

Reverts llvm#165216
It is implemented in llvm#169892 .
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
…n into after region (llvm#169892)

When a `scf.if` directly precedes a `scf.condition` in the before region
of a `scf.while` and both share the same condition, move the if into the
after region of the loop. This helps simplify the control flow to enable
uplifting `scf.while` to `scf.for`.
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
…er region in scf-uplift-while-to-for" (llvm#169888)

Reverts llvm#165216
It is implemented in llvm#169892 .
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