-
Notifications
You must be signed in to change notification settings - Fork 788
Fix crash when using -ffp-accuracy and std:: trigonometric functions. #11606
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
CI = EmitFPBuiltinIndirectCall(IRFuncTy, IRCallArgs, CalleePtr, FD); | ||
if (CI) | ||
return RValue::get(CI); | ||
if (FD) { |
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.
When do we get a null FD here? Can we assert that condition instead?
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 get the null when the entire sycl.hpp is included. And to use std::sin we need to include the entire sycl.hpp.
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 mean what property of this entity is it that causes FD to be NULL? Can we assert (FD || that condition) instead of removing the non-NULL FD check that we had before?
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.
FD is null when TargetDecl is not a FunctionDecl. Not really sure what "that condition" should be?
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 chatted with @zahiraam offline; she believes that all the null FD cases are understood and handled here, so no assertion is necessary.
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 @premanandrao for the updates about NULL cases.
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.
Just an additional comment about the assert.
For any TargetDecl, the control flow passes through this code. In the case we are using the fp-accuracy we need to check that the TargetDecl is a FunctionDecl and only then we can generate a call to the intrinsic. For any other kind of TargetDecl we can just create the call (in this particular case, the TargetDecl was a CXXConstructorDecl).
Review please. |
@premanandrao Can you please review. This is time critical. Thanks. |
@aelovikov-intel Can you please review this? Thanks. |
This is to fix a crash in the host compilation when calling any std:: trigonometric function.