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?

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.