similar to: [LLVMdev] Cloning block for newbie

Displaying 20 results from an estimated 1000 matches similar to: "[LLVMdev] Cloning block for newbie"

2012 Jun 21
0
[LLVMdev] Cloning block for newbie
Please reply-all so that the thread is kept on llvmdev. The LLVM Programmer's Manual has examples of how to iterate over many common structures, such as instructions in a basic block[1]. Other than that, you can check the source code or doxygen[2]. Basically, you loop over the instructions as detailed in the programmer's manual[1], and loop over the operands using User's
2012 Jun 22
1
[LLVMdev] Cloning block for newbie
Thank you for your help. It's working now. I wasn't aware of the usefulness of the User class. The ValueMapper.cpp's "RemapInstruction()" also helped me a lot to remap phi nodes and metadatas. Thank you very much. 2012/6/21 Michael Ilseman <michael at lunarg.com> > Please reply-all so that the thread is kept on llvmdev. > > The LLVM Programmer's Manual
2017 Jun 20
2
CloneFunctionInto produces invalid debug info
I was just going to say: With well-formed debug info it should create a deep copy up until the DISubprogram, but no further. But because the DISubprogram linked to the Function is missing the special handling of the DISubprogram (that would prohibit cloning the DICompileUnit is side-stepped). But then I remembered the discussion we had in
2016 May 05
2
No remapping of clone instruction in CloneBasicBlock
Hi, Found CloneBasicBlock utility only does the cloning without any remapping. Consider below example: Input block: sw.epilog: ; preds = %sw.bb20, %sw.bb15, %sw.bb10, %sw.bb6, %sw.bb2, %sw.bb, %while.body, %if.end29 %no_final.1 = phi i32 [ %no_final.055, %while.body ], [ 1, %if.end29 ], [ %no_final.055, %sw.bb20 ], [ %no_final.055, %sw.bb15 ], [
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip, The error happens when the program finishes and it automatically calls the destructors, so it is not an error specifically inside my program. Here's the full code: #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/MCJIT.h" #include "llvm/IRReader/IRReader.h" #include "llvm/Support/TargetSelect.h" #include
2018 Sep 06
2
Replacing a function from one module into another one
Hi Philip, Thanks for the reference, I was able to follow it and copy the code that I saw necessary, but I still have some issues (references are still not updated). I created the function: void populateVMap(llvm::ValueToValueMapTy &VMap, llvm::Function *fOld, llvm::Function *fNew) { llvm::Function::arg_iterator DestI = fOld->arg_begin(); for (llvm::Function::const_arg_iterator J =
2019 Oct 30
2
How to make ScalarEvolution recompute SCEV values?
Hello all, I’m pretty new to LLVM. I'm writing a pass for loop optimization. I clone and rearrange loops, setting the cloned loop as the original loop’s parent. This can be done multiple times, until there is no more work to do. The trouble is, after the first time I do this, the cloned loop's SCEVs become unknown types when they should be AddRecExpr. If I re-run the whole pass on the
2017 Jun 08
4
DICompileUnit duplication in LLVM 4.0.0?
All, I'm seeing duplication of DICompileUnits in a pass that worked in 3.8. I assume I'm doing something wrong. Would someone be willing to point me in the right direction? The below minimized pass reproduces my issue in 4.0 with the following error: DICompileUnit not listed in llvm.dbg.cu !1707 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang
2016 Mar 01
2
Insert CallInst within a function passing same parameters of the calling function.
Hi, supposing I have a function “foo” like the following: int foo(int a, int b) { ... ... } I want to insert int the LLVM IR a call instructions to a function “bar” that requires the same parameters of foo. So my function foo will become: int foo(int a, int b) { bar(a,b); … ... } I am using the following code: bool ThreadSanitizer::runOnFunction(Function &F) {
2013 May 29
2
[LLVMdev] CloneFunctionInto() Error
Dear All, I need your help urgently I have to copy the CFG of each function using CloneFunction or CloneFunctionInto. After I made the copy function. Print the basic blocks then get this error : While deleting: i32 % Use still stuck around after Def is destroyed: %mul2_ = mul nsw i32 %6, 3 Use still stuck around after Def is destroyed: store i32 3, i32* %x_, align 4 opt: Value.cpp:75: virtual
2018 Sep 04
2
Replacing a function from one module into another one
Hi Philip, Thank you very much for your answer, the vector declaration example worked. I'm pretty sure the ValueToValueMapTy is the last thing I need because I even saw there is another function that could help me llvm*:*:RemapFunction <http://llvm.org/doxygen/namespacellvm.html#addf0183e92893bdbcde00fc9091dda93>; but my problem is that I don't know how to populate the
2017 Jun 08
2
DICompileUnit duplication in LLVM 4.0.0?
Thank you. What I need to do to address this? Open an issue on bugs.llvm.org? I'm not sure what the fix needs to be in the cloner. On Thu, Jun 8, 2017 at 4:19 PM, Peter Collingbourne <peter at pcc.me.uk> wrote: > There have in the past been bugs in the cloner involving duplicate > DICompileUnits (see e.g. https://reviews.llvm.org/D29240), this one may > need a similar fix.
2016 Jul 14
2
clone function
Hi, I am trying to use the CloneFunction from llvm/Transforms/Utils/Cloning.h and I don't understand how the ValueToValueMapTy argument should be initialized. For instance, let say I want to clone this function (to add an argument): define void @function(i32 %i) #0 { entry: %i.addr = alloca i32, align 4 store i32 %i, i32* %i.addr, align 4 ret void } to another function which should,
2016 Jul 15
2
clone function
On 14 July 2016 at 20:07, Mehdi Amini <mehdi.amini at apple.com> wrote: > > On Jul 14, 2016, at 7:58 AM, Pierre Gagelin via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > Hi, > > I am trying to use the CloneFunction from llvm/Transforms/Utils/Cloning.h > and I don't understand how the ValueToValueMapTy argument should be > initialized. For instance,
2013 May 29
0
[LLVMdev] CloneFunctionInto() Error
Does cloning copies the function with its address or it constructs a new address to the new function? Is this real copying for the CFG or just opaque one to do some work? If it's not real copying, please I need a method that can help me in copying the function in another with new pointer to another address. Please I need answer urgent Thanks On 29 May 2013 10:14, Rasha Omar <rasha.sala7
2010 Jun 04
4
[LLVMdev] Duplicating a Basic Block
Hi, I had asked earlier from my another ID about duplicating a basic block, but that server is down for moment. I was given suggestion to use CloneBasicBlock, but when I used it I get an error : While deleting: i32* %a Use still stuck around after Def is destroyed: store i32* %a, i32** %p, align 4 opt: /home/ambika/llvm_3/llvm-2.6/lib/VMCore/Value.cpp:81: virtual llvm::Value::~Value():
2010 Jun 04
0
[LLVMdev] Duplicating a Basic Block
On Fri, Jun 4, 2010 at 2:15 AM, Ambika Agarwal <agarwal.ambika at gmail.com> wrote: > Hi, > > I had asked earlier from my another ID about duplicating a basic block, but > that server is down for moment. > I was given suggestion to use CloneBasicBlock, but when I used it I get an > error : > > While deleting: i32* %a > Use still stuck around after Def is
2011 Apr 17
4
[LLVMdev] Regarding BasicBlock Cloning
The clone llvm:CloneBasicBlock copies the phi function in the replicated basic block from the original basic block. I don't want the copy of phi in relplicated 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. Tarun On Sun, Apr 17, 2011 at 5:22 AM, Eli
2019 May 17
3
Copy Function from one LLVM IR file to another
Hello everyone, I wanted to copy a function from one file to another. The file that I wanted to copy the function into contains a function with the same name and same number of instructions. I decided to just replace the instructions with those of the other function. I am doing all of this from within a function pass. *1.* I created a function pass in which I extract a function using
2016 Feb 09
2
CloneFunction during LTO leads to seg fault?
Hi Medhi, Thanks for you reply. Here is the full output of -print-after-all [1] and just the module itself after my pass[2]. I've looked over the IR, but I can't see anything obviously wrong. I'm not sure what you meant by: > You may want to try to add it at the end of the pipeline My pass is the last one added inside populateLTOPassManager. Should I add it to the