llvm-6502/lib/Support
Hal Finkel f0f98417ca 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219708 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-14 19:23:07 +00:00
..
Unix Unix/Signals.inc: Let findModulesAndOffsets() built conditionally regarding to (defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACES)). [-Wunused-function] 2014-10-13 04:32:43 +00:00
Windows Support: Don't call close again if we get EINTR 2014-10-07 05:48:40 +00:00
Allocator.cpp [Allocator] Hoist the external helper function into a namespace scope 2014-04-14 06:42:56 +00:00
APFloat.cpp Revert "r216914 - Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'" 2014-10-14 19:23:07 +00:00
APInt.cpp InstCombine: Don't miscompile (x lshr C1) udiv C2 2014-10-13 21:48:30 +00:00
APSInt.cpp
ARMBuildAttrs.cpp ARM: update build attributes for ABI r2.09 2014-01-19 08:25:35 +00:00
ARMWinEH.cpp Support: add Windows ARM EH data structures 2014-06-02 01:17:49 +00:00
Atomic.cpp Fix .cpp files claiming to be header files 2014-06-20 01:36:00 +00:00
BlockFrequency.cpp blockfreq: Defer to BranchProbability::scale() (again) 2014-04-29 16:31:29 +00:00
BranchProbability.cpp BranchProb: Simplify printing code 2014-04-29 17:07:42 +00:00
circular_raw_ostream.cpp
CMakeLists.txt Fix llvm::huge_valf multiple initializations with Visual C++. 2014-09-27 14:41:29 +00:00
CommandLine.cpp Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind 2014-08-22 19:29:17 +00:00
Compression.cpp Simplify compression API by compressing into a SmallVector rather than a MemoryBuffer 2014-04-05 21:53:04 +00:00
ConvertUTF.c Support/ConvertUTF: restore compatibility with MSVC, which only implements C89 2014-06-16 11:22:33 +00:00
ConvertUTFWrapper.cpp [Support] Add a Unicode conversion wrapper from UTF16 to UTF8 2013-07-16 17:14:33 +00:00
COPYRIGHT.regex
CrashRecoveryContext.cpp For CrashRecoveryContext::RunSafelyOnThread, propagate Darwin's PRIO_DARWIN_BG to the new thread if it is 2014-06-25 23:54:50 +00:00
DAGDeltaAlgorithm.cpp [Modules] Make Support/Debug.h modular. This requires it to not change 2014-04-21 22:55:11 +00:00
DataExtractor.cpp Using llvm::sys::swapByteOrder() for the common case of byte-swapping a value in place 2014-06-14 13:18:07 +00:00
DataStream.cpp Remove 'using std::errro_code' from lib. 2014-06-13 02:24:39 +00:00
Debug.cpp Removing static initializer from Debug.cpp by converting to a ManagedStatic. 2014-09-03 17:50:14 +00:00
DeltaAlgorithm.cpp
Dwarf.cpp Add ApplePropertyString dump helper to Dwarf.{h|cpp}. 2014-10-09 20:43:04 +00:00
DynamicLibrary.cpp Revert "Limit the symbol search in DynamicLibrary to the module that was opened." 2014-08-27 17:51:43 +00:00
Errno.cpp Fix some rather confusing indentation and control flow in the errno 2013-09-02 05:55:10 +00:00
ErrorHandling.cpp Converting the ErrorHandlerMutex to a ManagedStatic to avoid the static constructor and destructor. 2014-10-03 22:03:12 +00:00
FileOutputBuffer.cpp unique_ptrify FileOutputBuffer::FileOutputBuffer 2014-09-02 17:49:23 +00:00
FileUtilities.cpp Remove some calls to std::move. 2014-08-01 14:31:55 +00:00
FoldingSet.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 06:32:26 +00:00
FormattedStream.cpp [C++11] Make use of 'nullptr' in the Support library. 2014-04-07 04:17:22 +00:00
GraphWriter.cpp Don't use 'using std::error_code' in include/llvm. 2014-06-12 21:46:39 +00:00
Hashing.cpp
Host.cpp Add support for ppc64/power8 as a host 2014-06-26 13:37:03 +00:00
IntEqClasses.cpp
IntervalMap.cpp [C++11] Make use of 'nullptr' in the Support library. 2014-04-07 04:17:22 +00:00
IntrusiveRefCntPtr.cpp
IsInf.cpp
IsNAN.cpp
LEB128.cpp Don't inline get[S|U]LEB128Size() until they are proved to be hot. 2014-02-22 15:39:39 +00:00
LineIterator.cpp LineIterator: Provide a variant that keeps blank lines 2014-09-17 15:43:01 +00:00
LLVMBuild.txt
Locale.cpp Move generic isPrint and columnWidth implementations to a separate header/source to allow using both generic and system-dependent versions on win32. 2013-09-04 16:00:12 +00:00
LockFileManager.cpp Misc cleanups to the FileSytem api. 2014-09-11 20:30:02 +00:00
Makefile Support: Inject LLVM_VERSION_INFO into the Support library 2014-06-17 06:52:47 +00:00
ManagedStatic.cpp Revert r219638, (r219640 and r219676), "Removing the static destructor from ManagedStatic.cpp by controlling the allocation and de-allocation of the mutex." 2014-10-14 15:58:16 +00:00
MathExtras.cpp Fix llvm::huge_valf multiple initializations with Visual C++. 2014-09-27 14:41:29 +00:00
MD5.cpp Make the MD5 result name consistent between functions, header and source. 2014-10-06 13:48:07 +00:00
Memory.cpp
MemoryBuffer.cpp [Support] Add MemoryBuffer::getFileSlice() 2014-10-08 00:22:18 +00:00
MemoryObject.cpp
Mutex.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 06:32:26 +00:00
Path.cpp Fix identify_magic() with mach-o stub dylibs. 2014-09-17 00:53:44 +00:00
PluginLoader.cpp
PrettyStackTrace.cpp [C++11] Replace some comparisons with 'nullptr' with simple boolean checks to reduce verbosity. 2014-04-09 04:20:00 +00:00
Process.cpp Refactor the code in clang to find a file in a PATH like environment variable into a helper function 2014-06-30 19:54:20 +00:00
Program.cpp Fix .cpp files claiming to be header files 2014-06-20 01:36:00 +00:00
RandomNumberGenerator.cpp Random Number Generator (llvm) 2014-06-25 15:21:42 +00:00
raw_os_ostream.cpp
raw_ostream.cpp Support: Don't call close again if we get EINTR 2014-10-07 05:48:40 +00:00
README.txt.system
regcclass.h adding re-include guards into lib/Support/reg*.h 2014-06-12 16:07:56 +00:00
regcname.h adding re-include guards into lib/Support/reg*.h 2014-06-12 16:07:56 +00:00
regcomp.c Fix known typos 2014-01-24 17:20:08 +00:00
regengine.inc Clean up language and grammar. 2014-05-20 17:11:11 +00:00
regerror.c
regex2.h adding re-include guards into lib/Support/reg*.h 2014-06-12 16:07:56 +00:00
regex_impl.h
Regex.cpp [C++11] Make use of 'nullptr' in the Support library. 2014-04-07 04:17:22 +00:00
regexec.c
regfree.c
regstrlcpy.c
regutils.h adding re-include guards into lib/Support/reg*.h 2014-06-12 16:07:56 +00:00
RWMutex.cpp [C++11] More 'nullptr' conversion. In some cases just using a boolean check instead of comparing to nullptr. 2014-04-15 06:32:26 +00:00
ScaledNumber.cpp Fix undefined behavior (left shift by 64 bits) in ScaledNumber::toString(). 2014-08-20 18:30:07 +00:00
SearchForAddressOfSpecialSymbol.cpp [C++11] Make use of 'nullptr' in the Support library. 2014-04-07 04:17:22 +00:00
Signals.cpp
SmallPtrSet.cpp Fix an off by 1 bug that prevented SmallPtrSet from using all of its 'small' capacity. Then fix the early return in the move constructor that prevented 'small' moves from clearing the NumElements in the moved from object. The directed test missed this because it was always testing large moves due to the off by 1 bug. 2014-08-20 04:41:36 +00:00
SmallVector.cpp
SourceMgr.cpp Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr 2014-08-21 20:44:56 +00:00
SpecialCaseList.cpp unique_ptrify the result of SpecialCaseList::create 2014-09-02 18:13:54 +00:00
Statistic.cpp Revert "[C++11] Replace LLVM atomics with std::atomic." 2014-03-03 18:02:34 +00:00
StreamableMemoryObject.cpp [C++11] Remove 'virtual' keyword from methods marked with 'override' keyword. 2014-03-10 03:53:12 +00:00
StringExtras.cpp
StringMap.cpp Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with private, but non-deleted, move members. 2014-06-23 18:28:53 +00:00
StringPool.cpp Convert StringMapEntry::Create to use StringRef instead of start/end pointers. Simpliies all in tree call sites. No functional change. 2014-06-11 05:35:56 +00:00
StringRef.cpp Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created. 2014-08-27 05:25:25 +00:00
StringRefMemoryObject.cpp
SystemUtils.cpp
TargetRegistry.cpp Remove obsolete function TargetRegistry::getClosestTargetForJIT() 2014-07-01 10:47:13 +00:00
Threading.cpp Re-apply r211287: Remove support for LLVM runtime multi-threading. 2014-06-27 15:13:01 +00:00
ThreadLocal.cpp [C++11] Make use of 'nullptr' in the Support library. 2014-04-07 04:17:22 +00:00
Timer.cpp Modernize raw_fd_ostream's constructor a bit. 2014-08-25 18:16:47 +00:00
TimeValue.cpp Cleaning up static initializers in TimeValue. 2014-08-29 01:05:12 +00:00
ToolOutputFile.cpp Modernize raw_fd_ostream's constructor a bit. 2014-08-25 18:16:47 +00:00
Triple.cpp Add hsail and amdil64 to Triple 2014-09-19 19:52:11 +00:00
Twine.cpp Remove unnecessary llvm:: qualification. 2014-02-26 23:27:16 +00:00
Unicode.cpp Move generic isPrint and columnWidth implementations to a separate header/source to allow using both generic and system-dependent versions on win32. 2013-09-04 16:00:12 +00:00
Valgrind.cpp Don't mark the declarations of the TSan annotation functions as weak. 2014-03-30 11:20:25 +00:00
Watchdog.cpp
YAMLParser.cpp Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already. 2014-08-30 16:48:02 +00:00
YAMLTraits.cpp Fix memory leak in error paths in YAMLTraits by using unique_ptr 2014-09-15 18:39:24 +00:00

Design Of lib/System
====================

The software in this directory is designed to completely shield LLVM from any
and all operating system specific functionality. It is not intended to be a
complete operating system wrapper (such as ACE), but only to provide the
functionality necessary to support LLVM.

The software located here, of necessity, has very specific and stringent design
rules. Violation of these rules means that cracks in the shield could form and
the primary goal of the library is defeated. By consistently using this library,
LLVM becomes more easily ported to new platforms since the only thing requiring
porting is this library.

Complete documentation for the library can be found in the file:
  llvm/docs/SystemLibrary.html
or at this URL:
  http://llvm.org/docs/SystemLibrary.html

While we recommend that you read the more detailed documentation, for the
impatient, here's a high level summary of the library's requirements.

 1. No system header files are to be exposed through the interface.
 2. Std C++ and Std C header files are okay to be exposed through the interface.
 3. No exposed system-specific functions.
 4. No exposed system-specific data.
 5. Data in lib/System classes must use only simple C++ intrinsic types.
 6. Errors are handled by returning "true" and setting an optional std::string
 7. Library must not throw any exceptions, period.
 8. Interface functions must not have throw() specifications.
 9. No duplicate function impementations are permitted within an operating
    system class.

To accomplish these requirements, the library has numerous design criteria that
must be satisfied. Here's a high level summary of the library's design criteria:

 1. No unused functionality (only what LLVM needs)
 2. High-Level Interfaces
 3. Use Opaque Classes
 4. Common Implementations
 5. Multiple Implementations
 6. Minimize Memory Allocation
 7. No Virtual Methods