[llvm] [SandboxIR] Implement UnreachableInst (PR #101856)

Julius Alexandre via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 19:15:15 PDT 2024


================
@@ -747,6 +747,38 @@ void StoreInst::dump() const {
 }
 #endif // NDEBUG
 
+UnreachableInst *UnreachableInst::create(Instruction *InsertBefore,
+                                         Context &Ctx) {
+  auto &Builder = Ctx.getLLVMIRBuilder();
+  Builder.SetInsertPoint(cast<llvm::Instruction>(InsertBefore->Val));
----------------
medievalghoul wrote:

So from now on, should I always do

```
  auto &Builder = Ctx.getLLVMIRBuilder();
  llvm::Instruction *LLVMBefore = InsertBefore->getTopmostLLVMInstruction();
  Builder.SetInsertPoint(LLVMBefore);
```
for future implementations? 

https://github.com/llvm/llvm-project/pull/101856


More information about the llvm-commits mailing list