1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/unittests
Jonas Devlieghere ab486fe71a [MC] Fix undefined behavior in MCInstPrinter::formatHex
Passing INT64_MIN to MCInstPrinter::formatHex triggers undefined
behavior because the negation of -9223372036854775808 cannot be
represented in type 'int64_t' (aka 'long long'). This patch puts a
workaround in place to just print the hex value directly.

A possible alternative involves using a small helper functions that uses
(implementation) defined conversions to achieve the desirable value:

  static int64_t helper(int64_t V) {
    auto U = static_cast<uint64_t>(V);
    return V < 0 ? -U : U;
  }

The underlying problem is that MCInstPrinter::formatHex(int64_t) returns
a format_object<int64_t> and should really return a
format_object<uint64_t>. However, that's not possible because formatImm
needs to be able to print both as decimal (where a signed is required)
and hex (where we'd prefer to always have an unsigned).

  format_object<int64_t> formatImm(int64_t Value) const {
    return PrintImmHex ? formatHex(Value) : formatDec(Value);
  }

Differential revision: https://reviews.llvm.org/D67236

llvm-svn: 371159
2019-09-06 01:13:32 +00:00
..
ADT [ADT] Removed VariadicFunction 2019-08-30 08:21:55 +00:00
Analysis [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
AsmParser
BinaryFormat [BinaryFormat] Teach identify_magic about Tapi files. 2019-08-21 21:00:16 +00:00
Bitcode [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
Bitstream [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
CodeGen [globalisel][knownbits] Account for missing type constraints 2019-09-05 20:26:02 +00:00
DebugInfo Add encode and decode methods to InlineInfo and document encoding format to the GSYM file format. 2019-09-04 17:32:51 +00:00
Demangle
ExecutionEngine Skip MCJIT unit tests if LLVM is not configured for native compilation 2019-09-03 19:30:45 +00:00
FuzzMutate [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
IR [IntrinsicEmitter] Support scalable vectors in intrinsics 2019-08-27 12:57:09 +00:00
LineEditor
Linker [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
MC [MC] Fix undefined behavior in MCInstPrinter::formatHex 2019-09-06 01:13:32 +00:00
MI
Object Minidump: Add support for the MemoryList stream 2019-05-16 15:17:30 +00:00
ObjectYAML MinidumpYAML: move serialization code to MinidumpEmitter.cpp 2019-08-21 11:30:48 +00:00
Option Option spell checking: Penalize delimiter flags if input has no argument 2019-05-01 16:45:15 +00:00
Passes
ProfileData [SampleFDO] Add profile symbol list section to discriminate function being 2019-08-31 02:27:26 +00:00
Remarks [Remarks] Add comparison operators to the Remark object 2019-09-05 22:35:37 +00:00
Support [Support] Add writeFileAtomically() to FileUtilities 2019-09-05 18:10:29 +00:00
Target [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
TextAPI [TextAPI] Update reader to be supported by lib/Object 2019-08-16 15:30:48 +00:00
tools Revert CMake: Make most target symbols hidden by default 2019-06-11 03:21:13 +00:00
Transforms Fix for "DICompileUnit not listed in llvm.dbg.cu" verification error after ... 2019-08-28 21:27:50 +00:00
XRay [llvm] Migrate llvm::make_unique to std::make_unique 2019-08-15 15:54:37 +00:00
CMakeLists.txt [Bitcode] Move Bitstream to a separate library 2019-07-03 22:40:07 +00:00
unittest.cfg.in