LLVM Call Parameter Mismatch Fix #293
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: M-Labs/nac3#293
Loading…
Reference in New Issue
No description provided.
Delete Branch "fix-call-param-type"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This patch fixes #276 and fixes #290.
#290 is caused by the fact that we previously did not handle inheritance properly. A simple bitcast works to fix this problem, and this is also what clang does according to the following output:
input cpp file
output (by clang++ -O0 -S -emit-llvm ./class.cpp)
#276 is due to llvm sometimes cannot merge opaque types when linking different llvm modules (though strangely it seems that llvm sometimes can do the merge under some simple cases..), and this is fixed by using
module.get_struct_type
to get named structs that are already defined in the current context.@ -235,3 +235,4 @@
Err((old_builder, e)) => {
builder = old_builder;
errors.insert(e);
module = context.create_module_from_ir(prev_module).unwrap();
What's the impact on performance of this?
It sounds strange that we would have to serialize and deserialize things for passing objects around in the same program.
Thanks for pointing this out! I just run some benchmark and this is indeed significantly slowing things down, as shown below. I will look into this.
python porgram from 10 to 150 functions (50 loc per function); compile time (second);
Ah actually there seems no need to precisely restore the previous llvm module, creating a new empty one just to collect errors should be enough.
Please make separate PRs so they can be merged separately.
This PR closed to be separates into to 2
Pull request closed