I have both lenses. The Tamron is very sharp and crisp. It suffers from both vignetting and softness when wide-open and all my sensors are cropped. At f/8 the image quality is wonderful. The AF is noticeably slower than Canon USM and can be distinctly heard. The focus ring also spins.
The Canon 17-40 helps produce images that are sharp and crisp at wide open...which is f/4. The colrs are deep and not nearly as superficial looking as the Tamron. It is built so much better than the Tamron and AF's very quick and quiet.
The Tamron, imo, is inferior to the Canon. That said, those things that it lacks or suffers make it a fun lens to use and especially good for weddings!