A number of related bugs were fixed in r197036; see also [[ http://llvm-reviews.chandlerc.com/D2241 | D2241 ]] (I doubt the test cases from there were ever committed). I've added two more related test cases to PR18567. http://llvm-reviews.chandlerc.com/D2607