Skip to content

[CIR] Implement lowering of int-to-bool casts #132996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

andykaylor
Copy link
Contributor

Lowering of int-to-bool casts had been left as NYI because the incubator implemented it by lowering to cir.cmp, which hasn't been upstreamed yet, but there is no reason this cast can't be lowered directly to LLVM's compare operation when we're lowering directly to the LLVM dialect.

This change lowers the cast directly to an LLVM compare to zero.

Lowering of int-to-bool casts had been left as NYI because the incubator
implemented it by lowering to cir.cmp, which hasn't been upstreamed yet,
but there is no reason this cast can't be lowered directly to LLVM's
compare operation when we're lowering directly to the LLVM dialect.

This change lowers the cast directly to an LLVM compare to zero.
@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Mar 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 25, 2025

@llvm/pr-subscribers-clangir

Author: Andy Kaylor (andykaylor)

Changes

Lowering of int-to-bool casts had been left as NYI because the incubator implemented it by lowering to cir.cmp, which hasn't been upstreamed yet, but there is no reason this cast can't be lowered directly to LLVM's compare operation when we're lowering directly to the LLVM dialect.

This change lowers the cast directly to an LLVM compare to zero.


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

3 Files Affected:

  • (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+7-7)
  • (added) clang/test/CIR/CodeGen/int-to-bool.cpp (+74)
  • (modified) clang/test/CIR/Lowering/cast.cir (+3)
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 30cbee48b4bdc..913c70716c365 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -385,13 +385,13 @@ mlir::LogicalResult CIRToLLVMCastOpLowering::matchAndRewrite(
     break;
   }
   case cir::CastKind::int_to_bool: {
-    assert(!cir::MissingFeatures::opCmp());
-    mlir::Type dstType = castOp.getResult().getType();
-    mlir::Type llvmDstType = getTypeConverter()->convertType(dstType);
-    auto zeroBool = rewriter.create<mlir::LLVM::ConstantOp>(
-        castOp.getLoc(), llvmDstType, mlir::BoolAttr::get(getContext(), false));
-    rewriter.replaceOp(castOp, zeroBool);
-    return castOp.emitError() << "NYI int_to_bool cast";
+    mlir::Value llvmSrcVal = adaptor.getOperands().front();
+    mlir::Value zeroInt = rewriter.create<mlir::LLVM::ConstantOp>(
+        castOp.getLoc(), llvmSrcVal.getType(),
+        mlir::IntegerAttr::get(llvmSrcVal.getType(), 0));
+    rewriter.replaceOpWithNewOp<mlir::LLVM::ICmpOp>(
+        castOp, mlir::LLVM::ICmpPredicate::ne, llvmSrcVal, zeroInt);
+    break;
   }
   case cir::CastKind::integral: {
     mlir::Type srcType = castOp.getSrc().getType();
diff --git a/clang/test/CIR/CodeGen/int-to-bool.cpp b/clang/test/CIR/CodeGen/int-to-bool.cpp
new file mode 100644
index 0000000000000..1b915b643506f
--- /dev/null
+++ b/clang/test/CIR/CodeGen/int-to-bool.cpp
@@ -0,0 +1,74 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+bool f1(unsigned char c) {
+  return c;
+}
+
+// CIR: cir.func @f1
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !u8i), !cir.bool
+
+// Note: The full zext/store/load/trunc sequence is checked here to show what
+// CIR is being lowered to. There's no need to check it for every function since
+// the lowering is the same for all of them.
+
+// LLVM: define i1 @f1
+// LLVM:   %[[CMP:.*]] = icmp ne i8 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+// LLVM:   store i8 %[[ZEXT]], ptr %{{.*}}
+// LLVM:   %[[LOAD:.*]] = load i8, ptr %{{.*}}
+// LLVM:   %[[TRUNC:.*]] = trunc i8 %[[LOAD]] to i1
+// LLVM:   ret i1 %[[TRUNC]]
+
+// OGCG: define{{.*}} i1 @_Z2f1h
+// OGCG:   %[[CMP:.*]] = icmp ne i8 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
+
+bool f2(short s) {
+  return s;
+}
+
+// CIR: cir.func @f2
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !s16i), !cir.bool
+
+// LLVM: define i1 @f2
+// LLVM:   %[[CMP:.*]] = icmp ne i16 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+
+// OGCG: define{{.*}} i1 @_Z2f2s
+// OGCG:   %[[CMP:.*]] = icmp ne i16 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
+
+bool f3(unsigned u) {
+  return u;
+}
+
+// CIR: cir.func @f3
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !u32i), !cir.bool
+
+// LLVM: define i1 @f3
+// LLVM:   %[[CMP:.*]] = icmp ne i32 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+
+// OGCG: define{{.*}} i1 @_Z2f3j
+// OGCG:   %[[CMP:.*]] = icmp ne i32 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
+
+bool f4(long l) {
+  return l;
+}
+
+// CIR: cir.func @f4
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !s64i), !cir.bool
+
+// LLVM: define i1 @f4
+// LLVM:   %[[CMP:.*]] = icmp ne i64 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+
+// OGCG: define{{.*}} i1 @_Z2f4l
+// OGCG:   %[[CMP:.*]] = icmp ne i64 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
diff --git a/clang/test/CIR/Lowering/cast.cir b/clang/test/CIR/Lowering/cast.cir
index b2d0a6d42eeb1..6842905dae6a4 100644
--- a/clang/test/CIR/Lowering/cast.cir
+++ b/clang/test/CIR/Lowering/cast.cir
@@ -47,6 +47,9 @@ module {
     %21 = cir.load %20 : !cir.ptr<!s16i>, !s16i
     %22 = cir.cast(integral, %21 : !s16i), !u64i
     // CHECK: %[[TMP:[0-9]+]] = llvm.sext %{{[0-9]+}} : i16 to i64
+    %33 = cir.cast(int_to_bool, %arg1 : !s32i), !cir.bool
+    // CHECK: %[[#ZERO:]] = llvm.mlir.constant(0 : i32) : i32
+    // CHECK: %[[#CMP:]] = llvm.icmp "ne" %arg1, %[[#ZERO]] : i32
 
     // Pointer casts.
     cir.store %16, %6 : !s64i, !cir.ptr<!s64i>

@llvmbot
Copy link
Member

llvmbot commented Mar 25, 2025

@llvm/pr-subscribers-clang

Author: Andy Kaylor (andykaylor)

Changes

Lowering of int-to-bool casts had been left as NYI because the incubator implemented it by lowering to cir.cmp, which hasn't been upstreamed yet, but there is no reason this cast can't be lowered directly to LLVM's compare operation when we're lowering directly to the LLVM dialect.

This change lowers the cast directly to an LLVM compare to zero.


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

3 Files Affected:

  • (modified) clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp (+7-7)
  • (added) clang/test/CIR/CodeGen/int-to-bool.cpp (+74)
  • (modified) clang/test/CIR/Lowering/cast.cir (+3)
diff --git a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
index 30cbee48b4bdc..913c70716c365 100644
--- a/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+++ b/clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
@@ -385,13 +385,13 @@ mlir::LogicalResult CIRToLLVMCastOpLowering::matchAndRewrite(
     break;
   }
   case cir::CastKind::int_to_bool: {
-    assert(!cir::MissingFeatures::opCmp());
-    mlir::Type dstType = castOp.getResult().getType();
-    mlir::Type llvmDstType = getTypeConverter()->convertType(dstType);
-    auto zeroBool = rewriter.create<mlir::LLVM::ConstantOp>(
-        castOp.getLoc(), llvmDstType, mlir::BoolAttr::get(getContext(), false));
-    rewriter.replaceOp(castOp, zeroBool);
-    return castOp.emitError() << "NYI int_to_bool cast";
+    mlir::Value llvmSrcVal = adaptor.getOperands().front();
+    mlir::Value zeroInt = rewriter.create<mlir::LLVM::ConstantOp>(
+        castOp.getLoc(), llvmSrcVal.getType(),
+        mlir::IntegerAttr::get(llvmSrcVal.getType(), 0));
+    rewriter.replaceOpWithNewOp<mlir::LLVM::ICmpOp>(
+        castOp, mlir::LLVM::ICmpPredicate::ne, llvmSrcVal, zeroInt);
+    break;
   }
   case cir::CastKind::integral: {
     mlir::Type srcType = castOp.getSrc().getType();
diff --git a/clang/test/CIR/CodeGen/int-to-bool.cpp b/clang/test/CIR/CodeGen/int-to-bool.cpp
new file mode 100644
index 0000000000000..1b915b643506f
--- /dev/null
+++ b/clang/test/CIR/CodeGen/int-to-bool.cpp
@@ -0,0 +1,74 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-cir %s -o %t.cir
+// RUN: FileCheck --input-file=%t.cir %s -check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -fclangir -emit-llvm %s -o %t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s -check-prefix=LLVM
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -Wno-unused-value -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s -check-prefix=OGCG
+
+bool f1(unsigned char c) {
+  return c;
+}
+
+// CIR: cir.func @f1
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !u8i), !cir.bool
+
+// Note: The full zext/store/load/trunc sequence is checked here to show what
+// CIR is being lowered to. There's no need to check it for every function since
+// the lowering is the same for all of them.
+
+// LLVM: define i1 @f1
+// LLVM:   %[[CMP:.*]] = icmp ne i8 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+// LLVM:   store i8 %[[ZEXT]], ptr %{{.*}}
+// LLVM:   %[[LOAD:.*]] = load i8, ptr %{{.*}}
+// LLVM:   %[[TRUNC:.*]] = trunc i8 %[[LOAD]] to i1
+// LLVM:   ret i1 %[[TRUNC]]
+
+// OGCG: define{{.*}} i1 @_Z2f1h
+// OGCG:   %[[CMP:.*]] = icmp ne i8 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
+
+bool f2(short s) {
+  return s;
+}
+
+// CIR: cir.func @f2
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !s16i), !cir.bool
+
+// LLVM: define i1 @f2
+// LLVM:   %[[CMP:.*]] = icmp ne i16 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+
+// OGCG: define{{.*}} i1 @_Z2f2s
+// OGCG:   %[[CMP:.*]] = icmp ne i16 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
+
+bool f3(unsigned u) {
+  return u;
+}
+
+// CIR: cir.func @f3
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !u32i), !cir.bool
+
+// LLVM: define i1 @f3
+// LLVM:   %[[CMP:.*]] = icmp ne i32 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+
+// OGCG: define{{.*}} i1 @_Z2f3j
+// OGCG:   %[[CMP:.*]] = icmp ne i32 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
+
+bool f4(long l) {
+  return l;
+}
+
+// CIR: cir.func @f4
+// CIR:   cir.cast(int_to_bool, %{{.*}} : !s64i), !cir.bool
+
+// LLVM: define i1 @f4
+// LLVM:   %[[CMP:.*]] = icmp ne i64 %4, 0
+// LLVM:   %[[ZEXT:.*]] = zext i1 %[[CMP]] to i8
+
+// OGCG: define{{.*}} i1 @_Z2f4l
+// OGCG:   %[[CMP:.*]] = icmp ne i64 %{{.*}}, 0
+// OGCG:   ret i1 %[[CMP]]
diff --git a/clang/test/CIR/Lowering/cast.cir b/clang/test/CIR/Lowering/cast.cir
index b2d0a6d42eeb1..6842905dae6a4 100644
--- a/clang/test/CIR/Lowering/cast.cir
+++ b/clang/test/CIR/Lowering/cast.cir
@@ -47,6 +47,9 @@ module {
     %21 = cir.load %20 : !cir.ptr<!s16i>, !s16i
     %22 = cir.cast(integral, %21 : !s16i), !u64i
     // CHECK: %[[TMP:[0-9]+]] = llvm.sext %{{[0-9]+}} : i16 to i64
+    %33 = cir.cast(int_to_bool, %arg1 : !s32i), !cir.bool
+    // CHECK: %[[#ZERO:]] = llvm.mlir.constant(0 : i32) : i32
+    // CHECK: %[[#CMP:]] = llvm.icmp "ne" %arg1, %[[#ZERO]] : i32
 
     // Pointer casts.
     cir.store %16, %6 : !s64i, !cir.ptr<!s64i>

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

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

@andykaylor andykaylor merged commit 7563e31 into llvm:main Mar 26, 2025
14 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 26, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-out-of-tree running on linaro-flang-aarch64-out-of-tree while building clang at step 8 "test-build-flang-unified-tree-check-flang".

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

Here is the relevant piece of the build log for the reference
Step 8 (test-build-flang-unified-tree-check-flang) failure: test (failure)
...
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/89/242 (3475 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/138/242 (3476 of 3636)
UNSUPPORTED: Flang :: Lower/OpenMP/real10.f90 (3477 of 3636)
UNSUPPORTED: Flang :: Parser/OpenMP/allocate-tree.f90 (3478 of 3636)
UNSUPPORTED: Flang :: Lower/OpenMP/task_detach.f90 (3479 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/229/242 (3480 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/158/242 (3481 of 3636)
UNSUPPORTED: Flang :: Lower/OpenMP/sections.f90 (3482 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/40/242 (3483 of 3636)
UNRESOLVED: Flang :: Driver/slp-vectorize.ll (3484 of 3636)
******************** TEST 'Flang :: Driver/slp-vectorize.ll' FAILED ********************
Test has no 'RUN:' line
********************
UNSUPPORTED: Flang :: Examples/print-fns-interfaces.f90 (3485 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/allocators03.f90 (3486 of 3636)
UNSUPPORTED: Flang :: Examples/print-fns-calls.f90 (3487 of 3636)
UNSUPPORTED: Flang :: Lower/target-features-amdgcn.f90 (3488 of 3636)
PASS: Flang :: Semantics/resolve107.f90 (3489 of 3636)
UNSUPPORTED: Flang :: Lower/PowerPC/ppc-vec-cvf-elem-order.f90 (3490 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/58/242 (3491 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/allocate07.f90 (3492 of 3636)
UNSUPPORTED: Flang :: Lower/Intrinsics/sum.f90 (3493 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/157/242 (3494 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/allocators02.f90 (3495 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/allocate08.f90 (3496 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/resolve06.f90 (3497 of 3636)
PASS: Flang :: HLFIR/region-assign.fir (3498 of 3636)
UNSUPPORTED: Flang :: Lower/PowerPC/ppc-vec-splat.f90 (3499 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/allocate03.f90 (3500 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/28/242 (3501 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/145/242 (3502 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/234/242 (3503 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/188/242 (3504 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/83/242 (3505 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/allocate02.f90 (3506 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/linear-clause01.f90 (3507 of 3636)
PASS: Flang :: HLFIR/elemental-shallow-copy.fir (3508 of 3636)
UNSUPPORTED: Flang :: Lower/OpenMP/teams.f90 (3509 of 3636)
UNSUPPORTED: Flang :: Parser/OpenMP/allocate-tree-spec-part.f90 (3510 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/223/242 (3511 of 3636)
PASS: Flang :: HLFIR/simplify-hlfir-intrinsics-dotproduct.fir (3512 of 3636)
UNSUPPORTED: Flang :: Lower/OpenMP/atomic-capture.f90 (3513 of 3636)
PASS: flang-Unit :: Optimizer/./FlangOptimizerTests/139/147 (3514 of 3636)
UNSUPPORTED: Flang :: Semantics/PowerPC/ppc-vector-intrinsics.f90 (3515 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/174/242 (3516 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/26/242 (3517 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/5/242 (3518 of 3636)
PASS: flang-Unit :: Runtime/./FlangRuntimeTests/52/242 (3519 of 3636)
UNSUPPORTED: Flang :: Semantics/OpenMP/sync-critical02.f90 (3520 of 3636)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 26, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-release running on linaro-flang-aarch64-release while building clang at step 6 "test-build-unified-tree-check-flang".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
...
UNSUPPORTED: Flang :: Driver/predefined-macros-powerpc.f90 (39 of 3636)
PASS: Flang :: Driver/bbc-cuda-macro.cuf (40 of 3636)
UNSUPPORTED: Flang :: Driver/arch-specific-libdir-rpath.f95 (41 of 3636)
UNSUPPORTED: Flang :: Driver/target-gpu-features.f90 (42 of 3636)
UNSUPPORTED: Flang :: Driver/target-cpu-features-invalid.f90 (43 of 3636)
PASS: Flang :: Driver/print-effective-triple.f90 (44 of 3636)
PASS: Flang :: Driver/emit-llvm.f90 (45 of 3636)
PASS: Flang :: Driver/message-merging.f90 (46 of 3636)
UNSUPPORTED: Flang :: Driver/unsupported-vscale-max-min.f90 (47 of 3636)
UNRESOLVED: Flang :: Driver/slp-vectorize.ll (48 of 3636)
******************** TEST 'Flang :: Driver/slp-vectorize.ll' FAILED ********************
Test has no 'RUN:' line
********************
PASS: Flang :: Analysis/AliasAnalysis/alias-analysis-omp-target-2.fir (49 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/alias-analysis-host-assoc.fir (50 of 3636)
PASS: Flang :: Driver/mllvm_vs_mmlir.f90 (51 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/alias-analysis-9.fir (52 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/alias-analysis-target.fir (53 of 3636)
PASS: Flang :: Driver/w-arg-unsupported.f90 (54 of 3636)
PASS: Flang :: Driver/init-only.f90 (55 of 3636)
PASS: Flang :: Driver/mmlir-opts.f90 (56 of 3636)
PASS: Flang :: Driver/debug-parsing-log.f90 (57 of 3636)
PASS: Flang :: Driver/fsave-main-program.f90 (58 of 3636)
PASS: Flang :: Driver/funroll-loops.f90 (59 of 3636)
PASS: Flang :: Driver/module-suffix.f90 (60 of 3636)
PASS: Flang :: Driver/default-backend-pipelines.f90 (61 of 3636)
PASS: Flang :: Driver/code-gen-aarch64.f90 (62 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/ptr-component.fir (63 of 3636)
PASS: Flang :: Driver/underscoring.f90 (64 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/load-ptr-designate.fir (65 of 3636)
PASS: Flang :: Driver/q-unused-arguments.f90 (66 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-locals.f90 (67 of 3636)
PASS: Flang :: Driver/xoffload-linker.f90 (68 of 3636)
PASS: Flang :: Driver/fintegrated-as.f90 (69 of 3636)
PASS: Flang :: Evaluate/bug115923.f90 (70 of 3636)
PASS: Flang :: Driver/multiple-input-files.f90 (71 of 3636)
PASS: Flang :: Evaluate/bug124618.f90 (72 of 3636)
PASS: Flang :: Evaluate/big-expr-tree.F90 (73 of 3636)
PASS: Flang :: Driver/immediate-options.f90 (74 of 3636)
PASS: Flang :: Evaluate/bug65142.f90 (75 of 3636)
PASS: Flang :: Driver/dump-parse-tree-no-sema.f90 (76 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/alias-analysis-3.fir (77 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/load-ptr-alloca.fir (78 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-equivalence.f90 (79 of 3636)
PASS: Flang :: Driver/dump-all.f90 (80 of 3636)
PASS: Flang :: Evaluate/fold-btest.f90 (81 of 3636)
PASS: Flang :: Evaluate/fold-dim.f90 (82 of 3636)
PASS: Flang :: Driver/dump-all-bad.f90 (83 of 3636)
PASS: Flang :: Driver/dumpmachine.f90 (84 of 3636)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 26, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-dylib running on linaro-flang-aarch64-dylib while building clang at step 6 "test-build-unified-tree-check-flang".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
...
PASS: Flang :: Driver/immediate-options.f90 (40 of 3636)
PASS: Flang :: Driver/flang-f-opts.f90 (41 of 3636)
PASS: Flang :: Driver/frontend-forwarding.f90 (42 of 3636)
PASS: Flang :: Driver/code-gen-aarch64.f90 (43 of 3636)
UNSUPPORTED: Flang :: Driver/predefined-macros-powerpc.f90 (44 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/source-kind.fir (45 of 3636)
PASS: Flang :: Driver/emit-llvm.f90 (46 of 3636)
PASS: Flang :: Driver/cuda-option.f90 (47 of 3636)
UNSUPPORTED: Flang :: Driver/pass-plugin.f90 (48 of 3636)
UNRESOLVED: Flang :: Driver/slp-vectorize.ll (49 of 3636)
******************** TEST 'Flang :: Driver/slp-vectorize.ll' FAILED ********************
Test has no 'RUN:' line
********************
UNSUPPORTED: Flang :: Driver/predefined-macros-powerpc2.f90 (50 of 3636)
UNSUPPORTED: Flang :: Driver/target-gpu-features.f90 (51 of 3636)
PASS: Flang :: Driver/fno-zero-init.f90 (52 of 3636)
PASS: Flang :: Driver/dumpmachine.f90 (53 of 3636)
UNSUPPORTED: Flang :: Driver/unsupported-vscale-max-min.f90 (54 of 3636)
PASS: Flang :: Driver/dump-parse-tree-no-sema.f90 (55 of 3636)
PASS: Flang :: Driver/dump-all.f90 (56 of 3636)
PASS: Flang :: Driver/driver-error-cc1.c (57 of 3636)
UNSUPPORTED: Flang :: Driver/predefined-macros-x86.f90 (58 of 3636)
UNSUPPORTED: Flang :: Driver/target-cpu-features-invalid.f90 (59 of 3636)
PASS: Flang :: Driver/fintegrated-as.f90 (60 of 3636)
PASS: Flang :: Driver/mmlir-opts.f90 (61 of 3636)
PASS: Flang :: Driver/q-unused-arguments.f90 (62 of 3636)
PASS: Flang :: Driver/predefined-macros-compiler-version.F90 (63 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-locals.f90 (64 of 3636)
UNSUPPORTED: Flang :: Driver/mabi.f90 (65 of 3636)
PASS: Flang :: Driver/driver-help.f90 (66 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/alias-analysis-omp-teams-distribute-private.mlir (67 of 3636)
PASS: Flang :: Driver/supported-suffices/f03-suffix.f03 (68 of 3636)
PASS: Flang :: Driver/dump-all-bad.f90 (69 of 3636)
PASS: Flang :: Driver/funroll-loops.f90 (70 of 3636)
PASS: Flang :: Driver/message-merging.f90 (71 of 3636)
PASS: Flang :: Driver/atomic.f90 (72 of 3636)
PASS: Flang :: Driver/supported-suffices/f08-suffix.f08 (73 of 3636)
PASS: Flang :: Driver/std2018-wrong.f90 (74 of 3636)
PASS: Flang :: Evaluate/big-expr-tree.F90 (75 of 3636)
PASS: Flang :: Driver/print-pipeline-passes.f90 (76 of 3636)
PASS: Flang :: Driver/print-effective-triple.f90 (77 of 3636)
PASS: Flang :: Driver/missing-triple.ll (78 of 3636)
PASS: Flang :: Driver/init-only.f90 (79 of 3636)
PASS: Flang :: Evaluate/compiler_version.f90 (80 of 3636)
PASS: Flang :: Driver/unparse-with-modules.f90 (81 of 3636)
PASS: Flang :: Driver/disable-ext-name-interop.f90 (82 of 3636)
PASS: Flang :: Evaluate/errors01.f90 (83 of 3636)
PASS: Flang :: Driver/fixed-free-flag.f90 (84 of 3636)
PASS: Flang :: Driver/print-target-triple.f90 (85 of 3636)

@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 26, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-rel-assert running on linaro-flang-aarch64-rel-assert while building clang at step 6 "test-build-unified-tree-check-flang".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-flang) failure: test (failure)
...
PASS: Flang :: Driver/disable-ext-name-interop.f90 (41 of 3636)
PASS: Flang :: Driver/bbc-cuda-macro.cuf (42 of 3636)
PASS: Flang :: Driver/driver-error-cc1.c (43 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-equivalence.f90 (44 of 3636)
PASS: Flang :: Driver/embed-error.f90 (45 of 3636)
UNSUPPORTED: Flang :: Driver/predefined-macros-powerpc.f90 (46 of 3636)
PASS: Flang :: Driver/bbc-mlir-pass-pipeline.f90 (47 of 3636)
UNSUPPORTED: Flang :: Driver/predefined-macros-powerpc2.f90 (48 of 3636)
UNSUPPORTED: Flang :: Driver/mabi.f90 (49 of 3636)
UNRESOLVED: Flang :: Driver/slp-vectorize.ll (50 of 3636)
******************** TEST 'Flang :: Driver/slp-vectorize.ll' FAILED ********************
Test has no 'RUN:' line
********************
UNSUPPORTED: Flang :: Driver/target-cpu-features-invalid.f90 (51 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-globals.f90 (52 of 3636)
UNSUPPORTED: Flang :: Driver/target-gpu-features.f90 (53 of 3636)
UNSUPPORTED: Flang :: Driver/unsupported-vscale-max-min.f90 (54 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-locals.f90 (55 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-dummies.f90 (56 of 3636)
PASS: Flang :: Driver/cpp-nocpp-command-line-macro.f90 (57 of 3636)
PASS: Flang :: Driver/emit-asm-from-mlir.mlir (58 of 3636)
PASS: Flang :: Driver/debug-parsing-log.f90 (59 of 3636)
PASS: Flang :: Driver/emit-llvm.f90 (60 of 3636)
PASS: Flang :: Driver/emit-asm-from-llvm.ll (61 of 3636)
PASS: Flang :: Driver/plugin-invalid-name.f90 (62 of 3636)
PASS: Flang :: Driver/emit-asm-aarch64.f90 (63 of 3636)
PASS: Flang :: Driver/target.f90 (64 of 3636)
PASS: Flang :: Driver/flang-f-opts.f90 (65 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-internal-proc.f90 (66 of 3636)
PASS: Flang :: Driver/dash-x-f95-do-not-assume-fixed-form.f90 (67 of 3636)
UNSUPPORTED: Flang :: Driver/predefined-macros-x86.f90 (68 of 3636)
PASS: Flang :: Driver/init-only.f90 (69 of 3636)
PASS: Flang :: Driver/funroll-loops.f90 (70 of 3636)
PASS: Flang :: Driver/dumpmachine.f90 (71 of 3636)
PASS: Flang :: Driver/driver-version.f90 (72 of 3636)
PASS: Flang :: Driver/supported-suffices/f08-suffix.f08 (73 of 3636)
PASS: Flang :: Driver/unparse-with-modules.f90 (74 of 3636)
PASS: Flang :: Driver/debug-measure-parse-tree.f90 (75 of 3636)
PASS: Flang :: Driver/emit-llvm-bc.f90 (76 of 3636)
PASS: Flang :: Driver/print-target-triple.f90 (77 of 3636)
PASS: Flang :: Driver/std2018-wrong.f90 (78 of 3636)
PASS: Flang :: Evaluate/bug115923.f90 (79 of 3636)
PASS: Flang :: Driver/underscoring.f90 (80 of 3636)
PASS: Flang :: Driver/fintegrated-as.f90 (81 of 3636)
PASS: Flang :: Driver/print-resource-dir.F90 (82 of 3636)
PASS: Flang :: Driver/immediate-options.f90 (83 of 3636)
PASS: Flang :: Driver/print-effective-triple.f90 (84 of 3636)
PASS: Flang :: Evaluate/bug124618.f90 (85 of 3636)
PASS: Flang :: Analysis/AliasAnalysis/modref-call-args.f90 (86 of 3636)

@@ -385,13 +385,13 @@ mlir::LogicalResult CIRToLLVMCastOpLowering::matchAndRewrite(
break;
}
case cir::CastKind::int_to_bool: {
assert(!cir::MissingFeatures::opCmp());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the corresponding MissingFeatures need to be removed? Or does that have 'more' uses?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left it because the feature wasn't implemented, but it looks like it didn't have any other uses. It's being removed in #133159

@andykaylor andykaylor deleted the cir-int-to-bool branch April 10, 2025 21:19
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.

6 participants