Add workaround for a code generation bug in clang 7
Clang 7 has a nasty bug in its optimizer that generates wrong code for std::min_element followed by std::rotate that uses the result of std::min_element. This patch adds a workaround with a hand-rolled rotate implementation for this special case.
I've also filed a clang bug at https://bugs.llvm.org/show_bug.cgi?id=40641.