[llvm] 90e1c29 - [SandboxIR][NFC] Add missing getTopmostLLVMInstruction() (#102266)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 22:04:00 PDT 2024
Author: Julius Alexandre
Date: 2024-08-06T22:03:56-07:00
New Revision: 90e1c292e3745acdd2b89ac9aafdfdaaa7f13f6c
URL: https://github.com/llvm/llvm-project/commit/90e1c292e3745acdd2b89ac9aafdfdaaa7f13f6c
DIFF: https://github.com/llvm/llvm-project/commit/90e1c292e3745acdd2b89ac9aafdfdaaa7f13f6c.diff
LOG: [SandboxIR][NFC] Add missing getTopmostLLVMInstruction() (#102266)
`getTopmostLLVMInstruction()` was missing in a couple of places, this patch made sure to add them.
Added:
Modified:
llvm/lib/SandboxIR/SandboxIR.cpp
Removed:
################################################################################
diff --git a/llvm/lib/SandboxIR/SandboxIR.cpp b/llvm/lib/SandboxIR/SandboxIR.cpp
index d1d238f9608c4..65e9d86ee0bdf 100644
--- a/llvm/lib/SandboxIR/SandboxIR.cpp
+++ b/llvm/lib/SandboxIR/SandboxIR.cpp
@@ -546,7 +546,8 @@ void SelectInst::dump() const {
BranchInst *BranchInst::create(BasicBlock *IfTrue, Instruction *InsertBefore,
Context &Ctx) {
auto &Builder = Ctx.getLLVMIRBuilder();
- Builder.SetInsertPoint(cast<llvm::Instruction>(InsertBefore->Val));
+ llvm::Instruction *LLVMBefore = InsertBefore->getTopmostLLVMInstruction();
+ Builder.SetInsertPoint(cast<llvm::Instruction>(LLVMBefore));
llvm::BranchInst *NewBr =
Builder.CreateBr(cast<llvm::BasicBlock>(IfTrue->Val));
return Ctx.createBranchInst(NewBr);
@@ -565,7 +566,8 @@ BranchInst *BranchInst::create(BasicBlock *IfTrue, BasicBlock *IfFalse,
Value *Cond, Instruction *InsertBefore,
Context &Ctx) {
auto &Builder = Ctx.getLLVMIRBuilder();
- Builder.SetInsertPoint(cast<llvm::Instruction>(InsertBefore->Val));
+ llvm::Instruction *LLVMBefore = InsertBefore->getTopmostLLVMInstruction();
+ Builder.SetInsertPoint(LLVMBefore);
llvm::BranchInst *NewBr =
Builder.CreateCondBr(Cond->Val, cast<llvm::BasicBlock>(IfTrue->Val),
cast<llvm::BasicBlock>(IfFalse->Val));
More information about the llvm-commits
mailing list