HomePhabricator

[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic…

Description

[InstCombine] transform masking off of an FP sign bit into a fabs() intrinsic call (PR24886)

This is a partial fix for PR24886:
https://llvm.org/bugs/show_bug.cgi?id=24886

Without this IR transform, the backend (x86 at least) was producing inefficient code.

This patch is making 2 assumptions:

  1. The canonical form of a fabs() operation is, in fact, the LLVM fabs() intrinsic.
  2. The high bit of an FP value is always the sign bit; as noted in the bug report, this isn't specified by the LangRef.

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