Skip to content

Conversation

@maleadt
Copy link
Member

@maleadt maleadt commented Sep 3, 2025

No need to inspect the calling convention, we can get the LLVM type from the byval type attribute nowadays.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic master) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/irgen.jl b/src/irgen.jl
index 15e22ef..98aa0ce 100644
--- a/src/irgen.jl
+++ b/src/irgen.jl
@@ -374,14 +374,14 @@ function lower_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, f::LLVM.
 
     # find the byval parameters
     byval = BitVector(undef, length(parameters(ft)))
-    types = Vector{LLVMType}(undef, length(parameters(ft)))
+        types = Vector{LLVMType}(undef, length(parameters(ft)))
     for i in 1:length(byval)
-        byval[i] = false
-        for attr in collect(parameter_attributes(f, i))
-            if kind(attr) == kind(TypeAttribute("byval", LLVM.VoidType()))
-                byval[i] = true
-                types[i] = value(attr)
-            end
+            byval[i] = false
+            for attr in collect(parameter_attributes(f, i))
+                if kind(attr) == kind(TypeAttribute("byval", LLVM.VoidType()))
+                    byval[i] = true
+                    types[i] = value(attr)
+                end
         end
     end
 
@@ -419,7 +419,7 @@ function lower_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, f::LLVM.
     new_types = LLVM.LLVMType[]
     for (i, param) in enumerate(parameters(ft))
         if byval[i]
-            llvm_typ = convert(LLVMType, types[i])
+                llvm_typ = convert(LLVMType, types[i])
             push!(new_types, llvm_typ)
         else
             push!(new_types, param)
@@ -442,7 +442,7 @@ function lower_byval(@nospecialize(job::CompilerJob), mod::LLVM.Module, f::LLVM.
         for (i, param) in enumerate(parameters(ft))
             if byval[i]
                 # copy the argument value to a stack slot, and reference it.
-                llvm_typ = convert(LLVMType, types[i])
+                    llvm_typ = convert(LLVMType, types[i])
                 ptr = alloca!(builder, llvm_typ)
                 if LLVM.addrspace(param) != 0
                     ptr = addrspacecast!(builder, ptr, param)

@maleadt maleadt merged commit aa05fa3 into master Sep 4, 2025
18 of 22 checks passed
@maleadt maleadt deleted the tb/byval branch September 4, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants