[LLVMdev] [RFC] SCEV Enhancements
David Greene
dag at cray.com
Thu Feb 23 08:20:18 PST 2012
I have a few enhancements to SCEV to help it identify more types of
recurrences. I want to send these upstream but I need a little
feedback.
I've added ptrtoint and inttoptr SCEV expressions so that recurrences
involving these constructs can be recognized. However, this scary
comment gives me pause:
// It's tempting to handle inttoptr and ptrtoint as no-ops, however this can
// lead to pointer expressions which cannot safely be expanded to GEPs,
// because ScalarEvolution doesn't respect the GEP aliasing rules when
// simplifying integer expressions.
Now, we don't handle them as no-ops because we create explicit
expression for them, similar to how ZExt and SExt work. So any pass
using the analysis has to explicitly look through a ptrtoint or inttoptr
while examining a SCEV expression.
These enhancements are critical for us because of the way our frontends
work (less than ideal but we have to deal with it), due to some language
quirks (casting in C, odd Fortran constructs, etc.) and because users
sometimes stretch the boundaries of good taste :).
Is this a reasonable approach? Is this acceptable to upstream?
Thanks!
-Dave
More information about the llvm-dev
mailing list