Skip to content
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

Avoid needless union in LLVM::ABI::AArch64#homogeneous_aggregate? #11199

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/llvm/abi/aarch64.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ class LLVM::ABI::AArch64 < LLVM::ABI
end

def homogeneous_aggregate?(type)
homog_agg = case type
when Type::Kind::Float
return {type, 1}
when Type::Kind::Double
return {type, 1}
when Type::Kind::Array
check_array(type)
when Type::Kind::Struct
check_struct(type)
end
homog_agg : {Type, UInt64}? = case type
when Type::Kind::Float
return {type, 1_u64}
when Type::Kind::Double
return {type, 1_u64}
when Type::Kind::Array
check_array(type)
when Type::Kind::Struct
check_struct(type)
end

# Ensure we have at most four uniquely addressable members
if homog_agg
Expand All @@ -54,7 +54,7 @@ class LLVM::ABI::AArch64 < LLVM::ABI
return if elements.empty?

base_type = nil
members = 0
members = 0_u64

elements.each do |element|
opt_homog_agg = homogeneous_aggregate?(element)
Expand Down