Skip to content

Conversation

andykaylor
Copy link
Contributor

We need to be able to read in and parse files using the ClangIR dialect in order to test this part of the functionality.

This change adds the minimum cir-opt tool needed to read and parse cir files and write them back to text. This tool will later be extended to add features for lowering from CIR to other MLIR dialects and to run CIR passes as they are upstreamed.

Parsing of text-based MLIR files is part of any MLIR dialect, so we
need to be able to read in files using the ClangIR dialect in order
to test this part of the functionality.

This change adds the minimum cir-opt tool needed to read and parse
cir files and write them back to text. This tool will later be
extended to add features for lowering from CIR to other MLIR dialects
and to run CIR passes as they are added.
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Feb 22, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2025

@llvm/pr-subscribers-clangir

@llvm/pr-subscribers-clang

Author: Andy Kaylor (andykaylor)

Changes

We need to be able to read in and parse files using the ClangIR dialect in order to test this part of the functionality.

This change adds the minimum cir-opt tool needed to read and parse cir files and write them back to text. This tool will later be extended to add features for lowering from CIR to other MLIR dialects and to run CIR passes as they are upstreamed.


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

9 Files Affected:

  • (added) clang/include/clang/CIR/Passes.h (+19)
  • (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+3-2)
  • (added) clang/test/CIR/IR/func.cir (+85)
  • (added) clang/test/CIR/IR/global.cir (+69)
  • (modified) clang/test/CMakeLists.txt (+7-1)
  • (modified) clang/test/lit.cfg.py (+2)
  • (modified) clang/tools/CMakeLists.txt (+3)
  • (added) clang/tools/cir-opt/CMakeLists.txt (+32)
  • (added) clang/tools/cir-opt/cir-opt.cpp (+46)
diff --git a/clang/include/clang/CIR/Passes.h b/clang/include/clang/CIR/Passes.h
new file mode 100644
index 0000000000000..eec9819d584b4
--- /dev/null
+++ b/clang/include/clang/CIR/Passes.h
@@ -0,0 +1,19 @@
+#ifndef CLANG_CIR_PASSES_H
+#define CLANG_CIR_PASSES_H
+
+#include "mlir/Pass/Pass.h"
+
+#include <memory>
+
+namespace cir {
+namespace direct {
+/// Create a pass that fully lowers CIR to the LLVMIR dialect.
+std::unique_ptr<mlir::Pass> createConvertCIRToLLVMPass();
+
+/// Adds passes that fully lower CIR to the LLVMIR dialect.
+void populateCIRToLLVMPasses(mlir::OpPassManager &pm);
+
+} // namespace direct
+} // end namespace cir
+
+#endif // CLANG_CIR_PASSES_H
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 235b5a057852a..ba7fab2865116 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -27,6 +27,7 @@
 #include "clang/CIR/Dialect/IR/CIRAttrVisitor.h"
 #include "clang/CIR/Dialect/IR/CIRDialect.h"
 #include "clang/CIR/MissingFeatures.h"
+#include "clang/CIR/Passes.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/TimeProfiler.h"
 
@@ -304,11 +305,11 @@ void ConvertCIRToLLVMPass::runOnOperation() {
     signalPassFailure();
 }
 
-static std::unique_ptr<mlir::Pass> createConvertCIRToLLVMPass() {
+std::unique_ptr<mlir::Pass> createConvertCIRToLLVMPass() {
   return std::make_unique<ConvertCIRToLLVMPass>();
 }
 
-static void populateCIRToLLVMPasses(mlir::OpPassManager &pm) {
+void populateCIRToLLVMPasses(mlir::OpPassManager &pm) {
   pm.addPass(createConvertCIRToLLVMPass());
 }
 
diff --git a/clang/test/CIR/IR/func.cir b/clang/test/CIR/IR/func.cir
new file mode 100644
index 0000000000000..a32c3e697ed25
--- /dev/null
+++ b/clang/test/CIR/IR/func.cir
@@ -0,0 +1,85 @@
+// RUN: cir-opt %s | FileCheck %s
+
+module {
+// void empty() { }
+cir.func @empty() -> !cir.void {
+  cir.return
+}
+// CHECK: cir.func @empty() -> !cir.void {
+// CHECK:   cir.return
+// CHECK: }
+
+// void voidret() { return; }
+cir.func @voidret() -> !cir.void {
+  cir.return
+}
+// CHECK: cir.func @voidret() -> !cir.void {
+// CHECK:   cir.return
+// CHECK: }
+
+// int intfunc() { return 42; }
+cir.func @intfunc() -> !cir.int<s, 32> {
+  %0 = cir.const #cir.int<42> : !cir.int<s, 32>
+  cir.return %0 : !cir.int<s, 32>
+}
+// CHECK: cir.func @intfunc() -> !cir.int<s, 32> {
+// CHECK:   %[[VAL:.*]] = cir.const #cir.int<42> : !cir.int<s, 32>
+// CHECK:   cir.return %[[VAL]] : !cir.int<s, 32>
+// CHECK: }
+
+// int scopes() {
+//  {
+//    {
+//      return 99;
+//    }
+//  }
+//}
+cir.func @scopes() -> !cir.int<s, 32> {
+  cir.scope {
+    cir.scope {
+      %0 = cir.const #cir.int<99> : !cir.int<s, 32>
+      cir.return %0 : !cir.int<s, 32>
+    }
+  }
+  cir.trap
+}
+// CHECK: cir.func @scopes() -> !cir.int<s, 32> {
+// CHECK:   cir.scope {
+// CHECK:     cir.scope {
+// CHECK:       %[[VAL:.*]] = cir.const #cir.int<99> : !cir.int<s, 32>
+// CHECK:       cir.return %[[VAL]] : !cir.int<s, 32>
+// CHECK:     }
+// CHECK:   }
+// CHECK:   cir.trap
+// CHECK: }
+
+// long longfunc() { return 42l; }
+cir.func @longfunc() -> !cir.int<s, 64> {
+  %0 = cir.const #cir.int<42> : !cir.int<s, 64>
+  cir.return %0 : !cir.int<s, 64>
+}
+// CHECK: cir.func @longfunc() -> !cir.int<s, 64>
+// CHECK:   %0 = cir.const #cir.int<42> : !cir.int<s, 64>
+// CHECK:   cir.return %0 : !cir.int<s, 64>
+// CHECK: }
+
+// unsigned unsignedfunc() { return 42u; }
+cir.func @unsignedfunc() -> !cir.int<u, 32> {
+  %0 = cir.const #cir.int<42> : !cir.int<u, 32>
+  cir.return %0 : !cir.int<u, 32>
+}
+// CHECK: cir.func @unsignedfunc() -> !cir.int<u, 32>
+// CHECK:   %[[VAL:.*]] = cir.const #cir.int<42> : !cir.int<u, 32>
+// CHECK:   cir.return %[[VAL]] : !cir.int<u, 32>
+// CHECK: }
+
+// unsigned long long ullfunc() { return 42ull; }
+cir.func @ullfunc() -> !cir.int<u, 64> {
+  %0 = cir.const #cir.int<42> : !cir.int<u, 64>
+  cir.return %0 : !cir.int<u, 64>
+}
+// CHECK: cir.func @ullfunc() -> !cir.int<u, 64>
+// CHECK:   %[[VAL:.*]] = cir.const #cir.int<42> : !cir.int<u, 64>
+// CHECK:   cir.return %[[VAL:.*]] : !cir.int<u, 64>
+// CHECK: }
+}
diff --git a/clang/test/CIR/IR/global.cir b/clang/test/CIR/IR/global.cir
new file mode 100644
index 0000000000000..6c68ab0a501ff
--- /dev/null
+++ b/clang/test/CIR/IR/global.cir
@@ -0,0 +1,69 @@
+// RUN: cir-opt %s -o - | FileCheck %s
+
+module attributes {cir.triple = "x86_64-unknown-linux-gnu"} {
+  cir.global @c : !cir.int<s, 8>
+  cir.global @sc : !cir.int<s, 8>
+  cir.global @uc : !cir.int<u, 8>
+  cir.global @ss : !cir.int<s, 16>
+  cir.global @us = #cir.int<100> : !cir.int<u, 16>
+  cir.global @si = #cir.int<42> : !cir.int<s, 32>
+  cir.global @ui : !cir.int<u, 32>
+  cir.global @sl : !cir.int<s, 64>
+  cir.global @ul : !cir.int<u, 64>
+  cir.global @sll : !cir.int<s, 64>
+  cir.global @ull = #cir.int<123456> : !cir.int<u, 64>
+  cir.global @s128 : !cir.int<s, 128>
+  cir.global @u128 : !cir.int<u, 128>
+  cir.global @wc : !cir.int<s, 32>
+  cir.global @c8 : !cir.int<u, 8>
+  cir.global @c16 : !cir.int<u, 16>
+  cir.global @c32 : !cir.int<u, 32>
+  cir.global @sb20 : !cir.int<s, 20>
+  cir.global @ub48 : !cir.int<u, 48>
+  cir.global @f16 : !cir.f16
+  cir.global @bf16 : !cir.bf16
+  cir.global @f : !cir.float
+  cir.global @d = #cir.fp<1.250000e+00> : !cir.double
+  cir.global @ld : !cir.long_double<!cir.f80>
+  cir.global @f128 : !cir.f128
+  cir.global @vp : !cir.ptr<!cir.void>
+  cir.global @ip = #cir.ptr<null> : !cir.ptr<!cir.int<s, 32>>
+  cir.global @dp : !cir.ptr<!cir.double>
+  cir.global @cpp : !cir.ptr<!cir.ptr<!cir.int<s, 8>>>
+  cir.global @fp : !cir.ptr<!cir.func<!cir.void ()>>
+  cir.global @fpii = #cir.ptr<null> : !cir.ptr<!cir.func<!cir.int<s, 32> (!cir.int<s, 32>)>>
+  cir.global @fpvar : !cir.ptr<!cir.func<!cir.void (!cir.int<s, 32>, ...)>>
+}
+
+// CHECK: cir.global @c : !cir.int<s, 8>
+// CHECK: cir.global @sc : !cir.int<s, 8>
+// CHECK: cir.global @uc : !cir.int<u, 8>
+// CHECK: cir.global @ss : !cir.int<s, 16>
+// CHECK: cir.global @us = #cir.int<100>
+// CHECK: cir.global @si = #cir.int<42>
+// CHECK: cir.global @ui : !cir.int<u, 32>
+// CHECK: cir.global @sl : !cir.int<s, 64>
+// CHECK: cir.global @ul : !cir.int<u, 64>
+// CHECK: cir.global @sll : !cir.int<s, 64>
+// CHECK: cir.global @ull = #cir.int<123456> : !cir.int<u, 64>
+// CHECK: cir.global @s128 : !cir.int<s, 128>
+// CHECK: cir.global @u128 : !cir.int<u, 128>
+// CHECK: cir.global @wc : !cir.int<s, 32>
+// CHECK: cir.global @c8 : !cir.int<u, 8>
+// CHECK: cir.global @c16 : !cir.int<u, 16>
+// CHECK: cir.global @c32 : !cir.int<u, 32>
+// CHECK: cir.global @sb20 : !cir.int<s, 20>
+// CHECK: cir.global @ub48 : !cir.int<u, 48>
+// CHECK: cir.global @f16 : !cir.f16
+// CHECK: cir.global @bf16 : !cir.bf16
+// CHECK: cir.global @f : !cir.float
+// CHECK: cir.global @d = #cir.fp<1.250000e+00> : !cir.double
+// CHECK: cir.global @ld : !cir.long_double<!cir.f80>
+// CHECK: cir.global @f128 : !cir.f128
+// CHECK: cir.global @vp : !cir.ptr<!cir.void>
+// CHECK: cir.global @ip = #cir.ptr<null> : !cir.ptr<!cir.int<s, 32>>
+// CHECK: cir.global @dp : !cir.ptr<!cir.double>
+// CHECK: cir.global @cpp : !cir.ptr<!cir.ptr<!cir.int<s, 8>>>
+// CHECK: cir.global @fp : !cir.ptr<!cir.func<!cir.void ()>>
+// CHECK: cir.global @fpii = #cir.ptr<null> : !cir.ptr<!cir.func<!cir.int<s, 32> (!cir.int<s, 32>)>>
+// CHECK: cir.global @fpvar : !cir.ptr<!cir.func<!cir.void (!cir.int<s, 32>, ...)>>
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 4ff81e7055c57..1c93e2b0d9844 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -85,7 +85,13 @@ list(APPEND CLANG_TEST_DEPS
   diagtool
   hmaptool
   )
-  
+
+if(CLANG_ENABLE_CIR)
+  list(APPEND CLANG_TEST_DEPS
+    cir-opt
+    )
+endif()
+
 if(CLANG_ENABLE_STATIC_ANALYZER)
   list(APPEND CLANG_TEST_DEPS
     clang-check
diff --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index e4b39c4f71597..9820ddd1f14af 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -29,6 +29,7 @@
     ".c",
     ".cpp",
     ".i",
+    ".cir",
     ".cppm",
     ".m",
     ".mm",
@@ -85,6 +86,7 @@
 tools = [
     "apinotes-test",
     "c-index-test",
+    "cir-opt",
     "clang-diff",
     "clang-format",
     "clang-repl",
diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index de0b47f3751f1..ae3414e177192 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -3,6 +3,9 @@ create_subdirectory_options(CLANG TOOL)
 add_clang_subdirectory(diagtool)
 add_clang_subdirectory(driver)
 add_clang_subdirectory(apinotes-test)
+if(CLANG_ENABLE_CIR)
+  add_clang_subdirectory(cir-opt)
+endif()
 add_clang_subdirectory(clang-diff)
 add_clang_subdirectory(clang-format)
 add_clang_subdirectory(clang-fuzzer)
diff --git a/clang/tools/cir-opt/CMakeLists.txt b/clang/tools/cir-opt/CMakeLists.txt
new file mode 100644
index 0000000000000..75bec5f4e1b0b
--- /dev/null
+++ b/clang/tools/cir-opt/CMakeLists.txt
@@ -0,0 +1,32 @@
+get_property(dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
+get_property(conversion_libs GLOBAL PROPERTY MLIR_CONVERSION_LIBS)
+
+include_directories(${LLVM_MAIN_SRC_DIR}/../mlir/include)
+include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include)
+
+add_clang_tool(cir-opt
+  cir-opt.cpp
+)
+
+clang_target_link_libraries(cir-opt
+  PRIVATE
+  clangCIR
+  clangCIRLoweringDirectToLLVM
+  MLIRCIR
+)
+
+target_link_libraries(cir-opt
+  PRIVATE
+  ${dialect_libs}
+  ${conversion_libs}
+  MLIRAnalysis
+  MLIRDialect
+  MLIRIR
+  MLIRMemRefDialect
+  MLIROptLib
+  MLIRParser
+  MLIRPass
+  MLIRSideEffectInterfaces
+  MLIRTransforms
+  MLIRTransformUtils
+)
diff --git a/clang/tools/cir-opt/cir-opt.cpp b/clang/tools/cir-opt/cir-opt.cpp
new file mode 100644
index 0000000000000..1dff915946bcd
--- /dev/null
+++ b/clang/tools/cir-opt/cir-opt.cpp
@@ -0,0 +1,46 @@
+//===- cir-opt.cpp - CIR optimization and analysis driver -----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Similar to MLIR/LLVM's "opt" tools but also deals with analysis and custom
+// arguments. TODO: this is basically a copy from MlirOptMain.cpp, but capable
+// of module emission as specified by the user.
+//
+//===----------------------------------------------------------------------===//
+
+#include "mlir/Conversion/ReconcileUnrealizedCasts/ReconcileUnrealizedCasts.h"
+#include "mlir/Dialect/Func/IR/FuncOps.h"
+#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
+#include "mlir/Dialect/MemRef/IR/MemRef.h"
+#include "mlir/InitAllPasses.h"
+#include "mlir/Pass/PassManager.h"
+#include "mlir/Pass/PassOptions.h"
+#include "mlir/Pass/PassRegistry.h"
+#include "mlir/Tools/mlir-opt/MlirOptMain.h"
+#include "clang/CIR/Dialect/IR/CIRDialect.h"
+#include "clang/CIR/Passes.h"
+
+struct CIRToLLVMPipelineOptions
+    : public mlir::PassPipelineOptions<CIRToLLVMPipelineOptions> {};
+
+int main(int argc, char **argv) {
+  // TODO: register needed MLIR passes for CIR?
+  mlir::DialectRegistry registry;
+  registry.insert<mlir::BuiltinDialect, cir::CIRDialect,
+                  mlir::memref::MemRefDialect, mlir::LLVM::LLVMDialect>();
+
+  mlir::PassPipelineRegistration<CIRToLLVMPipelineOptions> pipeline(
+      "cir-to-llvm", "",
+      [](mlir::OpPassManager &pm, const CIRToLLVMPipelineOptions &options) {
+        cir::direct::populateCIRToLLVMPasses(pm);
+      });
+
+  mlir::registerTransformsPasses();
+
+  return failed(MlirOptMain(
+      argc, argv, "Clang IR analysis and optimization tool\n", registry));
+}

Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +8 to +9
namespace cir {
namespace direct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
namespace cir {
namespace direct {
namespace cir::direct {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There will eventually be things in this file that are in the cir namespace, but not in the cir::direct namespace, so I'd prefer to keep it separate.

@@ -0,0 +1,46 @@
//===- cir-opt.cpp - CIR optimization and analysis driver -----*- C++ -*-===//
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the LLVM coding rules changed recently about these lines which are no longer required as Emacs made some progress.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I wasn't aware of that. I'll update this. I see that I also missed the file header on one of the other files I'm adding.

PRIVATE
clangCIR
clangCIRLoweringDirectToLLVM
MLIRCIR
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: MLIRCIR comes transitively from clangCIR no need for it here

Copy link
Contributor Author

@andykaylor andykaylor Feb 24, 2025

Choose a reason for hiding this comment

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

A shared library build fails with _ZN4mlir6detail14TypeIDResolverIN3cir10CIRDialectEvE2idE as an unresolved symbol if I remove this.

Copy link
Contributor

@xlauko xlauko left a comment

Choose a reason for hiding this comment

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

LGTM


mlir::registerTransformsPasses();

return failed(MlirOptMain(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return failed(MlirOptMain(
return mlir::asMainReturnCode(MlirOptMain(

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

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

LGTM

@andykaylor andykaylor merged commit 607a1f2 into llvm:main Feb 24, 2025
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 25, 2025

LLVM Buildbot has detected a new failure on builder clang-s390x-linux running on systemz-1 while building clang at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'libFuzzer-s390x-default-Linux :: fuzzer-timeout.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer  /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest
RUN: at line 2: /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang    -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer  /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutEmptyTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutEmptyTest
+ /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/./bin/clang -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/lib/fuzzer /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/TimeoutEmptyTest.cpp -o /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutEmptyTest
RUN: at line 3: not  /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1 2>&1 | FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=TimeoutTest
+ not /home/uweigand/sandbox/buildbot/clang-s390x-linux/stage1/runtimes/runtimes-bins/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/fuzzer-timeout.test.tmp-TimeoutTest -timeout=1
+ FileCheck /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test --check-prefix=TimeoutTest
/home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test:7:14: error: TimeoutTest: expected string not found in input
TimeoutTest: #0
             ^
<stdin>:19:44: note: scanning from here
==2481826== ERROR: libFuzzer: timeout after 1 seconds
                                           ^
<stdin>:24:104: note: possible intended match here
AddressSanitizer: CHECK failed: asan_report.cpp:199 "((current_error_.kind)) == ((kErrorKindInvalid))" (0x1, 0x0) (tid=2481826)
                                                                                                       ^

Input file: <stdin>
Check file: /home/uweigand/sandbox/buildbot/clang-s390x-linux/llvm/compiler-rt/test/fuzzer/fuzzer-timeout.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           .
           .
           .
          14: MS: 1 InsertByte-; base unit: 94dd9e08c129c785f7f256e82fbe0a30e6d1ae40 
          15: 0x48,0x69,0x21, 
          16: Hi! 
          17: artifact_prefix='./'; Test unit written to ./timeout-c0a0ad26a634840c67a210fefdda76577b03a111 
          18: Base64: SGkh 
          19: ==2481826== ERROR: libFuzzer: timeout after 1 seconds 
check:7'0                                                X~~~~~~~~~~ error: no match found
          20: AddressSanitizer:DEADLYSIGNAL 
check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          21: ================================================================= 
check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          22: AddressSanitizer:DEADLYSIGNAL 
check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          23: ================================================================= 
check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          24: AddressSanitizer: CHECK failed: asan_report.cpp:199 "((current_error_.kind)) == ((kErrorKindInvalid))" (0x1, 0x0) (tid=2481826) 
check:7'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:7'1                                                                                                            ?                         possible intended match
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 25, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64-aix running on aix-ppc64 while building clang at step 3 "clean-build-dir".

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

Here is the relevant piece of the build log for the reference
Step 3 (clean-build-dir) failure: Delete failed. (failure) (timed out)
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: ClangScanDeps/verbose.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 1: rm -rf /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
+ rm -rf /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
RUN: at line 2: split-file /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
+ split-file /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp
RUN: at line 3: sed -e "s|DIR|/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp|g" /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json.in > /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json
+ sed -e 's|DIR|/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp|g' /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json.in
RUN: at line 5: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/clang-scan-deps -compilation-database /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json -v -o /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/result.json 2>&1 | /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/clang-scan-deps -compilation-database /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/cdb.json -v -o /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/tools/clang/test/ClangScanDeps/Output/verbose.test.tmp/result.json
+ /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/build/bin/FileCheck /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test
/home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test:6:11: error: CHECK: expected string not found in input
// CHECK: *** Virtual File System Stats:
          ^
<stdin>:1:1: note: scanning from here
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
^
<stdin>:1:8: note: possible intended match here
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
       ^

Input file: <stdin>
Check file: /home/powerllvm/powerllvm_env/aix-ppc64/clang-ppc64-aix/llvm-project/clang/test/ClangScanDeps/verbose.test

-dump-input=help explains the following input dump.

Input was:
<<<<<<
           1: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. 
check:6'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
check:6'1            ?                                                                                                     possible intended match
>>>>>>

--

********************


@andykaylor andykaylor deleted the cir-opt branch March 4, 2025 22:52
bcardosolopes pushed a commit to bcardosolopes/llvm-project that referenced this pull request Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants