-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Replace uses of CreatePointerBitCastOrAddrSpaceCast (NFC) #68277
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3088,9 +3088,6 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs( | |
CharUnits Align = CGM.getContext().getDeclAlign(VD); | ||
Val = Builder.CreateAlignedLoad(Var->getValueType(), Val, Align); | ||
} | ||
if (Val->getType() != Wrapper->getReturnType()) | ||
Val = Builder.CreatePointerBitCastOrAddrSpaceCast( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stripping the call to But.. I'm not entirely sure whether stripping the call is justified. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I couldn't break it with something like:
The behavior is not intuitive to me, however. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I should play safe by just replacing the call to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm in favor of stripping it. In the end, codebase simplification is the whole point of opaque pointers. |
||
Val, Wrapper->getReturnType(), ""); | ||
|
||
Builder.CreateRet(Val); | ||
} | ||
|
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.
So
ReturnValue.getPointer()
is guaranteed to be an unqualified pointer?I'm just wondering why this hasn't been just a pointer bitcast in the past. But even if it would cast away an address space it seems a bit weird.
Not sure if it is worth an assert now when we bypass all the castIsValid checks etc that would have been done in the past.
(And maybe the "result.ptr" should be created with
ReturnValue.getPointer().getType()
rather than using Int8PtrTy. Although I consider that as out of scope for this patch.)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.
Yes, I agree..
I also agree.
Since, adding the change to this revision doesn't add new failures with
ninja check-clang
, I think it can be merged to this patch. I'll add the change to this revision.