Question to Chris

Thank you, Bill.
Seems to be better.
Anyway...Is there a way I can do what you showed for me?

Thanks,
Seung J. Lee

Seung,

If your main problem is identifying loop induction variables (and other linked recurrences which may also be used to index arrays in the loop), then SSA form actually will help you. Here is a very good algorithm for identifying and optimizing such variables using SSA form:

Operator Strength Reduction, Keith Cooper, L. Taylor Simpson and Christopher Vick, ACM Transactions on Programming Languages and Systems, 23(5), Sept. 2001.

If that’s not your main problem, exactly what problem are you having with Phi nodes?

–Vikram
http://www.cs.uiuc.edu/~vadve
http://llvm.org/

Hi Seung,

It should be fairly straight-forward to do in LLVM. Once you identify the loops, then identify the PHI nodes that you need to convert, then apply the transformation below. The fine details on how to create an instruction and replace one instruction with another are documented in the docs section and in other code. :slight_smile: One thing to be careful of, if you convert a variable like I showed, then you need to make sure that it's not used in any other PHI nodes (if it is, then you'll need to perform some other type of transformation).

-bw

Bill,

Depending on what Seung's problem is, converting *out* of SSA form may actually be the wrong thing to do. Seung needs to explain exactly problem he is unable solve using SSA form.

--Vikram
http://www.cs.uiuc.edu/~vadve
http://llvm.org/

Indeed. But I was just going on what he'd told us. :slight_smile: It's up to him
to do what's best for his program.

-bw