llvm-project/llvm
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
..
autoconf [OPENMP] Make -fopenmp to turn on OpenMP support by default. 2015-12-10 05:45:58 +00:00
bindings Fix `llvm-config` to adapt to the install environment. 2015-11-09 23:15:38 +00:00
cmake [CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with -fprofile-instr-generate 2015-12-10 21:19:07 +00:00
docs Try to appease sphinx 2015-12-12 06:56:02 +00:00
examples [Orc] Fix Kaleidoscope example for change in r254693. 2015-12-04 02:32:32 +00:00
include [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
lib Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0. 2015-12-12 21:33:31 +00:00
projects [CMake] Disable adding the test suite as a projects subdirectory 2015-10-28 18:36:56 +00:00
resources
test Partially fix memcpy / memset / memmove lowering in SelectionDAG construction if address space != 0. 2015-12-12 21:33:31 +00:00
tools [IR] Reformulate LLVM's EH funclet IR 2015-12-12 05:38:55 +00:00
unittests [ProfileData] Add unit test infrastructure for sample profile reader/writer 2015-12-10 17:21:42 +00:00
utils [TableGen] Correct Namespace lookup with AltNames in AsmWriterEmitter 2015-12-11 17:31:27 +00:00
.arcconfig
.clang-format
.clang-tidy adding readability-identifier-naming to llvm clang-tidy configuration. 2015-12-08 17:44:51 +00:00
.gitignore
CMakeLists.txt [CMake] Add option LLVM_EXTERNALIZE_DEBUGINFO 2015-12-03 18:45:39 +00:00
CODE_OWNERS.TXT Friendly takeover of the Hexagon backend 2015-12-03 17:07:12 +00:00
CREDITS.TXT
LICENSE.TXT
LLVMBuild.txt
Makefile
Makefile.common
Makefile.config.in
Makefile.rules Create Makefile variables for 'share' and 'libexec' 2015-11-09 16:10:00 +00:00
README.txt Revert previous test commit. 2015-12-11 07:40:25 +00:00
configure [OPENMP] Make -fopenmp to turn on OpenMP support by default. 2015-12-10 05:45:58 +00:00
llvm.spec.in

README.txt

Low Level Virtual Machine (LLVM)
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.