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

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 19:01:13 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));
----------------
vporpo wrote:

Ah we also need to change this with:
```
  lvm::Instruction *LLVMBefore = InsertBefore->getTopmostLLVMInstruction(); 
 Builder.SetInsertPoint(LLVMBefore);
```
It shouldn't change the behavior for now, but once we introduce Multi-Instructions this won't work correctly.

I noticed that this is wrong in a few places, I will push a fix at some point.

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


More information about the llvm-commits mailing list