I'm withdrawing this patch for now. I keep getting segfaults with Mesa 18.1.1. For now I've updated Mesa in staging to 18.0.5 instead, which is the last release of the 18.0 series. It's also the last version to support LLVM < 4.