search for: splitbasicblock

Displaying 20 results from an estimated 51 matches for "splitbasicblock".

2010 Dec 31
3
[LLVMdev] CodeExtractor.cpp potential bug?
There might be a misuse of DominatorTree::splitBasicBlock in CodeExtractor.cpp, line 145. Header is splited into two (OldPred->NewBB). Line 145 updates the dominator tree by calling DT->splitBasicBlock(NewBB). I think it should be DT->splitBasicBlock(OldPred). When I tried to extract a code region whose header has 2 successors, my pass crashed....
2011 Jan 03
0
[LLVMdev] CodeExtractor.cpp potential bug?
On Dec 31, 2010, at 11:20 AM, Vu Le wrote: > There might be a misuse of DominatorTree::splitBasicBlock in CodeExtractor.cpp, line 145. > Header is splited into two (OldPred->NewBB). > > Line 145 updates the dominator tree by calling DT->splitBasicBlock(NewBB). > I think it should be DT->splitBasicBlock(OldPred). > > When I tried to extract a code region whose header has...
2009 May 08
2
[LLVMdev] Splitting a basic block, replacing it's terminator
Hi, I want to insert a conditional branch in the middle of a basic block. To that end, I am doing these steps: (1) Split the basic block: bb->splitBasicBlock() (2) Remove the old terminator: succ->removePredecessor(bb) bb->getTerminator()->getParent() (3) Adding a new terminator: BranchInst::Create(ifTrue, ifFalse, cnd, "", bb); That seems to work, but later passes are dieing. When I dump the function from my debugger, I notice...
2014 Oct 30
2
[LLVMdev] Emit a jump instruction to a place inside basicblock
On Thu, Oct 30, 2014 at 2:33 PM, Robin Morisset <morisset at google.com> wrote: > Hi, > > From my understanding of the LLVM IR, it is impossible to jump to the > middle of a Basic Block, only to its beginning. But there is a > splitBasicBlock function that seems like it might be useful to you, to make > sure a basic block is starting at the exact place you want to jump. > > Best regards, > Robin > Thanks you all! I'm looking at splitBasicBlock and trying to use that. BTW, is there a way at lower level of LLVM that ca...
2011 Jan 24
0
[LLVMdev] CodeExtractor.cpp potential bug?
...->B, when I call Split(), which is NewBB? > A or B. > Thanks, > Vu > > > On Mon, Jan 3, 2011 at 1:25 PM, Cameron Zwarich <zwarich at apple.com> wrote: > >> On Dec 31, 2010, at 11:20 AM, Vu Le wrote: >> >> > There might be a misuse of DominatorTree::splitBasicBlock in >> CodeExtractor.cpp, line 145. >> > Header is splited into two (OldPred->NewBB). >> > >> > Line 145 updates the dominator tree by calling >> DT->splitBasicBlock(NewBB). >> > I think it should be DT->splitBasicBlock(OldPred). >> >...
2014 Oct 30
2
[LLVMdev] Emit a jump instruction to a place inside basicblock
..., Oct 30, 2014 at 2:33 PM, Robin Morisset <morisset at google.com> >> wrote: >> >>> Hi, >>> >>> From my understanding of the LLVM IR, it is impossible to jump to the >>> middle of a Basic Block, only to its beginning. But there is a >>> splitBasicBlock function that seems like it might be useful to you, to make >>> sure a basic block is starting at the exact place you want to jump. >>> >>> Best regards, >>> Robin >>> >> >> Thanks you all! I'm looking at splitBasicBlock and trying to use...
2014 Oct 29
4
[LLVMdev] Emit a jump instruction to a place inside basicblock
Hi all, I'm a beginner in LLVM. Currently, I want to implement a pass that generates a jump table. The entry in that table is a jump to some place (may be an instruction) in a basic block. I'm reading the JumpTable code in llvm 3.5, there is a table which contains jump entries to functions. In AsmPrinter::doFinalization function from file lib/CodeGen/AsmPrinter/AsmPrinter.cpp, it gets a
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
Hi Dean, Thanks for your reply. That's exactly what I am doing, but I was looking for a default optimization or pass implementation if there was. I used BasicBlock::splitBasicBlock() but it puts "br" end of original basic block. I tried to delete the br instruction by using eraseFromParent() but it didn't work. I had to rewrite my own splitBasicBlock() by modifying the original one. Just removed the br instruction creation lines. >> Just curious, how are...
2009 May 08
0
[LLVMdev] Splitting a basic block, replacing it's terminator
On May 8, 2009, at 4:02 PM, Nick Johnson wrote: > I want to insert a conditional branch in the middle of a basic block. > To that end, I am doing these steps: > > (1) Split the basic block: > bb->splitBasicBlock() > > (2) Remove the old terminator: > succ->removePredecessor(bb) > bb->getTerminator()->getParent() Assuming that the new block will still be a successor of the old block (just not the unique successor), all you really need to do is: BasicBlock* succ = bb->splitBasicB...
2018 May 24
0
LLVM Pass To Remove Dead Code In A Basic Block
> On 25 May 2018, at 01:46, Aaron via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi all, > > LLVM optimization pass gives an error "Terminator found in the middle of a basic block!" since basic block IR may have multiple "ret" instructions. It seems LLVM does not accept multiple return in a basic block by default. > Yes, if you’re inserting
2011 Apr 17
4
[LLVMdev] Regarding BasicBlock Cloning
...plicated block. How can I do this. > > > > 2) I need to insert that basic block after and before some particular > basic > > block. > > You probably want to use llvm::CloneBasicBlock from > Transforms/Utils/Cloning.h to get a cloned version of a block. > BasicBlock::splitBasicBlock might be useful as well. > > -Eli > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110417/e917db8a/attachment.html>
2018 May 24
2
LLVM Pass To Remove Dead Code In A Basic Block
Hi all, LLVM optimization pass gives an error "Terminator found in the middle of a basic block!" since basic block IR may have multiple "ret" instructions. It seems LLVM does not accept multiple return in a basic block by default. Is there a specific optimization or pass that I can enable to remove unreachable codes in basic blocks? Best, Aaron -------------- next part
2010 Oct 21
2
[LLVMdev] Splitting basic blocks while preserving machine code
...g machine code. To put it another way, the binary executable that is produced when the pass is present must be identical to what is produced when the pass is not present. That said, I have run into a situation where it would help to split certain basic blocks, probably by calling BasicBlock::splitBasicBlock. But this method adds an unconditional branch instruction. Would this new instruction alter the machine code that is later generated, or would the additional branch somehow be optimized away in subsequent passes? Thanks, Trevor
2018 May 25
0
LLVM Pass To Remove Dead Code In A Basic Block
...I was looking for a default optimization or pass implementation if there was. > There’s a dead code elimination pass, but it works with a control flow graph (it removes basic blocks that are unreachable after constant propagation and other passes earlier on have run). > I used BasicBlock::splitBasicBlock() but it puts "br" end of original basic block. I tried to delete the br instruction by using eraseFromParent() but it didn't work. > This is working as intended. All LLVM BasicBlocks *must* have a terminator as the last instruction. > I had to rewrite my own splitBasicBlock(...
2012 Feb 03
5
[LLVMdev] Updating PHI for Instruction Domination?
So my best bet is to try and work in reg2mem mode and then go back to mem2reg? I'm curious, it seems though when you split a block that the phis get updated, right? On Thu, Feb 2, 2012 at 5:05 PM, Eric Christopher <echristo at apple.com> wrote: > Not that I'm aware of. > > -eric > > On Feb 2, 2012, at 3:47 PM, Ryan Taylor wrote: > > So essentially I'm
2010 Oct 21
0
[LLVMdev] Splitting basic blocks while preserving machine code
...another > way, the binary executable that is produced when the pass is present > must be identical to what is produced when the pass is not present. > > That said, I have run into a situation where it would help to split > certain basic blocks, probably by calling BasicBlock::splitBasicBlock. > But this method adds an unconditional branch instruction. Would this > new instruction alter the machine code that is later generated, or > would the additional branch somehow be optimized away in subsequent > passes? It probably would be optimized away, yes, but I would rec...
2010 Oct 28
2
[LLVMdev] Splitting a basic block creates an instruction without debug metadata
Hi, I'm not sure if this is really a problem or not, but I noticed that if you're working with bitcode that has debug metadata, and you split a BasicBlock using llvm::SplitBlock or BasicBlock::splitBasicBlock, the unconditional branch added to the new block will lack debug metadata. This turned out not to be a problem for me, since my analysis pass needs only one instruction in the block to have metadata, but perhaps it will be a problem for others. Ignoring for now the issue of just how to ma...
2011 Apr 16
0
[LLVMdev] Regarding BasicBlock Cloning
...but without phi function in the > replicated block. How can I do this. > > 2) I need to insert that basic block after and before some particular basic > block. You probably want to use llvm::CloneBasicBlock from Transforms/Utils/Cloning.h to get a cloned version of a block. BasicBlock::splitBasicBlock might be useful as well. -Eli
2011 Apr 17
0
[LLVMdev] Regarding BasicBlock Cloning
...cated block. For now I am creating .bc > file with -O0 option so that it doesn't generate phi function in first > place. Is this a good approach or there are some other function available > for it. CloneBasicBlock isn't going to do anything magical... I pointed towards BasicBlock::splitBasicBlock because I figured you could split the PHIs out of the block you want to clone, or something like that. Using DemotePHIToStack on PHI nodes to eliminate them is another possibility. Trying to do optimizations without running mem2reg is a really bad idea for practical use: most optimization opportun...
2011 Sep 30
2
[LLVMdev] New entry Block
Hi, I'd like to know if is possible to create a new entry block and a branch to old entry block? How can i make this? Thanks -- *Rafael Parizi* -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110930/a7c133f9/attachment.html>