yaxunl added a comment. what if the operation happens in divergent control flow, e.g int x = 0; x = threadIdx.x > 32 : threadIdx/64 : 0; will this patch still work? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132511/new/ https://reviews.llvm.org/D132511