-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: IR generation for repeated initializers #12755
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
…t the semantics of the dbscheme.
DCA looks fine: Performance looks unchanged, no new results, and some IR inconsistencies have been fixed 🎉 |
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.
Mostly looks sensible. Few small remarks. Also a question. Consider:
struct Foo {
int x[2];
int y;
};
int main() {
struct Foo f = { .x = {0, 1}, .x[0] = 42, .y = 42 };
return 0;
}
What happens in this case?
* This predicate may have multiple results since a field can be initialized | ||
* multiple times in the same initializer. | ||
*/ | ||
Expr getFieldExpr(Field field) { result = this.getFieldExpr(field, _) } |
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.
Expr getFieldExpr(Field field) { result = this.getFieldExpr(field, _) } | |
deprecated Expr getFieldExpr(Field field) { result = this.getFieldExpr(field, _) } |
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.
I was planning on doing this as a follow-up since these predicates are used a bunch of places in. So we'd need to replace those when we formally deprecate these.
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.
Sounds good to me.
* This predicate may have multiple results since an element can be initialized | ||
* multiple times in the same initializer. | ||
*/ | ||
Expr getElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) } |
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.
Expr getElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) } | |
deprecated Expr getElementExpr(int elementIndex) { result = this.getElementExpr(elementIndex, _) } |
Hmmm, good question. I'll add this test and see |
Note that clang actually gives a warning on the slightly odd test case:
|
I've added the case in 4033ed3. The output actually looks sensible, I think 🤞. |
Looks sensible indeed. |
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.
LGTM
This implements the IR changes necessary after #12712 to support repeated initializers.
Commit-by-commit review recommended.