CRPC-TR93306 -- abstract, keywords SIMD architectures offer an alternative to MIMD architectures for obtaining high performance computation through parallelism. However, to obtain the best performance on such architectures, aggressive compilation techniques are required. One issue that SIMD compilers must address is generating code to change the machine context; i.e., disabling processors not involved in the current computation. This paper addresses the cost of changing the machine context. We present two compiler optimizations that reduce the cost of context changes. The first optimization, context partitioning, reorders the code so that as subgrid loops are generated, as many statements as possible that require the same context are placed in the same loop nest. The second optimization, context splitting, splits the iteration space of the subgrid loops into sets that have invariant contexts. This allows us to hoist the code that sets the machine context out of the subgrid loops. Keywords: SIMD compilation, context changes, loop fusion, loop splitting