-
Notifications
You must be signed in to change notification settings - Fork 187
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
Look through attributes and rates when determining by reference initialization #5023
Conversation
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.
Looks good to me
c0bb66c
to
614481a
Compare
source/slang/slang-ir-util.cpp
Outdated
@@ -175,7 +175,9 @@ IRInst* maybeSpecializeWithGeneric(IRBuilder& builder, IRInst* genericToSpecaili | |||
// Returns true if is not possible to produce side-effect from a value of `dataType`. | |||
bool isValueType(IRInst* dataType) | |||
{ | |||
dataType = getResolvedInstForDecorations(unwrapAttributedType(dataType)); | |||
if(auto t = as<IRType>(dataType)) |
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 if is unnecessary.
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 changed the type of unwrapAttributedType to be on IRType, so it's required now.
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.
That means we are checking the opcode twice, once for the dynamic cast and once for the actual unwrapping, which seems unnecessary.
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 should feel comfortable to accept IRInst where a type is expected, and rely on static cast to convert between IRInst and IRType because there is not a clean way to separate a type and an inst anyways. IRType has no more meaning other than clarifying what an IRInst is for in code, but for unwrapAttributeType, it is verify clear what the param is, so it accepting IRInst is not wrong and I don't see a need for the change.
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.
ok, I've reverted that change
Closes #5022