-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[SILOpt] Add ZeroInitializer to isValidStaticInitializerInst #31528
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
|
@swift-ci please smoke test |
|
Ping. Hi @gottesmm and @eeckstein – This seems like a simple QoI fix, right? Am I missing anything? |
eeckstein
left a comment
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.
This builtin needs to be supported in IRGen's emitConstantValue, too.
Can you add an "-emit-ir" test as well (you can do it in the same test file)?
|
Hi @eeckstein – I feel like I'm missing something. Why does |
|
I did some sanity checks. The code you requested is definitely being called but it's not making an observable difference in the IR with the simple test I provided. Do I need some non-trivial Swift/SIL to observe the change you requested? |
|
Hm, don't you hit the ? |
|
I think the key question is whether this is actually emitted as a constant initializer. I don't know if changing this one SIL predicate is sufficient for that. |
|
My mistake. I wasn't doing a proper A versus B comparison. Patch updated. @swift-ci please smoke test |
|
Updated CHECK to use a regular expression to account for macOS versus Linux differences. @swift-ci please smoke test |
lib/IRGen/GenConstant.cpp
Outdated
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.
Can you add a test for this case?
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.
Sure, is there a good arbitrary width constant test I can copy from?
lib/IRGen/GenConstant.cpp
Outdated
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.
Can you fix the indentation here?
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.
Hmm... I just ran the code through git clang-format and this was the sub-optimal result. I can either re‑indent all of the case statements to match clang style, or have this change match the rest of the case statements. What would you prefer?
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 don't mind
|
I dropped support for arbitrary width integers for two reasons: 1) using I also overrode @swift-ci please smoke test |
lib/SIL/IR/SILGlobalVariable.cpp
Outdated
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.
Can you add a check here, which returns false if it's an arbitrary width integer?
|
Updated to have @swift-ci please smoke test |
|
Replaced uses of @swift-ci please smoke test |
|
Added float and vector support. What's left before a LGTM? @swift-ci please smoke test |
|
Not supporting |
eeckstein
left a comment
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.
Thanks, LGTM!
No description provided.