[CodeGenPrepare] Avoid sinking soft-FP comparisons
authorPeter Zotov <whitequark@whitequark.org>
Sun, 3 Apr 2016 16:36:17 +0000 (16:36 +0000)
committerPeter Zotov <whitequark@whitequark.org>
Sun, 3 Apr 2016 16:36:17 +0000 (16:36 +0000)
commit0b6d7bc6820702a803ec180435b899e692e8c229
treee55dc90f9e79c759d846660834f23c4521edeb7f
parent20d1d4f0454f1e68fb69a710707243f7b50edff8
[CodeGenPrepare] Avoid sinking soft-FP comparisons

Sinking comparisons in CGP can undo the job of hoisting them done
earlier by LICM, and soft-FP makes this an expensive mistake.

A common pattern that produces floating point comparisons uniform
over a loop is an explicit check for division by zero. If the divisor
is hoisted out of the loop, the comparison can also be, but hoisting
the function that unwinds is never legal, since it may cause side
effects in the loop body prior to the unwinding to not be executed.

Differential Revision: http://reviews.llvm.org/D18744

llvm-svn: 265264
llvm/lib/CodeGen/CodeGenPrepare.cpp
llvm/test/Transforms/CodeGenPrepare/X86/fcmp-sinking.ll [new file with mode: 0644]