chapel-lang/chapel — pull request #293 by ronawho (2014-09-03 20:32:38+00:00)
Title: Update licm to hoist wide variables

In what is probably my largest blunder to date, licm never hoisted wide
variables which meant it didn't help --no-local, gasnet, numa, etc.

I haven't come up with a great explanation for why we explicitly didn't hoist
wide things before, however we do now! When Michael gave his presentation on
his remote cache, I was curious as to why licm wasn't helping things, and why
we were doing so many comm calls for things that licm should have helped with.
That was my motivation for originally looking into this.

To hoist wide variables, this rips out the couple of lines that checked for
wide things and fixes a few latent bugs.

bugs in licm that prevented this from just working were:
- globals were still being hoisted in some cases (other checks missed them)

- licm does not operate on functions with atomics or syncs/singles
- However we were only checking for those types, and not checking if the
function contained references of those types.

- A particularly tricky one is that variables that are passed by ref are not
always identified as being passed by ref and instead have in intent for a
ref variable. This is because of a latent bug in the compiler that has been
documented. I made a pivotal item to address it and added a note in LICM.
For now the workaround is to assume all arguments that have a ref type are
passed by ref and check the type as well as the intent.

In order to check for ref arguments, I moved licm up (so that I didn't have go
through the maze of finding the actual argument through it's wide type.) Doing
so also allows me to remove all the special code checking for wide things

As a result of this there are several tests with substantial comm count
improvements. Note that this should many more tests than were changed, but it's
already known that licm isn't effective with bounds checks, and these
particular tests happened to through --fast.