<rdar://problem/13479539> Only rebuild the global module cache when we're allowed to.

This eliminates excessive rebuilds of the global module cache.