Barriers are not fully idempotent, conside: :
%b1 = call i8* @llvm.invariant.group.barrier(i8* %p) call void @foo(i8* %b1) %b3 = call i8* @llvm.invariant.group.barrier(i8* %b1)
But we can do it safely if the barrier has only one use -
barrier(barrier(x))