-
Notifications
You must be signed in to change notification settings - Fork 175
[CIR][CodeGen] Implement tryMarkNoThrow and update wrong test #1664
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
if (isInterposable(fn)) | ||
return; | ||
|
||
for (auto &blk : fn.getBlocks()) { |
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.
Instead of walking the function here (which could be expensive), we could keep some state in cgf
to track when those operations are emitted, then you could change this function to just check that state and go about the business of adding attributes. How does that sound?
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! I will update the PR next week.
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.
@bcardosolopes updated)
Sounds good enough, perhaps as you add the |
) This PR introduces [`TryMarkNoThrow`](https://github.com/llvm/clangir/blob/6e5fa09550c98f84d017873ed3e5667fd5fd909c/clang/lib/CodeGen/CodeGenFunction.cpp#L1394). [`isInterposable`](https://github.com/llvm/clangir/blob/6e5fa09550c98f84d017873ed3e5667fd5fd909c/clang/lib/CodeGen/CodeGenFunction.cpp#L1397C10-L1397C26) isn't fully implemented and I'm not quite sure we need it? Anyway, I have introduced a missing feature `getSemanticInterposition` relevant for its completion. I have also updated an old test -- [`foo()`](https://github.com/llvm/clangir/blob/6e5fa09550c98f84d017873ed3e5667fd5fd909c/clang/test/CIR/CodeGen/try-catch-dtors.cpp#L313) should be marked as unwind/nothrow. I have compared with the original CodeGen and attached the llvm output for verification. One concern I have is if the cases I have to mimic [`mayThrow`](https://github.com/llvm/clangir/blob/6e5fa09550c98f84d017873ed3e5667fd5fd909c/llvm/lib/IR/Instruction.cpp#L1158) from the OG are enough, please let me know your thoughts.
This PR introduces
TryMarkNoThrow
.isInterposable
isn't fully implemented and I'm not quite sure we need it? Anyway, I have introduced a missing featuregetSemanticInterposition
relevant for its completion.I have also updated an old test --
foo()
should be marked as unwind/nothrow. I have compared with the original CodeGen and attached the llvm output for verification.One concern I have is if the cases I have to mimic
mayThrow
from the OG are enough, please let me know your thoughts.