[CodeGen] Don't blindly combine (fp_round (fp_round x)) to (fp_round x).
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 12 Feb 2015 06:15:29 +0000 (06:15 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 12 Feb 2015 06:15:29 +0000 (06:15 +0000)
commit9e9bde9b546136d739d2ed1173a4d25332bc660f
treefc1d47b14b883c606fe077c9b12fd57a141f2d18
parentc571d114ba81d8b560a79605bd8217ee3dd5009e
[CodeGen] Don't blindly combine (fp_round (fp_round x)) to (fp_round x).

We used to do this DAG combine, but it's not always correct:
If the first fp_round isn't a value preserving truncation, it might
introduce a tie in the second fp_round, that wouldn't occur in the
single-step fp_round we want to fold to.
In other words, double rounding isn't the same as rounding.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228911 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/AArch64/f16-convert.ll
test/CodeGen/X86/fp-double-rounding.ll [new file with mode: 0644]