Skip to content

[4.0] IRGen: Make sure to use the C function type's alignment for indirect byval arguments #10932

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

Conversation

aschwaighofer
Copy link
Contributor

rdar://33242303

  • Fix abitypes.swift test case
  • Use the max of abi alignment and swift's type alignment

• Explanation: We emit the wrong alignment attribute for indirect by value parameters in C functions called from Swift. This gets exposed by the merge function pass which merges functions and notices mismatching alignments. But it has correctness implications if the LLVM backend relies on the alignment for optimization or code emission.

• Scope of Issue: Correctness and crash

• Origination: I believe this issue has always been there

• Risk: Low. The IR generator now emits the proper alignment attribute on the function call and the alloca instruction that it generates for the indirect parameter passing.

• Reviewed By: John McCall

…irect byval arguments

rdar://33242303

* Fix abitypes.swift test case
* Use the max of abi alignment and swift's type alignment
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please test

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