OSDN Git Service

[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)
commit6a4952db2d6cfc4e596b48a227ab39f1d71bb7c8
tree07623e6cf4ffd9a7c089f55097fc02d55ea07054
parent118386614b16bb9568b2a74ba4318f88ce39f5b9
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265264 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CodeGenPrepare.cpp
test/Transforms/CodeGenPrepare/X86/fcmp-sinking.ll [new file with mode: 0644]