llvm-project/llvm/lib
Manuel Jacob 1578ec8860 Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0.
Summary:
Previously SelectionDAGBuilder asserted that the pointer operands of
memcpy / memset / memmove intrinsics are in address space < 256.  This assert
implicitly assumed the X86 backend, where all address spaces < 256 are
equivalent to address space 0 from the code generator's point of view.  On some
targets (R600 and NVPTX) several address spaces < 256 have a target-defined
meaning, so this assert made little sense for these targets.

This patch removes this wrong assertion and adds extra checks before lowering
these intrinsics to library calls.  If a pointer operand can't be casted to
address space 0 without changing semantics, a fatal error is reported to the
user.

The new behavior should be valid for all targets that give address spaces != 0
a target-specified meaning (NVPTX, R600, X86).  NVPTX lowers big or
variable-sized memory intrinsics before SelectionDAG construction.  All other
memory intrinsics are inlined (the threshold is set very high for this target).
R600 doesn't support memcpy / memset / memmove library calls (previously the
illegal emission of a call to such library function triggered an error
somewhere in the code generator).  X86 now emits inline loads and stores for
address spaces 256 and 257 up to the same threshold that is used for address
space 0 and reports a fatal error otherwise.

I call this a "partial fix" because there are still cases that can't be
lowered.  A fatal error is reported in these cases.

Reviewers: arsenm, theraven, compnerd, hfinkel

Subscribers: hfinkel, llvm-commits, alex

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

llvm-svn: 255441
2015-12-12 21:33:31 +00:00
..
Analysis Try to appease a buildbot 2015-12-12 05:53:20 +00:00
AsmParser [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
Bitcode [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
CodeGen Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0. 2015-12-12 21:33:31 +00:00
DebugInfo [llvm-dwp] Retrieve the DWOID from the CU for the cu_index entry 2015-12-04 17:20:04 +00:00
ExecutionEngine [Orc] Rename IndirectStubsManagerBase to IndirectStubsManager. 2015-12-06 19:44:45 +00:00
Fuzzer [LibFuzzer] Introducing FUZZER_FLAG_UNSIGNED and using it for seeding. 2015-12-10 20:41:53 +00:00
IR [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
IRReader Return a unique_ptr from getLazyBitcodeModule and parseBitcodeFile. NFC. 2015-06-16 22:27:55 +00:00
LTO MSVC complains about this being ambiguous. 2015-12-04 22:26:21 +00:00
LibDriver [Option] Use an ArrayRef to store the Option Infos in OptTable. NFC 2015-10-21 16:30:42 +00:00
LineEditor
Linker Fix another case where the linkage was not set. 2015-12-10 18:44:26 +00:00
MC Replace uint16_t with the MCPhysReg typedef in many places. A lot of physical register arrays already use this typedef. 2015-12-05 07:13:35 +00:00
Object Use make_range to reduce mentions of iterator type. NFC 2015-12-06 05:08:07 +00:00
Option [Option] Use an ArrayRef to store the Option Infos in OptTable. NFC 2015-10-21 16:30:42 +00:00
Passes [PM] Port StripDeadPrototypes to the new pass manager 2015-10-30 23:28:12 +00:00
ProfileData [PGO] Stop using invalid char in instr variable names. 2015-12-12 17:28:03 +00:00
Support Avoid buffered reads of /dev/urandom 2015-12-11 22:52:32 +00:00
TableGen [TblGen] ArrayRefize TGParser. No functional change intended. 2015-10-24 12:46:45 +00:00
Target [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
Transforms [PGO] Stop using invalid char in instr variable names. 2015-12-12 17:28:03 +00:00
CMakeLists.txt LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
LLVMBuild.txt Wrap some long lines in LLVMBuild files. NFC 2015-06-12 18:44:57 +00:00
Makefile LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00