Rory McIlroy threw the ceremonial first pitch at the San Francisco Giants home game against the Houston Astros on the Tuesday before the 2012 U.S. Open .