Patch contributed by Jeff Cohen. llvm-svn: 17888
Patch contributed by Morten Ofstad. llvm-svn: 17829
llvm-svn: 17446