-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[SandboxIR] Implement UnreachableInst #101856
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
[SandboxIR] Implement UnreachableInst #101856
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.
Hmm does the test actually pass?
For the instruction to be created as a sanbdoxir::UnreachableInst
we need to add the following code in Value *Context::getOrCreateValueInternal(llvm::Value *LLVMV, llvm::User *U)
:
case llvm::Instruction::Unreachable: {
auto *LLVMUnreachable = cast<llvm::UnreachableInst>(LLVMV);
It->second = std::unique_ptr<UnreachableInst>(new UnreachableInst(LLVMUnreachable, *this));
return It->second.get();
}
Good catch. Interestingly, the test did pass, but I'm not entirely sure why, if the code you sent me is required. It might be a case of "it works on my computer.", where I'm getting a faulty pass. I made sure to add it. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
@vporpo is it okay for you to merge this or is there more changes you need me to make? |
@vporpo Apologies for the inconvenience and wait, didn't mean to aruptly commit those recent changes. I'm just now seeing your comment about wanting to see the backtrace. Backtrace
|
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 think I figured out what the problem was. I have updated the comments. To summarize, just drop ret void
and change the code to InsertBefore UI, and the test should pass.
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, thanks for the patch!
This patch implements the
UnreachableInst
instruction in SandboxIR. Mirroringllvm::UnreachableInst
.cc: @vporpo