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
[GSoC] llvm.invariant.start tests #6802
Conversation
record A | ||
{ | ||
var a : int; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some ongoing work with initializers. Can you add a local and global test using this pattern?
record A
{
var a : int;
proc init(arg:int) {
a = arg;
super.init();
}
}
That will cause the compiler to follow some code paths that aren't exercised in your tests so far but which we expect to become widely used in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mppf
I'm not sure what should I test as initializers make creating new records differently:
Here is how constructors work (let me use pseudo LLVM IR for that):
%tmp = alloca %A_chpl;
%localConst = alloca %A_chpl;
call construct_A(%A_chpl* %tmp, i64 %arg);
store %A_chpl %tmp, %A_chpl* %localConst
and here is how initializers work:
%localConst = alloca %A_chpl;
call init_A(%A_chpl* %localConst, i64 %arg);
Thus there is no final store which would mark that this variable is constant from this point giving opportunity to mark it using llvm.invariant.start, my algorithm covers a lot of cases because chapel compiler uses store from temporary to final
a lot while in this case it doesn't happen so it doesn't do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@coodie - right, so in other words:
- we'll need to use another approach to put llvm.invariant.start after these
init
calls - the current approach just leaves this case alone (and in particular doesn't generate incorrect IR for it)
@coodie - could you please double-check that these tests pass the way you have written them? I'm seeing testing failures with the following ones when run with start_test in an LLVM configuration with this branch merged with master and with the llvm-invariant branch. [Error matching program output for llvm/llvm-invariant/function_local_const] |
I fixed that. These changes were related to tbaa, which generation was changed. |
Add a SKIPIF This is a trivial follow-on to PR #6802.
This PR introduces tests for changes in #6706.