OSDN Git Service

[InstCombine] canonicalize fcmp+select to fabs
authorSanjay Patel <spatel@rotateright.com>
Mon, 19 Mar 2018 15:14:30 +0000 (15:14 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 19 Mar 2018 15:14:30 +0000 (15:14 +0000)
commitbf1689531ad184f59f662e5ec99557b984f1945c
treec077a79ffba3a60c8806b70b2e27a2f1e69ac3b9
parent6502ebe7a52b08d643495fad021b4336ba5422dc
[InstCombine] canonicalize fcmp+select to fabs

This is complicated by -0.0 and nan. This is based on the DAG patterns
as shown in D44091. I'm hoping that we can just remove those DAG folds
and always rely on IR canonicalization to handle the matching to fabs.

We would still need to delete the broken code from DAGCombiner to fix
PR36600:
https://bugs.llvm.org/show_bug.cgi?id=36600

Differential Revision: https://reviews.llvm.org/D44550

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327858 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/fabs.ll