Rory McIlroy won his second major with a dominant display in the US PGA Championship as he finished eight stokes clear of his nearest rival.