1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 11:33:24 +02:00
llvm-mirror/lib
Hal Finkel 717a51f66b Revert "r216914 - Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'"
Reapply r216913, a fix for PR20832 by Andrea Di Biagio. The commit was reverted
because of buildbot failures, and credit goes to Ulrich Weigand for isolating
the underlying issue (which can be confirmed by Valgrind, which does helpfully
light up like the fourth of July). Uli explained the problem with the original
patch as:

  It seems the problem is calling multiplySignificand with an addend of category
  fcZero; that is not expected by this routine.  Note that for fcZero, the
  significand parts are simply uninitialized, but the code in (or rather, called
  from) multiplySignificand will unconditionally access them -- in effect using
  uninitialized contents.

This version avoids using a category == fcZero addend within
multiplySignificand, which avoids this problem (the Valgrind output is also now
clean).

Original commit message:

[APFloat] Fixed a bug in method 'fusedMultiplyAdd'.

When folding a fused multiply-add builtin call, make sure that we propagate the
correct result in the case where the addend is zero, and the two other operands
are finite non-zero.

Example:
  define double @test() {
    %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
    ret double %1
  }

Before this patch, the instruction simplifier wrongly folded the builtin call
in function @test to constant 'double 7.0'.
With this patch, method 'fusedMultiplyAdd' correctly evaluates the multiply and
propagates the expected result (i.e. 56.0).

Added test fold-builtin-fma.ll with the reproducible from PR20832 plus extra
test cases to verify the behavior of method 'fusedMultiplyAdd' in the presence
of NaN/Inf operands.

This fixes PR20832.

llvm-svn: 219708
2014-10-14 19:23:07 +00:00
..
Analysis [LVI] Check for @llvm.assume dominating the edge branch 2014-10-14 16:04:49 +00:00
AsmParser Make CallingConv::ID an alias of "unsigned". 2014-09-10 18:00:17 +00:00
Bitcode Introduce LLVMWriteBitcodeToMemoryBuffer C API function. 2014-10-14 00:30:59 +00:00
CodeGen Remove unused member variable. 2014-10-14 18:53:16 +00:00
DebugInfo Add couple of missing 'override' keyword. NFC. 2014-10-10 17:34:30 +00:00
ExecutionEngine [MCJIT] Replace memcpy with readBytesUnaligned in RuntimeDyldMachOI386. 2014-10-10 23:07:09 +00:00
IR DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself. 2014-10-14 18:22:52 +00:00
IRReader Pass a && to getLazyBitcodeModule. 2014-09-03 17:31:46 +00:00
LineEditor
Linker Merge alignment of common GlobalValue. 2014-09-09 17:48:18 +00:00
LTO LTO: Document the Boolean argument from r218784 2014-10-02 21:11:04 +00:00
MC Remove method that is identical to the base class one. 2014-10-14 17:38:38 +00:00
Object Object, COFF: Move the VirtualSize/SizeOfRawData logic to getSectionSize 2014-10-09 08:42:31 +00:00
Option Add an overload of getLastArgNoClaim taking two OptSpecifiers. 2014-09-12 19:42:53 +00:00
ProfileData Reduce double set lookups. NFC. 2014-10-10 15:32:50 +00:00
Support Revert "r216914 - Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'" 2014-10-14 19:23:07 +00:00
TableGen Eliminate some deep std::vector copies. NFC. 2014-10-03 18:33:16 +00:00
Target Revert "R600: Add new intrinsic to read work dimensions" 2014-10-14 18:58:04 +00:00
Transforms Switch to select optimization for two-case switches 2014-10-14 01:58:26 +00:00
CMakeLists.txt
LLVMBuild.txt
Makefile