llvm-project/llvm/lib/CodeGen/SelectionDAG
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
..
CMakeLists.txt [Statepoints 3/4] Statepoint infrastructure for garbage collection: SelectionDAGBuilder 2014-12-02 18:50:36 +00:00
DAGCombiner.cpp Fix (bitcast (fabs x)), (bitcast (fneg x)) and (bitcast (fcopysign cst, 2015-12-10 22:09:06 +00:00
FastISel.cpp Let SelectionDAG start to use probability-based interface to add successors. 2015-11-24 08:51:23 +00:00
FunctionLoweringInfo.cpp [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
InstrEmitter.cpp [X86] Part 1 to fix x86-64 fp128 calling convention. 2015-12-03 22:02:40 +00:00
InstrEmitter.h [SDAG] Give InstrEmitter hidden visibility 2015-07-01 14:55:10 +00:00
LLVMBuild.txt
LegalizeDAG.cpp Fix cycle in selection DAG introduced by extractelement legalization 2015-12-09 14:34:10 +00:00
LegalizeFloatTypes.cpp [X86] Part 1 to fix x86-64 fp128 calling convention. 2015-12-03 22:02:40 +00:00
LegalizeIntegerTypes.cpp Revert r248483, r242546, r242545, and r242409 - absdiff intrinsics 2015-12-11 23:11:52 +00:00
LegalizeTypes.cpp [X86] Part 1 to fix x86-64 fp128 calling convention. 2015-12-03 22:02:40 +00:00
LegalizeTypes.h [X86] Part 1 to fix x86-64 fp128 calling convention. 2015-12-03 22:02:40 +00:00
LegalizeTypesGeneric.cpp [X86] Part 1 to fix x86-64 fp128 calling convention. 2015-12-03 22:02:40 +00:00
LegalizeVectorOps.cpp Revert r248483, r242546, r242545, and r242409 - absdiff intrinsics 2015-12-11 23:11:52 +00:00
LegalizeVectorTypes.cpp SelectionDAG: Match min/max if the scalar operation is legal 2015-12-11 23:16:47 +00:00
Makefile
ResourcePriorityQueue.cpp Fix some comment typos. 2015-08-08 18:27:36 +00:00
SDNodeDbgValue.h Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC) 2015-06-23 09:49:53 +00:00
ScheduleDAGFast.cpp 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
ScheduleDAGRRList.cpp 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
ScheduleDAGSDNodes.cpp Add allnodes() iterator range to SelectionDAG. NFC. 2015-07-14 22:10:54 +00:00
ScheduleDAGSDNodes.h [SelectionDAG] Remove dead code. NFC. 2015-10-15 17:54:06 +00:00
ScheduleDAGVLIW.cpp Use 'override/final' instead of 'virtual' for overridden methods 2015-04-11 02:11:45 +00:00
SelectionDAG.cpp Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0. 2015-12-12 21:33:31 +00:00
SelectionDAGBuilder.cpp Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0. 2015-12-12 21:33:31 +00:00
SelectionDAGBuilder.h [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
SelectionDAGDumper.cpp Revert r248483, r242546, r242545, and r242409 - absdiff intrinsics 2015-12-11 23:11:52 +00:00
SelectionDAGISel.cpp CXX_FAST_TLS calling convention: target independent portion. 2015-12-11 18:24:30 +00:00
SelectionDAGPrinter.cpp Make the SelectionDAG graph printer use SDNode::PersistentId labels. 2015-10-27 23:09:03 +00:00
StatepointLowering.cpp Lower statepoints with multi-def targets. 2015-11-17 16:04:21 +00:00
StatepointLowering.h [StatepointLowering] Support of the gc.relocates for invoke statepoints. 2015-05-20 11:37:25 +00:00
TargetLowering.cpp [X86] Part 1 to fix x86-64 fp128 calling convention. 2015-12-03 22:02:40 +00:00
TargetSelectionDAGInfo.cpp Remove getDataLayout() from TargetSelectionDAGInfo (had no users) 2015-07-09 02:10:08 +00:00