From e42a57534ba6d87c00e42afb1e58bd9b4d442894 Mon Sep 17 00:00:00 2001 From: Julien Portalier Date: Thu, 16 Jan 2025 19:51:07 +0100 Subject: [PATCH] Only cast i8* to i1* on LLVM < 15 --- src/compiler/crystal/codegen/once.cr | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/compiler/crystal/codegen/once.cr b/src/compiler/crystal/codegen/once.cr index cc2fd2066d00..ba08f0e7958b 100644 --- a/src/compiler/crystal/codegen/once.cr +++ b/src/compiler/crystal/codegen/once.cr @@ -44,9 +44,10 @@ class Crystal::CodeGenVisitor end state = load(once_state_type, once_state_global) - # cast Int8* to Bool* (required for LLVM 14 and below) - bool = bit_cast(flag, @llvm_context.int1.pointer) - args = [state, bool, initializer] + {% if LibLLVM::IS_LT_150 %} + flag = bit_cast(flag, @llvm_context.int1.pointer) # cast Int8* to Bool* + {% end %} + args = [state, flag, initializer] end call once_fun, args