__syncthreads() question

I have a fairly simple question. I know that it is not safe to use __syncthreads() inside a conditional, but what about this?

__global__ void foo(int N)

{

  if (threadIdx.x >= N) return;

	// do something

	__syncthreads();

}

Thanks!

this will deadlock, is the threads with threadIdx.x >= N will never reach the syncthreads();

But

__global__ void foo(int N)

{

  if (threadIdx.x <0 N) {

	// do something

  }

	__syncthreads();

}

will not deadlock and have the same effect