Divergence analysis for GPU programs