Alexey Bakhirkin
2011-May-30 19:53 UTC
[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 suppose that introduced "alloca"s would put their result in a variable named "somename.reg2mem". But is the ".reg2mem" suffix a reliable way to identify introduced allocas? 2. There seems to be no "phi" instructions after the pass. Does the pass always remove all "phi" instructions?
Duncan Sands
2011-May-30 20:23 UTC
[LLVMdev] Reg2mem: Identifying introduced memory locations (also, what happens to the phi nodes)
Hi Alexey,> 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 suppose that introduced > "alloca"s would put their result in a variable named > "somename.reg2mem". But is the ".reg2mem" suffix a reliable way to > identify introduced allocas?as a general rule you shouldn't make any use of names. For example, it is perfectly possible for instructions to have no names.> 2. There seems to be no "phi" instructions after the pass. Does the > pass always remove all "phi" instructions?I believe so. In fact I think that's the point of this pass. Ciao, Duncan.
Apparently Analagous Threads
- [LLVMdev] eliminate phi nodes, reduce unnecessary loads / stores , reg2mem, mem2reg
- [LLVMdev] Inneffiecient code produced by reg2mem?
- [LLVMdev] Why total number of store instructions increased in case of gvn with reg2mem?
- [LLVMdev] Why total number of store instructions increased in case of gvn with reg2mem?
- [LLVMdev] run -mem2reg and -reg2mem programmably from within a Pass