similar to: [LLVMdev] mem2reg & reg2mem

Displaying 20 results from an estimated 9000 matches similar to: "[LLVMdev] mem2reg & reg2mem"

2011 May 17
1
[LLVMdev] eliminate phi nodes, reduce unnecessary loads / stores , reg2mem, mem2reg
Hi, I work on a pass that requires as input LLVM code without any phi nodes. For this, I use the reg2mem pass which produces suitable code, the pass runs correctly, but I obtain a significant performance decrease. I expect that this is because there are more reads / writes to memory after running the reg2mem pass. How can I optimize the code, without inserting any phi nodes? Or is there a
2011 Jun 20
0
[LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
I guess AU.addRequiredID(DemoteRegisterToMemoryID) would do the trick. - xi On Jun 19, 2011, at 11:03 PM, Chuck Zhao wrote: > I am currently building a BasicBlock pass which requires to run -reg2mem before it, and need to run -mem2reg after it to clean up. > > So, I want to specify -reg2mem as one of the pre-requisite passes to it, as: > > > class MyPass: public
2011 Jun 20
2
[LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass
I am currently building a BasicBlock pass which requires to run -reg2mem before it, and need to run -mem2reg after it to clean up. So, I want to specify -reg2mem as one of the pre-requisite passes to it, as: class MyPass: public BasicBlockPass{ virtual void getAnalysisUsage(AnalysisUsage &AU){ ... AU.addRequired<RegToMem>(); ... } }; I searched all passes under
2011 May 30
1
[LLVMdev] Reg2mem: Identifying introduced memory locations (also, what happens to the phi nodes)
Hi. Im exploring `opt -reg2mem` output for a simple C program (actually, that is this snippet: http://rosettacode.org/wiki/Dining_philosophers#C - compiled with clang -O1) and got two questions regarding this pass. 1. How would I tell which memory locations were introduced by the pass, and which memory locations were present in the original program? After a brief diffing of .ll files, I'd
2013 Feb 26
1
[LLVMdev] mem2reg for non entry blocks?
On 2/26/13 8:06 AM, Duncan Sands wrote: > Hi Justin, > >> an alloca outside of the entry block might be inside a loop, in >> which case the >> semantics are that it would allocate more stack space on every >> loop iteration. >> I think some of the optimizers that run later try to move allocas >> into the entry >> block if possible,
2015 Jul 17
2
[LLVMdev] Suspicious behavior of mem2reg (promoteSingleBlockAlloca)
Hi LLVMDev, this is Jeehoon Kang, a Ph.D. student of Software Foundations Laboratory ( http://sf.snu.ac.kr), Dept. of Computer Science & Engineering, Seoul National University. Our group studied the mem2reg pass, and we got a question on its algorithm. As far as I understand, the mem2reg pass essentially uses the SSA construction algorithm to promote allocas into registers, but there are
2013 Feb 26
2
[LLVMdev] mem2reg for non entry blocks?
On Tue, Feb 26, 2013 at 5:42 AM, Duncan Sands <baldrick at free.fr> wrote: > Hi Vinod, > > > On 23/02/13 02:20, Vinod Grover wrote: > >> Sorry if this has been discussed before, but I would appreciate any >> pointers. >> I am trying to understand why mem2reg only looks at allocas in entry >> blocks, and >> not for any allocas in a function. One
2009 Sep 26
1
[LLVMdev] LLVM SSA
I tried using the mem2reg pass with opt, e.g. opt -reg2mem x.bc > x2.bc where x.bc was produced with: llvm-gcc -O2 -emit-llvm -c x.c -o x.bc This did not reduce the # of variables in x2.bc I use -O2 because it produces the least # of instructions and hence the least # of new SSA virtual registers. Do you have a set of options to give to llvm-gcc or opt in mind ? My goal is to take a .c
2013 Feb 26
0
[LLVMdev] mem2reg for non entry blocks?
Hi Justin, > an alloca outside of the entry block might be inside a loop, in which case the > semantics are that it would allocate more stack space on every loop iteration. > I think some of the optimizers that run later try to move allocas into the entry > block if possible, but in general it is simpler to have the front-end just put > them there in the first
2008 Jul 07
0
[LLVMdev] SSA or not SSA?
All register uses are SSA. Memory is not in SSA. The mem2reg pass which promotes stack variables to registers effectively converts non- SSA to SSA. There was a reg2mem pass, written by Andrew Lenharth, I'm not sure if it's still being maintained. On Jul 7, 2008, at 8:47 AM, Matthieu Moy wrote: > Hi, > > Silly question from an LLVM newbie: the LLVM LRM say that the
2020 Feb 12
2
tool options to generate spill code
Hello, For the following test case, reg.c #include <stdio.h> int getinput() { static int u=10; return u++; } int main() { int a,b,c,d,e,f,g; a=getinput(); b=getinput(); c=getinput(); d=getinput(); e=getinput(); f=getinput(); g=getinput(); printf("%d %d %d %d %d %d %d\n",a,b,c,d,e,f,g); a=b=c=d=e=f=g=0; return 0; } *1.
2012 Jul 25
1
[LLVMdev] Inneffiecient code produced by reg2mem?
Is there a pass I can use after reg2mem to get rid of occurances like this?: store i32 %cond, i32* %cond.reg2mem %cond.reload = load i32* %cond.reg2mem store i32 %cond.reload, i32* %cond4.reg2mem Essentially, in this case, reg2mem creates an extra memory space to store and load a value from just here, and never uses the value again; since this isn't efficient code, I'm wondering if
2013 Feb 26
0
[LLVMdev] mem2reg for non entry blocks?
Hi Vinod, On 23/02/13 02:20, Vinod Grover wrote: > Sorry if this has been discussed before, but I would appreciate any pointers. > I am trying to understand why mem2reg only looks at allocas in entry blocks, and > not for any allocas in a function. One case where allocas could be used to build > local data structures like linked list (and so on make it unsafe), and for that > the
2013 Sep 22
0
[LLVMdev] Why total number of store instructions increased in case of gvn with reg2mem?
Might have to do with GVN's PRE (partial redundancy elimination), which tends to increase code size. H. ----- Original Message ----- From: Abhinash Jain Sent: 09/22/13 01:17 AM To: llvmdev at cs.uiuc.edu Subject: [LLVMdev] Why total number of store instructions increased in case of gvn with reg2mem? Below are the 4 cases out of which for the first 3 cases am able to understand the variation
2008 Oct 16
0
[LLVMdev] Requiring a pass to run before/after a pass? (Adding PHIs and updating uses)
On Oct 16, 2008, at 8:29 AM, Edward Lee wrote: > Is there a simple way to require a pass, e.g., Reg2Mem/Mem2Reg, to > run before/after my transformation pass? Or do I do something like: One simplest way is to handle this is to add these passes around your pass in the pass manager. pm.add(Reg2Mem) pm.add(MyPass) pm.add(Mem2Reg) > > > struct myOpt { > myOpt() { >
2013 Sep 22
0
[LLVMdev] Why total number of store instructions increased in case of gvn with reg2mem?
Below are the 4 cases out of which for the first 3 cases am able to understand the variation on total number of store inst. But when -gvn parameters is passed (in case 4) , why does the total number of strore Instruction present on the attached file increases (instead of decrease). Please explain considering that use of -reg2mem pass is mandatory. eg. clang -emit-llvm bzip.c -c -o bzip1.bc
2013 Feb 23
2
[LLVMdev] mem2reg for non entry blocks?
Sorry if this has been discussed before, but I would appreciate any pointers. I am trying to understand why mem2reg only looks at allocas in entry blocks, and not for any allocas in a function. One case where allocas could be used to build local data structures like linked list (and so on make it unsafe), and for that the existing conditions in IsAllocaPromotable (i.e. the alloca pointer cannot
2011 Jan 23
0
[LLVMdev] Undoing SSA and Phi instructions
On 01/22/2011 10:30 PM, Surinder wrote: > Hi, > > I am emitting llvm bit code using > > llvm-gcc -c -emit-llvm -O0 -o test.bc test.c > > and then optimizing it with > > opt -O3 -print-module test.bc > > in order to obtain a dump of generated IR. > > > The resulting code has Phi nodes and is perhaps in SSA form. I want > to undo the SSA form while
2011 Aug 03
2
[LLVMdev] scalar evolution to determine access functions in arays
Hello Tobi, You are right, we need to run some other passes before running the scalar evolution pass. The sequence that I run for this example is -O3 -loop-simplify -reg2mem.  This is why I did not obtain the expressions depending on the loop indices. So I removed the reg2mem pass and scalar evolution computes the correct functions. However, I need to run the reg2mem pass (or any other that
2008 Oct 07
0
[LLVMdev] mem2reg optimization
Hi Chris, Sounds like an excellent generic approach. I'd love to lend a hand to implement it but I'm afraid it involves a little more in-depth LLVM knowledge than what I currently master, so I'll leave it to Dave and you for now... Talking about performance, for me this optimization was the difference between mem2reg taking 63% of execution time, and having it totally