This is a bugfix in IVDescriptor.cpp.
The helper function RecurrenceDescriptor::getExactFPMathInst() is supposed to return the 1st FP instruction that does not allow reordering. However, in certain cases it does not work as expected. For instance, in the test cases added in this patch, RecurrenceDescriptor::getExactFPMathInst() returns NULL for the reduction descriptor that corresponds to the reduction PHI node. This is because when constructing the RecurrenceDescriptor, we trace the use-def chain staring from a PHI node and for each instruction in the use-def chain, its descriptor overrides the previous one . Therefore in the final RecurrenceDescriptor we constructed., we lose previous FP instructions that does not allow reordering.
For the test case added in this patch, it should not be vectorized if reordering is not allowed. However with the current trunk it is vectorized.
Can you please add some CHECK-UNORDERED lines here? I believe for this test we should vectorise when reordering is allowed.