Skip to content

Commit

Permalink
Only cast i8* to i1* on LLVM < 15
Browse files Browse the repository at this point in the history
  • Loading branch information
ysbaddaden committed Jan 16, 2025
1 parent e7527d3 commit e42a575
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/compiler/crystal/codegen/once.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e42a575

Please sign in to comment.