The motivation is that 'createInvariantCond' unconditionally builds icmp in the loop block, while it could always do it in preheader. Build it in preheader instead. Patch by Aleksandr Popov! Differential Revision: https://reviews.llvm.org/D141994 Reviewed By: nikic