golang-1.8-race-detector-runtime_0.0+svn285455/ 0000775 0001750 0001750 00000000000 13040224627 021201 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/README.txt 0000664 0001750 0001750 00000000460 12341466271 022705 0 ustar mwhudson mwhudson Compiler-RT
================================
This directory and its subdirectories contain source code for the compiler
support routines.
Compiler-RT is open source software. You may freely distribute it under the
terms of the license agreement found in LICENSE.txt.
================================
golang-1.8-race-detector-runtime_0.0+svn285455/LICENSE.TXT 0000664 0001750 0001750 00000010301 12677052572 022674 0 ustar mwhudson mwhudson ==============================================================================
compiler_rt License
==============================================================================
The compiler_rt library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2009-2016 by the contributors listed in CREDITS.TXT
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
==============================================================================
Copyrights and Licenses for Third Party Software Distributed with LLVM:
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
golang-1.8-race-detector-runtime_0.0+svn285455/.arcconfig 0000664 0001750 0001750 00000000122 12741710171 023131 0 ustar mwhudson mwhudson {
"project_id" : "compiler-rt",
"conduit_uri" : "https://reviews.llvm.org/"
}
golang-1.8-race-detector-runtime_0.0+svn285455/unittests/ 0000775 0001750 0001750 00000000000 13040224625 023241 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/unittests/lit.common.unit.cfg 0000664 0001750 0001750 00000001757 12277373467 027015 0 ustar mwhudson mwhudson # -*- Python -*-
# Configuration file for 'lit' test runner.
# This file contains common config setup rules for unit tests in various
# compiler-rt testsuites.
import os
import lit.formats
# Setup test format
llvm_build_mode = getattr(config, "llvm_build_mode", "Debug")
config.test_format = lit.formats.GoogleTest(llvm_build_mode, "Test")
# Setup test suffixes.
config.suffixes = []
# Tweak PATH to include llvm tools dir.
llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
if (not llvm_tools_dir) or (not os.path.exists(llvm_tools_dir)):
lit_config.fatal("Invalid llvm_tools_dir config attribute: %r" % llvm_tools_dir)
path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
# Propagate the temp directory. Windows requires this because it uses \Windows\
# if none of these are present.
if 'TMP' in os.environ:
config.environment['TMP'] = os.environ['TMP']
if 'TEMP' in os.environ:
config.environment['TEMP'] = os.environ['TEMP']
golang-1.8-race-detector-runtime_0.0+svn285455/unittests/CMakeLists.txt 0000664 0001750 0001750 00000000271 12661121036 026001 0 ustar mwhudson mwhudson # Needed for lit support
include(AddLLVM)
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.common.unit.configured.in
${CMAKE_CURRENT_BINARY_DIR}/lit.common.unit.configured)
golang-1.8-race-detector-runtime_0.0+svn285455/unittests/lit.common.unit.configured.in 0000664 0001750 0001750 00000001753 12704361721 030765 0 ustar mwhudson mwhudson @LIT_SITE_CFG_IN_HEADER@
# Generic config options for all compiler-rt unit tests.
config.target_triple = "@TARGET_TRIPLE@"
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_BINARY_DIR@"
config.compiler_rt_src_root = "@COMPILER_RT_SOURCE_DIR@"
config.compiler_rt_libdir = "@COMPILER_RT_LIBRARY_OUTPUT_DIR@"
config.llvm_build_mode = "@LLVM_BUILD_MODE@"
config.host_arch = "@HOST_ARCH@"
config.host_os = "@HOST_OS@"
# LLVM tools dir and build mode can be passed in lit parameters,
# so try to apply substitution.
try:
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
config.llvm_build_mode = config.llvm_build_mode % lit_config.params
except KeyError as e:
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
# Setup attributes common for all compiler-rt unit tests.
lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/unittests/lit.common.unit.cfg")
golang-1.8-race-detector-runtime_0.0+svn285455/www/ 0000775 0001750 0001750 00000000000 13040224625 022023 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/www/menu.css 0000664 0001750 0001750 00000001121 11222514053 023471 0 ustar mwhudson mwhudson /***************/
/* page layout */
/***************/
[id=menu] {
position:fixed;
width:25ex;
}
[id=content] {
/* ***** EDIT THIS VALUE IF CONTENT OVERLAPS MENU ***** */
position:absolute;
left:29ex;
padding-right:4ex;
}
/**************/
/* menu style */
/**************/
#menu .submenu {
padding-top:1em;
display:block;
}
#menu label {
display:block;
font-weight: bold;
text-align: center;
background-color: rgb(192,192,192);
}
#menu a {
padding:0 .2em;
display:block;
text-align: center;
background-color: rgb(235,235,235);
}
#menu a:visited {
color:rgb(100,50,100);
} golang-1.8-race-detector-runtime_0.0+svn285455/www/index.html 0000664 0001750 0001750 00000015145 12560304710 024026 0 ustar mwhudson mwhudson
"compiler-rt" Runtime Library
"compiler-rt" runtime libraries
The compiler-rt project consists of:
builtins - a simple library that provides an implementation
of the low-level target-specific hooks required by code generation and
other runtime components. For example, when compiling for a 32-bit target,
converting a double to a 64-bit unsigned integer is compiling into a runtime
call to the "__fixunsdfdi" function. The builtins library provides
optimized implementations of this and other low-level routines, either in
target-independent C form, or as a heavily-optimized assembly.
builtins provides full support for the libgcc interfaces on supported
targets and high performance hand tuned implementations of commonly used
functions like __floatundidf in assembly that are dramatically faster than
the libgcc implementations. It should be very easy to bring builtins to
support a new target by adding the new routines needed by that target.
sanitizer runtimes - runtime libraries that are required to run
the code with sanitizer instrumentation. This includes runtimes for:
profile - library which is used to collect coverage information.
BlocksRuntime - a target-independent implementation of Apple "Blocks"
runtime interfaces.
All of the code in the compiler-rt project is dual licensed
under the MIT license and the UIUC License (a BSD-like license).
Clients
Currently compiler-rt is primarily used by
the Clang
and LLVM projects as the implementation for
the runtime compiler support libraries. For more information on using
compiler-rt with Clang, please see the Clang
Getting Started
page.
Platform Support
builtins is known to work on the following platforms:
Machine Architectures: i386, X86-64, SPARC64, ARM, PowerPC, PowerPC 64.
OS: AuroraUX, DragonFlyBSD, FreeBSD, NetBSD, Linux, Darwin.
Most sanitizer runtimes are supported only on Linux x86-64. See tool-specific
pages in Clang docs for more
details.
Source Structure
A short explanation of the directory structure of compiler-rt:
For testing it is possible to build a generic library and an optimized library.
The optimized library is formed by overlaying the optimized versions onto the generic library.
Of course, some architectures have additional functions,
so the optimized library may have functions not found in the generic version.
include/ contains headers that can be included in user programs (for example,
users may directly call certain function from sanitizer runtimes).
lib/ contains libraries implementations.
lib/builtins is a generic portable implementation of builtins routines.
lib/builtins/(arch) has optimized versions of some routines
for the supported architectures.
test/ contains test suites for compiler-rt runtimes.
Get it and get involved!
Generally, you need to build LLVM/Clang in order to build compiler-rt. You can
either follow the Clang's
Getting Started page, or
build LLVM
separately to get llvm-config binary, and then run:
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk compiler-rt
mkdir build
cd build
cmake ../compiler-rt -DLLVM_CONFIG_PATH=/path/to/llvm-config
make
Tests for sanitizer runtimes are ported to
llvm-lit and are
run by make check-all command in LLVM/Clang/compiler-rt build tree.
compiler-rt libraries are installed to the system with make install
command in either LLVM/Clang/compiler-rt or standalone
compiler-rt build tree.
compiler-rt doesn't have its own mailing list, if you have questions please
email the llvm-dev mailing
list. Commits to the compiler-rt SVN module are automatically sent to the
llvm-commits
mailing list.
golang-1.8-race-detector-runtime_0.0+svn285455/www/menu.html.incl 0000664 0001750 0001750 00000001174 12560304710 024604 0 ustar mwhudson mwhudson
golang-1.8-race-detector-runtime_0.0+svn285455/www/content.css 0000664 0001750 0001750 00000001126 11222514053 024204 0 ustar mwhudson mwhudson html, body {
padding:0px;
font-size:small; font-family:"Lucida Grande", "Lucida Sans Unicode", Arial, Verdana, Helvetica, sans-serif; background-color: #fff; color: #222;
line-height:1.5;
}
h1, h2, h3, tt { color: #000 }
h1 { padding-top:0px; margin-top:0px;}
h2 { color:#333333; padding-top:0.5em; }
h3 { padding-top: 0.5em; margin-bottom: -0.25em; color:#2d58b7}
li { padding-bottom: 0.5em; }
ul { padding-left:1.5em; }
/* Slides */
IMG.img_slide {
display: block;
margin-left: auto;
margin-right: auto
}
.itemTitle { color:#2d58b7 }
/* Tables */
tr { vertical-align:top }
golang-1.8-race-detector-runtime_0.0+svn285455/make/ 0000775 0001750 0001750 00000000000 13040224617 022115 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/make/platform/ 0000775 0001750 0001750 00000000000 13040224617 023741 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/make/test/ 0000775 0001750 0001750 00000000000 13040224617 023074 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/cmake/ 0000775 0001750 0001750 00000000000 13040224625 022257 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/cmake/base-config-ix.cmake 0000664 0001750 0001750 00000020607 12775263160 026074 0 ustar mwhudson mwhudson # The CompilerRT build system requires CMake version 2.8.8 or higher in order
# to use its support for building convenience "libraries" as a collection of
# .o files. This is particularly useful in producing larger, more complex
# runtime libraries.
include(CheckIncludeFile)
check_include_file(unwind.h HAVE_UNWIND_H)
# Top level target used to build all compiler-rt libraries.
add_custom_target(compiler-rt ALL)
add_custom_target(install-compiler-rt)
set_target_properties(compiler-rt PROPERTIES FOLDER "Compiler-RT Misc")
# Setting these variables from an LLVM build is sufficient that compiler-rt can
# construct the output paths, so it can behave as if it were in-tree here.
if (LLVM_LIBRARY_OUTPUT_INTDIR AND LLVM_RUNTIME_OUTPUT_INTDIR AND PACKAGE_VERSION)
set(LLVM_TREE_AVAILABLE On)
endif()
if (LLVM_TREE_AVAILABLE)
# Compute the Clang version from the LLVM version.
# FIXME: We should be able to reuse CLANG_VERSION variable calculated
# in Clang cmake files, instead of copying the rules here.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION
${PACKAGE_VERSION})
# Setup the paths where compiler-rt runtimes and headers should be stored.
set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION})
set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION})
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests."
${LLVM_INCLUDE_TESTS})
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered"
${LLVM_ENABLE_WERROR})
# Use just-built Clang to compile/link tests on all platforms, except for
# Windows where we need to use clang-cl instead.
if(NOT MSVC)
set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
set(COMPILER_RT_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++)
else()
set(COMPILER_RT_TEST_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang.exe)
set(COMPILER_RT_TEST_CXX_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang++.exe)
endif()
else()
# Take output dir and install path from the user.
set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
"Path where built compiler-rt libraries should be stored.")
set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
"Path where built compiler-rt executables should be stored.")
set(COMPILER_RT_INSTALL_PATH ${CMAKE_INSTALL_PREFIX} CACHE PATH
"Path where built compiler-rt libraries should be installed.")
option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." OFF)
option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" OFF)
# Use a host compiler to compile/link tests.
set(COMPILER_RT_TEST_COMPILER ${CMAKE_C_COMPILER} CACHE PATH "Compiler to use for testing")
set(COMPILER_RT_TEST_CXX_COMPILER ${CMAKE_CXX_COMPILER} CACHE PATH "C++ Compiler to use for testing")
endif()
if("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang[+]*$")
set(COMPILER_RT_TEST_COMPILER_ID Clang)
elseif("${COMPILER_RT_TEST_COMPILER}" MATCHES "clang.*.exe$")
set(COMPILER_RT_TEST_COMPILER_ID Clang)
else()
set(COMPILER_RT_TEST_COMPILER_ID GNU)
endif()
string(TOLOWER ${CMAKE_SYSTEM_NAME} COMPILER_RT_OS_DIR)
set(COMPILER_RT_LIBRARY_OUTPUT_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
set(COMPILER_RT_LIBRARY_INSTALL_DIR
${COMPILER_RT_INSTALL_PATH}/lib/${COMPILER_RT_OS_DIR})
if(APPLE)
# On Darwin if /usr/include doesn't exist, the user probably has Xcode but not
# the command line tools. If this is the case, we need to find the OS X
# sysroot to pass to clang.
if(NOT EXISTS /usr/include)
execute_process(COMMAND xcodebuild -version -sdk macosx Path
OUTPUT_VARIABLE OSX_SYSROOT
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(OSX_SYSROOT_FLAG "-isysroot${OSX_SYSROOT}")
endif()
option(COMPILER_RT_ENABLE_IOS "Enable building for iOS" On)
option(COMPILER_RT_ENABLE_WATCHOS "Enable building for watchOS - Experimental" Off)
option(COMPILER_RT_ENABLE_TVOS "Enable building for tvOS - Experimental" Off)
endif()
if(WIN32 AND NOT MINGW AND NOT CYGWIN)
set(CMAKE_SHARED_LIBRARY_PREFIX_C "")
set(CMAKE_SHARED_LIBRARY_PREFIX_CXX "")
set(CMAKE_STATIC_LIBRARY_PREFIX_C "")
set(CMAKE_STATIC_LIBRARY_PREFIX_CXX "")
set(CMAKE_STATIC_LIBRARY_SUFFIX_C ".lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX_CXX ".lib")
endif()
macro(test_targets)
# Find and run MSVC (not clang-cl) and get its version. This will tell clang-cl
# what version of MSVC to pretend to be so that the STL works.
set(MSVC_VERSION_FLAG "")
if (MSVC)
# Find and run MSVC (not clang-cl) and get its version. This will tell
# clang-cl what version of MSVC to pretend to be so that the STL works.
execute_process(COMMAND "$ENV{VSINSTALLDIR}/VC/bin/cl.exe"
OUTPUT_QUIET
ERROR_VARIABLE MSVC_COMPAT_VERSION
)
string(REGEX REPLACE "^.*Compiler Version ([0-9.]+) for .*$" "\\1"
MSVC_COMPAT_VERSION "${MSVC_COMPAT_VERSION}")
if (MSVC_COMPAT_VERSION MATCHES "^[0-9].+$")
set(MSVC_VERSION_FLAG "-fms-compatibility-version=${MSVC_COMPAT_VERSION}")
# Add this flag into the host build if this is clang-cl.
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
append("${MSVC_VERSION_FLAG}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
elseif (COMPILER_RT_TEST_COMPILER_ID MATCHES "Clang")
# Add this flag to test compiles to suppress clang's auto-detection
# logic.
append("${MSVC_VERSION_FLAG}" COMPILER_RT_TEST_COMPILER_CFLAGS)
endif()
endif()
endif()
# Generate the COMPILER_RT_SUPPORTED_ARCH list.
if(ANDROID)
# Examine compiler output to determine target architecture.
detect_target_arch()
set(COMPILER_RT_OS_SUFFIX "-android")
elseif(NOT APPLE) # Supported archs for Apple platforms are generated later
if("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "i[2-6]86|x86|amd64")
if(NOT MSVC)
test_target_arch(x86_64 "" "-m64")
# FIXME: We build runtimes for both i686 and i386, as "clang -m32" may
# target different variant than "$CMAKE_C_COMPILER -m32". This part should
# be gone after we resolve PR14109.
test_target_arch(i686 __i686__ "-m32")
test_target_arch(i386 __i386__ "-m32")
else()
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
test_target_arch(i386 "" "")
else()
test_target_arch(x86_64 "" "")
endif()
endif()
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "powerpc")
TEST_BIG_ENDIAN(HOST_IS_BIG_ENDIAN)
if(HOST_IS_BIG_ENDIAN)
test_target_arch(powerpc64 "" "-m64")
else()
test_target_arch(powerpc64le "" "-m64")
endif()
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "s390x")
test_target_arch(s390x "" "")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mipsel|mips64el")
# Gcc doesn't accept -m32/-m64 so we do the next best thing and use
# -mips32r2/-mips64r2. We don't use -mips1/-mips3 because we want to match
# clang's default CPU's. In the 64-bit case, we must also specify the ABI
# since the default ABI differs between gcc and clang.
# FIXME: Ideally, we would build the N32 library too.
test_target_arch(mipsel "" "-mips32r2" "--target=mipsel-linux-gnu")
test_target_arch(mips64el "" "-mips64r2" "--target=mips64el-linux-gnu" "-mabi=64")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "mips")
test_target_arch(mips "" "-mips32r2" "--target=mips-linux-gnu")
test_target_arch(mips64 "" "-mips64r2" "--target=mips64-linux-gnu" "-mabi=64")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "arm")
if(WIN32)
test_target_arch(arm "" "" "")
else()
test_target_arch(arm "" "-march=armv7-a" "-mfloat-abi=soft")
test_target_arch(armhf "" "-march=armv7-a" "-mfloat-abi=hard")
endif()
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch32")
test_target_arch(aarch32 "" "-march=armv8-a")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "aarch64")
test_target_arch(aarch64 "" "-march=armv8-a")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm32")
test_target_arch(wasm32 "" "--target=wasm32-unknown-unknown")
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" MATCHES "wasm64")
test_target_arch(wasm64 "" "--target=wasm64-unknown-unknown")
endif()
set(COMPILER_RT_OS_SUFFIX "")
endif()
endmacro()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/ 0000775 0001750 0001750 00000000000 13040224625 023667 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/AddCompilerRT.cmake 0000664 0001750 0001750 00000040774 13003724413 027335 0 ustar mwhudson mwhudson include(ExternalProject)
include(CompilerRTUtils)
function(set_target_output_directories target output_dir)
# For RUNTIME_OUTPUT_DIRECTORY variable, Multi-configuration generators
# append a per-configuration subdirectory to the specified directory.
# To avoid the appended folder, the configuration specific variable must be
# set 'RUNTIME_OUTPUT_DIRECTORY_${CONF}':
# RUNTIME_OUTPUT_DIRECTORY_DEBUG, RUNTIME_OUTPUT_DIRECTORY_RELEASE, ...
if(CMAKE_CONFIGURATION_TYPES)
foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${build_mode}" CONFIG_SUFFIX)
set_target_properties("${target}" PROPERTIES
"ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${output_dir}
"LIBRARY_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${output_dir}
"RUNTIME_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${output_dir})
endforeach()
else()
set_target_properties("${target}" PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${output_dir}
LIBRARY_OUTPUT_DIRECTORY ${output_dir}
RUNTIME_OUTPUT_DIRECTORY ${output_dir})
endif()
endfunction()
# Tries to add an "object library" target for a given list of OSs and/or
# architectures with name "." for non-Darwin platforms if
# architecture can be targeted, and "." for Darwin platforms.
# add_compiler_rt_object_libraries(
# OS
# ARCHS
# SOURCES
# CFLAGS
# DEFS )
function(add_compiler_rt_object_libraries name)
cmake_parse_arguments(LIB "" "" "OS;ARCHS;SOURCES;CFLAGS;DEFS" ${ARGN})
set(libnames)
if(APPLE)
foreach(os ${LIB_OS})
set(libname "${name}.${os}")
set(libnames ${libnames} ${libname})
set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS})
list_intersect(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS)
endforeach()
else()
foreach(arch ${LIB_ARCHS})
set(libname "${name}.${arch}")
set(libnames ${libnames} ${libname})
set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS})
if(NOT CAN_TARGET_${arch})
message(FATAL_ERROR "Architecture ${arch} can't be targeted")
return()
endif()
endforeach()
endif()
foreach(libname ${libnames})
add_library(${libname} OBJECT ${LIB_SOURCES})
set_target_compile_flags(${libname}
${CMAKE_CXX_FLAGS} ${extra_cflags_${libname}} ${LIB_CFLAGS})
set_property(TARGET ${libname} APPEND PROPERTY
COMPILE_DEFINITIONS ${LIB_DEFS})
set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Libraries")
if(APPLE)
set_target_properties(${libname} PROPERTIES
OSX_ARCHITECTURES "${LIB_ARCHS_${libname}}")
endif()
endforeach()
endfunction()
# Takes a list of object library targets, and a suffix and appends the proper
# TARGET_OBJECTS string to the output variable.
# format_object_libs( ...)
macro(format_object_libs output suffix)
foreach(lib ${ARGN})
list(APPEND ${output} $)
endforeach()
endmacro()
function(add_compiler_rt_component name)
add_custom_target(${name})
set_target_properties(${name} PROPERTIES FOLDER "Compiler-RT Misc")
if(COMMAND runtime_register_component)
runtime_register_component(${name})
endif()
add_dependencies(compiler-rt ${name})
endfunction()
# Adds static or shared runtime for a list of architectures and operating
# systems and puts it in the proper directory in the build and install trees.
# add_compiler_rt_runtime(
# {STATIC|SHARED}
# ARCHS
# OS
# SOURCES
# CFLAGS
# LINKFLAGS
# DEFS
# LINK_LIBS (only for shared library)
# OBJECT_LIBS
# PARENT_TARGET )
function(add_compiler_rt_runtime name type)
if(NOT type MATCHES "^(STATIC|SHARED)$")
message(FATAL_ERROR "type argument must be STATIC or SHARED")
return()
endif()
cmake_parse_arguments(LIB
""
"PARENT_TARGET"
"OS;ARCHS;SOURCES;CFLAGS;LINKFLAGS;DEFS;LINK_LIBS;OBJECT_LIBS"
${ARGN})
set(libnames)
if(APPLE)
foreach(os ${LIB_OS})
if(type STREQUAL "STATIC")
set(libname "${name}_${os}")
else()
set(libname "${name}_${os}_dynamic")
set(extra_linkflags_${libname} ${DARWIN_${os}_LINKFLAGS} ${LIB_LINKFLAGS})
endif()
list_intersect(LIB_ARCHS_${libname} DARWIN_${os}_ARCHS LIB_ARCHS)
if(LIB_ARCHS_${libname})
list(APPEND libnames ${libname})
set(extra_cflags_${libname} ${DARWIN_${os}_CFLAGS} ${LIB_CFLAGS})
set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX})
set(sources_${libname} ${LIB_SOURCES})
format_object_libs(sources_${libname} ${os} ${LIB_OBJECT_LIBS})
endif()
endforeach()
else()
foreach(arch ${LIB_ARCHS})
if(NOT CAN_TARGET_${arch})
message(FATAL_ERROR "Architecture ${arch} can't be targeted")
return()
endif()
if(type STREQUAL "STATIC")
set(libname "${name}-${arch}")
set(output_name_${libname} ${libname}${COMPILER_RT_OS_SUFFIX})
else()
set(libname "${name}-dynamic-${arch}")
set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
set(extra_linkflags_${libname} ${TARGET_${arch}_LINKFLAGS} ${LIB_LINKFLAGS})
if(WIN32)
set(output_name_${libname} ${name}_dynamic-${arch}${COMPILER_RT_OS_SUFFIX})
else()
set(output_name_${libname} ${name}-${arch}${COMPILER_RT_OS_SUFFIX})
endif()
endif()
set(sources_${libname} ${LIB_SOURCES})
format_object_libs(sources_${libname} ${arch} ${LIB_OBJECT_LIBS})
set(libnames ${libnames} ${libname})
set(extra_cflags_${libname} ${TARGET_${arch}_CFLAGS} ${LIB_CFLAGS})
endforeach()
endif()
if(NOT libnames)
return()
endif()
if(LIB_PARENT_TARGET)
# If the parent targets aren't created we should create them
if(NOT TARGET ${LIB_PARENT_TARGET})
add_custom_target(${LIB_PARENT_TARGET})
endif()
if(NOT TARGET install-${LIB_PARENT_TARGET})
# The parent install target specifies the parent component to scrape up
# anything not installed by the individual install targets, and to handle
# installation when running the multi-configuration generators.
add_custom_target(install-${LIB_PARENT_TARGET}
DEPENDS ${LIB_PARENT_TARGET}
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=${LIB_PARENT_TARGET}
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
set_target_properties(install-${LIB_PARENT_TARGET} PROPERTIES
FOLDER "Compiler-RT Misc")
add_dependencies(install-compiler-rt install-${LIB_PARENT_TARGET})
endif()
endif()
foreach(libname ${libnames})
# If you are using a multi-configuration generator we don't generate
# per-library install rules, so we fall back to the parent target COMPONENT
if(CMAKE_CONFIGURATION_TYPES AND LIB_PARENT_TARGET)
set(COMPONENT_OPTION COMPONENT ${LIB_PARENT_TARGET})
else()
set(COMPONENT_OPTION COMPONENT ${libname})
endif()
add_library(${libname} ${type} ${sources_${libname}})
set_target_compile_flags(${libname} ${extra_cflags_${libname}})
set_target_link_flags(${libname} ${extra_linkflags_${libname}})
set_property(TARGET ${libname} APPEND PROPERTY
COMPILE_DEFINITIONS ${LIB_DEFS})
set_target_output_directories(${libname} ${COMPILER_RT_LIBRARY_OUTPUT_DIR})
set_target_properties(${libname} PROPERTIES
OUTPUT_NAME ${output_name_${libname}})
set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Runtime")
if(${type} STREQUAL "SHARED")
if(LIB_LINK_LIBS)
target_link_libraries(${libname} ${LIB_LINK_LIBS})
endif()
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
endif()
endif()
install(TARGETS ${libname}
ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
${COMPONENT_OPTION}
LIBRARY DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
${COMPONENT_OPTION}
RUNTIME DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
${COMPONENT_OPTION})
# We only want to generate per-library install targets if you aren't using
# an IDE because the extra targets get cluttered in IDEs.
if(NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-${libname}
DEPENDS ${libname}
COMMAND "${CMAKE_COMMAND}"
-DCMAKE_INSTALL_COMPONENT=${libname}
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
# If you have a parent target specified, we bind the new install target
# to the parent install target.
if(LIB_PARENT_TARGET)
add_dependencies(install-${LIB_PARENT_TARGET} install-${libname})
endif()
endif()
if(APPLE)
set_target_properties(${libname} PROPERTIES
OSX_ARCHITECTURES "${LIB_ARCHS_${libname}}")
endif()
if(type STREQUAL "SHARED")
rt_externalize_debuginfo(${libname})
endif()
endforeach()
if(LIB_PARENT_TARGET)
add_dependencies(${LIB_PARENT_TARGET} ${libnames})
endif()
endfunction()
# when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help
# in compilation and linking of unittests.
string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}")
set(COMPILER_RT_UNITTEST_LINKFLAGS ${COMPILER_RT_UNITTEST_CFLAGS})
# Unittests support.
set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest)
set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc)
set(COMPILER_RT_GTEST_CFLAGS
-DGTEST_NO_LLVM_RAW_OSTREAM=1
-DGTEST_HAS_RTTI=0
-I${COMPILER_RT_GTEST_PATH}/include
-I${COMPILER_RT_GTEST_PATH}
)
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS)
if(MSVC)
# clang doesn't support exceptions on Windows yet.
list(APPEND COMPILER_RT_UNITTEST_CFLAGS -D_HAS_EXCEPTIONS=0)
# We should teach clang to understand "#pragma intrinsic", see PR19898.
list(APPEND COMPILER_RT_UNITTEST_CFLAGS -Wno-undefined-inline)
# Clang doesn't support SEH on Windows yet.
list(APPEND COMPILER_RT_GTEST_CFLAGS -DGTEST_HAS_SEH=0)
# gtest use a lot of stuff marked as deprecated on Windows.
list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations)
endif()
# Link objects into a single executable with COMPILER_RT_TEST_COMPILER,
# using specified link flags. Make executable a part of provided
# test_suite.
# add_compiler_rt_test(
# SUBDIR
# OBJECTS
# DEPS
# LINK_FLAGS )
macro(add_compiler_rt_test test_suite test_name)
cmake_parse_arguments(TEST "" "SUBDIR" "OBJECTS;DEPS;LINK_FLAGS" "" ${ARGN})
set(output_bin ${CMAKE_CURRENT_BINARY_DIR})
if(TEST_SUBDIR)
set(output_bin "${output_bin}/${TEST_SUBDIR}")
endif()
if(CMAKE_CONFIGURATION_TYPES)
set(output_bin "${output_bin}/${CMAKE_CFG_INTDIR}")
endif()
set(output_bin "${output_bin}/${test_name}")
if(MSVC)
set(output_bin "${output_bin}.exe")
endif()
# Use host compiler in a standalone build, and just-built Clang otherwise.
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND TEST_DEPS clang)
endif()
# If we're not on MSVC, include the linker flags from CMAKE but override them
# with the provided link flags. This ensures that flags which are required to
# link programs at all are included, but the changes needed for the test
# trump. With MSVC we can't do that because CMake is set up to run link.exe
# when linking, not the compiler. Here, we hack it to use the compiler
# because we want to use -fsanitize flags.
if(NOT MSVC)
set(TEST_LINK_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${TEST_LINK_FLAGS}")
separate_arguments(TEST_LINK_FLAGS)
endif()
add_custom_target(${test_name}
COMMAND ${COMPILER_RT_TEST_COMPILER} ${TEST_OBJECTS}
-o "${output_bin}"
${TEST_LINK_FLAGS}
DEPENDS ${TEST_DEPS})
set_target_properties(${test_name} PROPERTIES FOLDER "Compiler-RT Tests")
# Make the test suite depend on the binary.
add_dependencies(${test_suite} ${test_name})
endmacro()
macro(add_compiler_rt_resource_file target_name file_name component)
set(src_file "${CMAKE_CURRENT_SOURCE_DIR}/${file_name}")
set(dst_file "${COMPILER_RT_OUTPUT_DIR}/${file_name}")
add_custom_command(OUTPUT ${dst_file}
DEPENDS ${src_file}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src_file} ${dst_file}
COMMENT "Copying ${file_name}...")
add_custom_target(${target_name} DEPENDS ${dst_file})
# Install in Clang resource directory.
install(FILES ${file_name}
DESTINATION ${COMPILER_RT_INSTALL_PATH}
COMPONENT ${component})
add_dependencies(${component} ${target_name})
set_target_properties(${target_name} PROPERTIES FOLDER "Compiler-RT Misc")
endmacro()
macro(add_compiler_rt_script name)
set(dst ${COMPILER_RT_EXEC_OUTPUT_DIR}/${name})
set(src ${CMAKE_CURRENT_SOURCE_DIR}/${name})
add_custom_command(OUTPUT ${dst}
DEPENDS ${src}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst}
COMMENT "Copying ${name}...")
add_custom_target(${name} DEPENDS ${dst})
install(FILES ${dst}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION ${COMPILER_RT_INSTALL_PATH}/bin)
endmacro(add_compiler_rt_script src name)
# Builds custom version of libc++ and installs it in .
# Can be used to build sanitized versions of libc++ for running unit tests.
# add_custom_libcxx(
# DEPS
# CFLAGS )
macro(add_custom_libcxx name prefix)
if(NOT COMPILER_RT_HAS_LIBCXX_SOURCES)
message(FATAL_ERROR "libcxx not found!")
endif()
cmake_parse_arguments(LIBCXX "" "" "DEPS;CFLAGS" ${ARGN})
foreach(flag ${LIBCXX_CFLAGS})
set(flagstr "${flagstr} ${flag}")
endforeach()
set(LIBCXX_CFLAGS ${flagstr})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND LIBCXX_DEPS clang)
endif()
ExternalProject_Add(${name}
PREFIX ${prefix}
SOURCE_DIR ${COMPILER_RT_LIBCXX_PATH}
CMAKE_ARGS -DCMAKE_MAKE_PROGRAM:STRING=${CMAKE_MAKE_PROGRAM}
-DCMAKE_C_COMPILER=${COMPILER_RT_TEST_COMPILER}
-DCMAKE_CXX_COMPILER=${COMPILER_RT_TEST_CXX_COMPILER}
-DCMAKE_C_FLAGS=${LIBCXX_CFLAGS}
-DCMAKE_CXX_FLAGS=${LIBCXX_CFLAGS}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX:PATH=
-DLLVM_PATH=${LLVM_MAIN_SRC_DIR}
LOG_BUILD 1
LOG_CONFIGURE 1
LOG_INSTALL 1
)
set_target_properties(${name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
ExternalProject_Add_Step(${name} force-reconfigure
DEPENDERS configure
ALWAYS 1
)
ExternalProject_Add_Step(${name} clobber
COMMAND ${CMAKE_COMMAND} -E remove_directory
COMMAND ${CMAKE_COMMAND} -E make_directory
COMMENT "Clobberring ${name} build directory..."
DEPENDERS configure
DEPENDS ${LIBCXX_DEPS}
)
endmacro()
function(rt_externalize_debuginfo name)
if(NOT COMPILER_RT_EXTERNALIZE_DEBUGINFO)
return()
endif()
if(NOT COMPILER_RT_EXTERNALIZE_DEBUGINFO_SKIP_STRIP)
set(strip_command COMMAND xcrun strip -Sl $)
endif()
if(APPLE)
if(CMAKE_CXX_FLAGS MATCHES "-flto"
OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")
set(lto_object ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${name}-lto.o)
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-object_path_lto -Wl,${lto_object}")
endif()
add_custom_command(TARGET ${name} POST_BUILD
COMMAND xcrun dsymutil $
${strip_command})
else()
message(FATAL_ERROR "COMPILER_RT_EXTERNALIZE_DEBUGINFO isn't implemented for non-darwin platforms!")
endif()
endfunction()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/CompilerRTCompile.cmake 0000664 0001750 0001750 00000010552 12653744500 030235 0 ustar mwhudson mwhudson # On Windows, CMAKE_*_FLAGS are built for MSVC but we use the GCC clang.exe,
# which uses completely different flags. Translate some common flag types, and
# drop the rest.
function(translate_msvc_cflags out_flags msvc_flags)
# Insert an empty string in the list to simplify processing.
set(msvc_flags ";${msvc_flags}")
# Canonicalize /flag to -flag.
string(REPLACE ";/" ";-" msvc_flags "${msvc_flags}")
# Make space separated -D and -U flags into joined flags.
string(REGEX REPLACE ";-\([DU]\);" ";-\\1" msvc_flags "${msvc_flags}")
set(clang_flags "")
foreach(flag ${msvc_flags})
if ("${flag}" MATCHES "^-[DU]")
# Pass through basic command line macro definitions (-DNDEBUG).
list(APPEND clang_flags "${flag}")
elseif ("${flag}" MATCHES "^-O[2x]")
# Canonicalize normal optimization flags to -O2.
list(APPEND clang_flags "-O2")
endif()
endforeach()
set(${out_flags} "${clang_flags}" PARENT_SCOPE)
endfunction()
# Compile a source into an object file with COMPILER_RT_TEST_COMPILER using
# a provided compile flags and dependenices.
# clang_compile(
# CFLAGS
# DEPS )
macro(clang_compile object_file source)
cmake_parse_arguments(SOURCE "" "" "CFLAGS;DEPS" ${ARGN})
get_filename_component(source_rpath ${source} REALPATH)
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SOURCE_DEPS clang compiler-rt-headers)
endif()
if (TARGET CompilerRTUnitTestCheckCxx)
list(APPEND SOURCE_DEPS CompilerRTUnitTestCheckCxx)
endif()
string(REGEX MATCH "[.](cc|cpp)$" is_cxx ${source_rpath})
if(is_cxx)
string(REPLACE " " ";" global_flags "${CMAKE_CXX_FLAGS}")
else()
string(REPLACE " " ";" global_flags "${CMAKE_C_FLAGS}")
endif()
if (MSVC)
translate_msvc_cflags(global_flags "${global_flags}")
endif()
if (APPLE)
set(global_flags ${OSX_SYSROOT_FLAG} ${global_flags})
endif()
# Ignore unknown warnings. CMAKE_CXX_FLAGS may contain GCC-specific options
# which are not supported by Clang.
list(APPEND global_flags -Wno-unknown-warning-option)
set(compile_flags ${global_flags} ${SOURCE_CFLAGS})
add_custom_command(
OUTPUT ${object_file}
COMMAND ${COMPILER_RT_TEST_COMPILER} ${compile_flags} -c
-o "${object_file}"
${source_rpath}
MAIN_DEPENDENCY ${source}
DEPENDS ${SOURCE_DEPS})
endmacro()
# On Darwin, there are no system-wide C++ headers and the just-built clang is
# therefore not able to compile C++ files unless they are copied/symlinked into
# ${LLVM_BINARY_DIR}/include/c++
# The just-built clang is used to build compiler-rt unit tests. Let's detect
# this before we try to build the tests and print out a suggestion how to fix
# it.
# On other platforms, this is currently not an issue.
macro(clang_compiler_add_cxx_check)
if (APPLE)
set(CMD
"echo '#include ' | ${COMPILER_RT_TEST_COMPILER} ${OSX_SYSROOT_FLAG} -E -x c++ - > /dev/null"
"if [ $? != 0 ] "
" then echo"
" echo 'Your just-built clang cannot find C++ headers, which are needed to build and run compiler-rt tests.'"
" echo 'You should copy or symlink your system C++ headers into ${LLVM_BINARY_DIR}/include/c++'"
" if [ -d $(dirname $(dirname $(xcrun -f clang)))/include/c++ ]"
" then echo 'e.g. with:'"
" echo ' cp -r' $(dirname $(dirname $(xcrun -f clang)))/include/c++ '${LLVM_BINARY_DIR}/include/'"
" elif [ -d $(dirname $(dirname $(xcrun -f clang)))/lib/c++ ]"
" then echo 'e.g. with:'"
" echo ' cp -r' $(dirname $(dirname $(xcrun -f clang)))/lib/c++ '${LLVM_BINARY_DIR}/include/'"
" fi"
" echo 'This can also be fixed by checking out the libcxx project from llvm.org and installing the headers'"
" echo 'into your build directory:'"
" echo ' cd ${LLVM_MAIN_SRC_DIR}/projects && svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx'"
" echo ' cd ${LLVM_BINARY_DIR} && make -C ${LLVM_MAIN_SRC_DIR}/projects/libcxx installheaders HEADER_DIR=${LLVM_BINARY_DIR}/include'"
" echo"
" false"
"fi"
)
add_custom_target(CompilerRTUnitTestCheckCxx
COMMAND bash -c "${CMD}"
COMMENT "Checking that just-built clang can find C++ headers..."
VERBATIM)
if (TARGET clang)
ADD_DEPENDENCIES(CompilerRTUnitTestCheckCxx clang)
endif()
endif()
endmacro()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/CompilerRTDarwinUtils.cmake 0000664 0001750 0001750 00000041536 12755703253 031123 0 ustar mwhudson mwhudson include(CMakeParseArguments)
# On OS X SDKs can be installed anywhere on the base system and xcode-select can
# set the default Xcode to use. This function finds the SDKs that are present in
# the current Xcode.
function(find_darwin_sdk_dir var sdk_name)
# Let's first try the internal SDK, otherwise use the public SDK.
execute_process(
COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path
RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_FILE /dev/null
)
if((NOT result_process EQUAL 0) OR "" STREQUAL "${var_internal}")
execute_process(
COMMAND xcodebuild -version -sdk ${sdk_name} Path
RESULT_VARIABLE result_process
OUTPUT_VARIABLE var_internal
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_FILE /dev/null
)
else()
set(${var}_INTERNAL ${var_internal} PARENT_SCOPE)
endif()
if(result_process EQUAL 0)
set(${var} ${var_internal} PARENT_SCOPE)
endif()
endfunction()
# There isn't a clear mapping of what architectures are supported with a given
# target platform, but ld's version output does list the architectures it can
# link for.
function(darwin_get_toolchain_supported_archs output_var)
execute_process(
COMMAND ld -v
ERROR_VARIABLE LINKER_VERSION)
string(REGEX MATCH "configured to support archs: ([^\n]+)"
ARCHES_MATCHED "${LINKER_VERSION}")
if(ARCHES_MATCHED)
set(ARCHES "${CMAKE_MATCH_1}")
message(STATUS "Got ld supported ARCHES: ${ARCHES}")
string(REPLACE " " ";" ARCHES ${ARCHES})
else()
# If auto-detecting fails, fall back to a default set
message(WARNING "Detecting supported architectures from 'ld -v' failed. Returning default set.")
set(ARCHES "i386;x86_64;armv7;armv7s;arm64")
endif()
set(${output_var} ${ARCHES} PARENT_SCOPE)
endfunction()
# This function takes an OS and a list of architectures and identifies the
# subset of the architectures list that the installed toolchain can target.
function(darwin_test_archs os valid_archs)
if(${valid_archs})
message(STATUS "Using cached valid architectures for ${os}.")
return()
endif()
set(archs ${ARGN})
if(NOT TEST_COMPILE_ONLY)
message(STATUS "Finding valid architectures for ${os}...")
set(SIMPLE_C ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.c)
file(WRITE ${SIMPLE_C} "#include \nint main() { printf(__FILE__); return 0; }\n")
set(os_linker_flags)
foreach(flag ${DARWIN_${os}_LINKFLAGS})
set(os_linker_flags "${os_linker_flags} ${flag}")
endforeach()
endif()
# The simple program will build for x86_64h on the simulator because it is
# compatible with x86_64 libraries (mostly), but since x86_64h isn't actually
# a valid or useful architecture for the iOS simulator we should drop it.
if(${os} MATCHES "^(iossim|tvossim|watchossim)$")
list(REMOVE_ITEM archs "x86_64h")
endif()
set(working_archs)
foreach(arch ${archs})
set(arch_linker_flags "-arch ${arch} ${os_linker_flags}")
if(TEST_COMPILE_ONLY)
try_compile_only(CAN_TARGET_${os}_${arch} -v -arch ${arch} ${DARWIN_${os}_CFLAGS})
else()
try_compile(CAN_TARGET_${os}_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_C}
COMPILE_DEFINITIONS "-v -arch ${arch}" ${DARWIN_${os}_CFLAGS}
CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${arch_linker_flags}"
OUTPUT_VARIABLE TEST_OUTPUT)
endif()
if(${CAN_TARGET_${os}_${arch}})
list(APPEND working_archs ${arch})
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Testing compiler for supporting ${os}-${arch}:\n"
"${TEST_OUTPUT}\n")
endif()
endforeach()
set(${valid_archs} ${working_archs}
CACHE STRING "List of valid architectures for platform ${os}.")
endfunction()
# This function checks the host cpusubtype to see if it is post-haswell. Haswell
# and later machines can run x86_64h binaries. Haswell is cpusubtype 8.
function(darwin_filter_host_archs input output)
list_intersect(tmp_var DARWIN_osx_ARCHS ${input})
execute_process(
COMMAND sysctl hw.cpusubtype
OUTPUT_VARIABLE SUBTYPE)
string(REGEX MATCH "hw.cpusubtype: ([0-9]*)"
SUBTYPE_MATCHED "${SUBTYPE}")
set(HASWELL_SUPPORTED Off)
if(SUBTYPE_MATCHED)
if(${CMAKE_MATCH_1} GREATER 7)
set(HASWELL_SUPPORTED On)
endif()
endif()
if(NOT HASWELL_SUPPORTED)
list(REMOVE_ITEM tmp_var x86_64h)
endif()
set(${output} ${tmp_var} PARENT_SCOPE)
endfunction()
# Read and process the exclude file into a list of symbols
function(darwin_read_list_from_file output_var file)
if(EXISTS ${file})
file(READ ${file} EXCLUDES)
string(REPLACE "\n" ";" EXCLUDES ${EXCLUDES})
set(${output_var} ${EXCLUDES} PARENT_SCOPE)
endif()
endfunction()
# this function takes an OS, architecture and minimum version and provides a
# list of builtin functions to exclude
function(darwin_find_excluded_builtins_list output_var)
cmake_parse_arguments(LIB
""
"OS;ARCH;MIN_VERSION"
""
${ARGN})
if(NOT LIB_OS OR NOT LIB_ARCH)
message(FATAL_ERROR "Must specify OS and ARCH to darwin_find_excluded_builtins_list!")
endif()
darwin_read_list_from_file(${LIB_OS}_BUILTINS
${DARWIN_EXCLUDE_DIR}/${LIB_OS}.txt)
darwin_read_list_from_file(${LIB_OS}_${LIB_ARCH}_BASE_BUILTINS
${DARWIN_EXCLUDE_DIR}/${LIB_OS}-${LIB_ARCH}.txt)
if(LIB_MIN_VERSION)
file(GLOB builtin_lists ${DARWIN_EXCLUDE_DIR}/${LIB_OS}*-${LIB_ARCH}.txt)
foreach(builtin_list ${builtin_lists})
string(REGEX MATCH "${LIB_OS}([0-9\\.]*)-${LIB_ARCH}.txt" VERSION_MATCHED "${builtin_list}")
if (VERSION_MATCHED AND NOT CMAKE_MATCH_1 VERSION_LESS LIB_MIN_VERSION)
if(NOT smallest_version)
set(smallest_version ${CMAKE_MATCH_1})
elseif(CMAKE_MATCH_1 VERSION_LESS smallest_version)
set(smallest_version ${CMAKE_MATCH_1})
endif()
endif()
endforeach()
if(smallest_version)
darwin_read_list_from_file(${LIB_ARCH}_${LIB_OS}_BUILTINS
${DARWIN_EXCLUDE_DIR}/${LIB_OS}${smallest_version}-${LIB_ARCH}.txt)
endif()
endif()
set(${output_var}
${${LIB_ARCH}_${LIB_OS}_BUILTINS}
${${LIB_OS}_${LIB_ARCH}_BASE_BUILTINS}
${${LIB_OS}_BUILTINS} PARENT_SCOPE)
endfunction()
# adds a single builtin library for a single OS & ARCH
macro(darwin_add_builtin_library name suffix)
cmake_parse_arguments(LIB
""
"PARENT_TARGET;OS;ARCH"
"SOURCES;CFLAGS;DEFS"
${ARGN})
set(libname "${name}.${suffix}_${LIB_ARCH}_${LIB_OS}")
add_library(${libname} STATIC ${LIB_SOURCES})
if(DARWIN_${LIB_OS}_SYSROOT)
set(sysroot_flag -isysroot ${DARWIN_${LIB_OS}_SYSROOT})
endif()
set_target_compile_flags(${libname}
${sysroot_flag}
${DARWIN_${LIB_OS}_BUILTIN_MIN_VER_FLAG}
${LIB_CFLAGS})
set_property(TARGET ${libname} APPEND PROPERTY
COMPILE_DEFINITIONS ${LIB_DEFS})
set_target_properties(${libname} PROPERTIES
OUTPUT_NAME ${libname}${COMPILER_RT_OS_SUFFIX})
set_target_properties(${libname} PROPERTIES
OSX_ARCHITECTURES ${LIB_ARCH})
if(LIB_PARENT_TARGET)
add_dependencies(${LIB_PARENT_TARGET} ${libname})
endif()
list(APPEND ${LIB_OS}_${suffix}_libs ${libname})
list(APPEND ${LIB_OS}_${suffix}_lipo_flags -arch ${arch} $)
endmacro()
function(darwin_lipo_libs name)
cmake_parse_arguments(LIB
""
"PARENT_TARGET;OUTPUT_DIR;INSTALL_DIR"
"LIPO_FLAGS;DEPENDS"
${ARGN})
if(LIB_DEPENDS AND LIB_LIPO_FLAGS)
add_custom_command(OUTPUT ${LIB_OUTPUT_DIR}/lib${name}.a
COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
COMMAND lipo -output
${LIB_OUTPUT_DIR}/lib${name}.a
-create ${LIB_LIPO_FLAGS}
DEPENDS ${LIB_DEPENDS}
)
add_custom_target(${name}
DEPENDS ${LIB_OUTPUT_DIR}/lib${name}.a)
add_dependencies(${LIB_PARENT_TARGET} ${name})
install(FILES ${LIB_OUTPUT_DIR}/lib${name}.a
DESTINATION ${LIB_INSTALL_DIR})
else()
message(WARNING "Not generating lipo target for ${name} because no input libraries exist.")
endif()
endfunction()
# Filter out generic versions of routines that are re-implemented in
# architecture specific manner. This prevents multiple definitions of the
# same symbols, making the symbol selection non-deterministic.
function(darwin_filter_builtin_sources output_var exclude_or_include excluded_list)
if(exclude_or_include STREQUAL "EXCLUDE")
set(filter_action GREATER)
set(filter_value -1)
elseif(exclude_or_include STREQUAL "INCLUDE")
set(filter_action LESS)
set(filter_value 0)
else()
message(FATAL_ERROR "darwin_filter_builtin_sources called without EXCLUDE|INCLUDE")
endif()
set(intermediate ${ARGN})
foreach (_file ${intermediate})
get_filename_component(_name_we ${_file} NAME_WE)
list(FIND ${excluded_list} ${_name_we} _found)
if(_found ${filter_action} ${filter_value})
list(REMOVE_ITEM intermediate ${_file})
elseif(${_file} MATCHES ".*/.*\\.S" OR ${_file} MATCHES ".*/.*\\.c")
get_filename_component(_name ${_file} NAME)
string(REPLACE ".S" ".c" _cname "${_name}")
list(REMOVE_ITEM intermediate ${_cname})
endif ()
endforeach ()
set(${output_var} ${intermediate} PARENT_SCOPE)
endfunction()
# Generates builtin libraries for all operating systems specified in ARGN. Each
# OS library is constructed by lipo-ing together single-architecture libraries.
macro(darwin_add_builtin_libraries)
set(DARWIN_EXCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Darwin-excludes)
set(CFLAGS "-fPIC -O3 -fvisibility=hidden -DVISIBILITY_HIDDEN -Wall -fomit-frame-pointer")
set(CMAKE_C_FLAGS "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_ASM_FLAGS "")
set(PROFILE_SOURCES ../profile/InstrProfiling
../profile/InstrProfilingBuffer
../profile/InstrProfilingPlatformDarwin
../profile/InstrProfilingWriter)
foreach (os ${ARGN})
list_intersect(DARWIN_BUILTIN_ARCHS DARWIN_${os}_ARCHS BUILTIN_SUPPORTED_ARCH)
foreach (arch ${DARWIN_BUILTIN_ARCHS})
darwin_find_excluded_builtins_list(${arch}_${os}_EXCLUDED_BUILTINS
OS ${os}
ARCH ${arch}
MIN_VERSION ${DARWIN_${os}_BUILTIN_MIN_VER})
darwin_filter_builtin_sources(filtered_sources
EXCLUDE ${arch}_${os}_EXCLUDED_BUILTINS
${${arch}_SOURCES})
darwin_add_builtin_library(clang_rt builtins
OS ${os}
ARCH ${arch}
SOURCES ${filtered_sources}
CFLAGS ${CFLAGS} -arch ${arch}
PARENT_TARGET builtins)
endforeach()
# Don't build cc_kext libraries for simulator platforms
if(NOT DARWIN_${os}_SKIP_CC_KEXT)
foreach (arch ${DARWIN_BUILTIN_ARCHS})
# By not specifying MIN_VERSION this only reads the OS and OS-arch lists.
# We don't want to filter out the builtins that are present in libSystem
# because kexts can't link libSystem.
darwin_find_excluded_builtins_list(${arch}_${os}_EXCLUDED_BUILTINS
OS ${os}
ARCH ${arch})
darwin_filter_builtin_sources(filtered_sources
EXCLUDE ${arch}_${os}_EXCLUDED_BUILTINS
${${arch}_SOURCES})
# In addition to the builtins cc_kext includes some profile sources
darwin_add_builtin_library(clang_rt cc_kext
OS ${os}
ARCH ${arch}
SOURCES ${filtered_sources} ${PROFILE_SOURCES}
CFLAGS ${CFLAGS} -arch ${arch} -mkernel
DEFS KERNEL_USE
PARENT_TARGET builtins)
endforeach()
set(archive_name clang_rt.cc_kext_${os})
if(${os} STREQUAL "osx")
set(archive_name clang_rt.cc_kext)
endif()
darwin_lipo_libs(${archive_name}
PARENT_TARGET builtins
LIPO_FLAGS ${${os}_cc_kext_lipo_flags}
DEPENDS ${${os}_cc_kext_libs}
OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR})
endif()
endforeach()
# We put the x86 sim slices into the archives for their base OS
foreach (os ${ARGN})
if(NOT ${os} MATCHES ".*sim$")
darwin_lipo_libs(clang_rt.${os}
PARENT_TARGET builtins
LIPO_FLAGS ${${os}_builtins_lipo_flags} ${${os}sim_builtins_lipo_flags}
DEPENDS ${${os}_builtins_libs} ${${os}sim_builtins_libs}
OUTPUT_DIR ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
INSTALL_DIR ${COMPILER_RT_LIBRARY_INSTALL_DIR})
endif()
endforeach()
darwin_add_embedded_builtin_libraries()
endmacro()
macro(darwin_add_embedded_builtin_libraries)
# this is a hacky opt-out. If you can't target both intel and arm
# architectures we bail here.
set(DARWIN_SOFT_FLOAT_ARCHS armv6m armv7m armv7em armv7)
set(DARWIN_HARD_FLOAT_ARCHS armv7em armv7)
if(COMPILER_RT_SUPPORTED_ARCH MATCHES ".*armv.*")
list(FIND COMPILER_RT_SUPPORTED_ARCH i386 i386_idx)
if(i386_idx GREATER -1)
list(APPEND DARWIN_HARD_FLOAT_ARCHS i386)
endif()
list(FIND COMPILER_RT_SUPPORTED_ARCH x86_64 x86_64_idx)
if(x86_64_idx GREATER -1)
list(APPEND DARWIN_HARD_FLOAT_ARCHS x86_64)
endif()
set(MACHO_SYM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/macho_embedded)
set(CFLAGS "-Oz -Wall -fomit-frame-pointer -ffreestanding")
set(CMAKE_C_FLAGS "")
set(CMAKE_CXX_FLAGS "")
set(CMAKE_ASM_FLAGS "")
set(SOFT_FLOAT_FLAG -mfloat-abi=soft)
set(HARD_FLOAT_FLAG -mfloat-abi=hard)
set(ENABLE_PIC Off)
set(PIC_FLAG -fPIC)
set(STATIC_FLAG -static)
set(DARWIN_macho_embedded_ARCHS armv6m armv7m armv7em armv7 i386 x86_64)
set(DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/macho_embedded)
set(DARWIN_macho_embedded_LIBRARY_INSTALL_DIR
${COMPILER_RT_INSTALL_PATH}/lib/macho_embedded)
set(CFLAGS_armv7 "-target thumbv7-apple-darwin-eabi")
set(CFLAGS_i386 "-march=pentium")
darwin_read_list_from_file(common_FUNCTIONS ${MACHO_SYM_DIR}/common.txt)
darwin_read_list_from_file(thumb2_FUNCTIONS ${MACHO_SYM_DIR}/thumb2.txt)
darwin_read_list_from_file(thumb2_64_FUNCTIONS ${MACHO_SYM_DIR}/thumb2-64.txt)
darwin_read_list_from_file(arm_FUNCTIONS ${MACHO_SYM_DIR}/arm.txt)
darwin_read_list_from_file(i386_FUNCTIONS ${MACHO_SYM_DIR}/i386.txt)
set(armv6m_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS})
set(armv7m_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS})
set(armv7em_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS})
set(armv7_FUNCTIONS ${common_FUNCTIONS} ${arm_FUNCTIONS} ${thumb2_FUNCTIONS} ${thumb2_64_FUNCTIONS})
set(i386_FUNCTIONS ${common_FUNCTIONS} ${i386_FUNCTIONS})
set(x86_64_FUNCTIONS ${common_FUNCTIONS})
foreach(arch ${DARWIN_macho_embedded_ARCHS})
darwin_filter_builtin_sources(${arch}_filtered_sources
INCLUDE ${arch}_FUNCTIONS
${${arch}_SOURCES})
if(NOT ${arch}_filtered_sources)
message("${arch}_SOURCES: ${${arch}_SOURCES}")
message("${arch}_FUNCTIONS: ${${arch}_FUNCTIONS}")
message(FATAL_ERROR "Empty filtered sources!")
endif()
endforeach()
foreach(float_type SOFT HARD)
foreach(type PIC STATIC)
string(TOLOWER "${float_type}_${type}" lib_suffix)
foreach(arch ${DARWIN_${float_type}_FLOAT_ARCHS})
set(DARWIN_macho_embedded_SYSROOT ${DARWIN_osx_SYSROOT})
set(float_flag)
if(${arch} MATCHES "^arm")
# x86 targets are hard float by default, but the complain about the
# float ABI flag, so don't pass it unless we're targeting arm.
set(float_flag ${${float_type}_FLOAT_FLAG})
endif()
darwin_add_builtin_library(clang_rt ${lib_suffix}
OS macho_embedded
ARCH ${arch}
SOURCES ${${arch}_filtered_sources}
CFLAGS ${CFLAGS} -arch ${arch} ${${type}_FLAG} ${float_flag} ${CFLAGS_${arch}}
PARENT_TARGET builtins)
endforeach()
foreach(lib ${macho_embedded_${lib_suffix}_libs})
set_target_properties(${lib} PROPERTIES LINKER_LANGUAGE C)
endforeach()
darwin_lipo_libs(clang_rt.${lib_suffix}
PARENT_TARGET builtins
LIPO_FLAGS ${macho_embedded_${lib_suffix}_lipo_flags}
DEPENDS ${macho_embedded_${lib_suffix}_libs}
OUTPUT_DIR ${DARWIN_macho_embedded_LIBRARY_OUTPUT_DIR}
INSTALL_DIR ${DARWIN_macho_embedded_LIBRARY_INSTALL_DIR})
endforeach()
endforeach()
endif()
endmacro()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/CompilerRTUtils.cmake 0000664 0001750 0001750 00000020526 12771042144 027743 0 ustar mwhudson mwhudson include(CMakePushCheckState)
include(CheckSymbolExists)
# Because compiler-rt spends a lot of time setting up custom compile flags,
# define a handy helper function for it. The compile flags setting in CMake
# has serious issues that make its syntax challenging at best.
function(set_target_compile_flags target)
set(argstring "")
foreach(arg ${ARGN})
set(argstring "${argstring} ${arg}")
endforeach()
set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}")
endfunction()
function(set_target_link_flags target)
set(argstring "")
foreach(arg ${ARGN})
set(argstring "${argstring} ${arg}")
endforeach()
set_property(TARGET ${target} PROPERTY LINK_FLAGS "${argstring}")
endfunction()
# Set the variable var_PYBOOL to True if var holds a true-ish string,
# otherwise set it to False.
macro(pythonize_bool var)
if (${var})
set(${var}_PYBOOL True)
else()
set(${var}_PYBOOL False)
endif()
endmacro()
# Appends value to all lists in ARGN, if the condition is true.
macro(append_list_if condition value)
if(${condition})
foreach(list ${ARGN})
list(APPEND ${list} ${value})
endforeach()
endif()
endmacro()
# Appends value to all strings in ARGN, if the condition is true.
macro(append_string_if condition value)
if(${condition})
foreach(str ${ARGN})
set(${str} "${${str}} ${value}")
endforeach()
endif()
endmacro()
macro(append_rtti_flag polarity list)
if(${polarity})
append_list_if(COMPILER_RT_HAS_FRTTI_FLAG -frtti ${list})
append_list_if(COMPILER_RT_HAS_GR_FLAG /GR ${list})
else()
append_list_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti ${list})
append_list_if(COMPILER_RT_HAS_GR_FLAG /GR- ${list})
endif()
endmacro()
macro(append_have_file_definition filename varname list)
check_include_file("${filename}" "${varname}")
if (NOT ${varname})
set("${varname}" 0)
endif()
list(APPEND ${list} "${varname}=${${varname}}")
endmacro()
macro(list_intersect output input1 input2)
set(${output})
foreach(it ${${input1}})
list(FIND ${input2} ${it} index)
if( NOT (index EQUAL -1))
list(APPEND ${output} ${it})
endif()
endforeach()
endmacro()
function(list_replace input_list old new)
set(replaced_list)
foreach(item ${${input_list}})
if(${item} STREQUAL ${old})
list(APPEND replaced_list ${new})
else()
list(APPEND replaced_list ${item})
endif()
endforeach()
set(${input_list} "${replaced_list}" PARENT_SCOPE)
endfunction()
# Takes ${ARGN} and puts only supported architectures in @out_var list.
function(filter_available_targets out_var)
set(archs ${${out_var}})
foreach(arch ${ARGN})
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
if(NOT (ARCH_INDEX EQUAL -1) AND CAN_TARGET_${arch})
list(APPEND archs ${arch})
endif()
endforeach()
set(${out_var} ${archs} PARENT_SCOPE)
endfunction()
function(check_compile_definition def argstring out_var)
if("${def}" STREQUAL "")
set(${out_var} TRUE PARENT_SCOPE)
return()
endif()
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${argstring}")
check_symbol_exists(${def} "" ${out_var})
cmake_pop_check_state()
endfunction()
# test_target_arch( )
# Checks if architecture is supported: runs host compiler with provided
# flags to verify that:
# 1) is defined (if non-empty)
# 2) simple file can be successfully built.
# If successful, saves target flags for this architecture.
macro(test_target_arch arch def)
set(TARGET_${arch}_CFLAGS ${ARGN})
set(TARGET_${arch}_LINKFLAGS ${ARGN})
set(argstring "")
foreach(arg ${ARGN})
set(argstring "${argstring} ${arg}")
endforeach()
check_compile_definition("${def}" "${argstring}" HAS_${arch}_DEF)
if(NOT DEFINED CAN_TARGET_${arch})
if(NOT HAS_${arch}_DEF)
set(CAN_TARGET_${arch} FALSE)
elseif(TEST_COMPILE_ONLY)
try_compile_only(CAN_TARGET_${arch} ${TARGET_${arch}_CFLAGS})
else()
set(argstring "${CMAKE_EXE_LINKER_FLAGS} ${argstring}")
set(FLAG_NO_EXCEPTIONS "")
if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
set(FLAG_NO_EXCEPTIONS " -fno-exceptions ")
endif()
try_compile(CAN_TARGET_${arch} ${CMAKE_BINARY_DIR} ${SIMPLE_SOURCE}
COMPILE_DEFINITIONS "${TARGET_${arch}_CFLAGS} ${FLAG_NO_EXCEPTIONS}"
OUTPUT_VARIABLE TARGET_${arch}_OUTPUT
CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS:STRING=${argstring}")
endif()
endif()
if(${CAN_TARGET_${arch}})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
elseif("${COMPILER_RT_DEFAULT_TARGET_ARCH}" STREQUAL "${arch}" AND
COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE)
# Bail out if we cannot target the architecture we plan to test.
message(FATAL_ERROR "Cannot compile for ${arch}:\n${TARGET_${arch}_OUTPUT}")
endif()
endmacro()
macro(detect_target_arch)
check_symbol_exists(__arm__ "" __ARM)
check_symbol_exists(__aarch64__ "" __AARCH64)
check_symbol_exists(__x86_64__ "" __X86_64)
check_symbol_exists(__i686__ "" __I686)
check_symbol_exists(__i386__ "" __I386)
check_symbol_exists(__mips__ "" __MIPS)
check_symbol_exists(__mips64__ "" __MIPS64)
check_symbol_exists(__s390x__ "" __S390X)
check_symbol_exists(__wasm32__ "" __WEBASSEMBLY32)
check_symbol_exists(__wasm64__ "" __WEBASSEMBLY64)
if(__ARM)
add_default_target_arch(arm)
elseif(__AARCH64)
add_default_target_arch(aarch64)
elseif(__X86_64)
add_default_target_arch(x86_64)
elseif(__I686)
add_default_target_arch(i686)
elseif(__I386)
add_default_target_arch(i386)
elseif(__MIPS64) # must be checked before __MIPS
add_default_target_arch(mips64)
elseif(__MIPS)
add_default_target_arch(mips)
elseif(__S390X)
add_default_target_arch(s390x)
elseif(__WEBASSEMBLY32)
add_default_target_arch(wasm32)
elseif(__WEBASSEMBLY64)
add_default_target_arch(wasm64)
endif()
endmacro()
macro(load_llvm_config)
if (NOT LLVM_CONFIG_PATH)
find_program(LLVM_CONFIG_PATH "llvm-config"
DOC "Path to llvm-config binary")
if (NOT LLVM_CONFIG_PATH)
message(FATAL_ERROR "llvm-config not found: specify LLVM_CONFIG_PATH")
endif()
endif()
execute_process(
COMMAND ${LLVM_CONFIG_PATH} "--obj-root" "--bindir" "--libdir" "--src-root"
RESULT_VARIABLE HAD_ERROR
OUTPUT_VARIABLE CONFIG_OUTPUT)
if (HAD_ERROR)
message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}")
endif()
string(REGEX REPLACE "[ \t]*[\r\n]+[ \t]*" ";" CONFIG_OUTPUT ${CONFIG_OUTPUT})
list(GET CONFIG_OUTPUT 0 BINARY_DIR)
list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR)
list(GET CONFIG_OUTPUT 2 LIBRARY_DIR)
list(GET CONFIG_OUTPUT 3 MAIN_SRC_DIR)
set(LLVM_BINARY_DIR ${BINARY_DIR} CACHE PATH "Path to LLVM build tree")
set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib")
set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
# Make use of LLVM CMake modules.
file(TO_CMAKE_PATH ${LLVM_BINARY_DIR} LLVM_BINARY_DIR_CMAKE_STYLE)
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
# Get some LLVM variables from LLVMConfig.
include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
set(LLVM_LIBRARY_OUTPUT_INTDIR
${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
endmacro()
macro(construct_compiler_rt_default_triple)
set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${TARGET_TRIPLE} CACHE STRING
"Default triple for which compiler-rt runtimes will be built.")
if(DEFINED COMPILER_RT_TEST_TARGET_TRIPLE)
# Backwards compatibility: this variable used to be called
# COMPILER_RT_TEST_TARGET_TRIPLE.
set(COMPILER_RT_DEFAULT_TARGET_TRIPLE ${COMPILER_RT_TEST_TARGET_TRIPLE})
endif()
string(REPLACE "-" ";" TARGET_TRIPLE_LIST ${COMPILER_RT_DEFAULT_TARGET_TRIPLE})
list(GET TARGET_TRIPLE_LIST 0 COMPILER_RT_DEFAULT_TARGET_ARCH)
list(GET TARGET_TRIPLE_LIST 1 COMPILER_RT_DEFAULT_TARGET_OS)
list(GET TARGET_TRIPLE_LIST 2 COMPILER_RT_DEFAULT_TARGET_ABI)
# Determine if test target triple is specified explicitly, and doesn't match the
# default.
if(NOT COMPILER_RT_DEFAULT_TARGET_TRIPLE STREQUAL TARGET_TRIPLE)
set(COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE TRUE)
else()
set(COMPILER_RT_HAS_EXPLICIT_DEFAULT_TARGET_TRIPLE FALSE)
endif()
endmacro()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/CompilerRTLink.cmake 0000664 0001750 0001750 00000001162 12540707354 027540 0 ustar mwhudson mwhudson # Link a shared library with COMPILER_RT_TEST_COMPILER.
# clang_link_shared(
# OBJECTS
# LINKFLAGS
# DEPS )
macro(clang_link_shared so_file)
cmake_parse_arguments(SOURCE "" "" "OBJECTS;LINKFLAGS;DEPS" ${ARGN})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SOURCE_DEPS clang)
endif()
add_custom_command(
OUTPUT ${so_file}
COMMAND ${COMPILER_RT_TEST_COMPILER} -o "${so_file}" -shared
${SOURCE_LINKFLAGS} ${SOURCE_OBJECTS}
DEPENDS ${SOURCE_DEPS})
endmacro()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/SanitizerUtils.cmake 0000664 0001750 0001750 00000006004 12726360451 027672 0 ustar mwhudson mwhudson set(SANITIZER_GEN_DYNAMIC_LIST
${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/scripts/gen_dynamic_list.py)
set(SANITIZER_LINT_SCRIPT
${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common/scripts/check_lint.sh)
# Create a target "--symbols" that would generate the list of
# symbols that need to be exported from sanitizer runtime "". Function
# interceptors are exported automatically, user can also provide files with
# symbol names that should be exported as well.
# add_sanitizer_rt_symbols(
# ARCHS
# PARENT_TARGET
# EXTRA )
macro(add_sanitizer_rt_symbols name)
cmake_parse_arguments(ARG
""
"PARENT_TARGET"
"ARCHS;EXTRA"
${ARGN})
foreach(arch ${ARG_ARCHS})
set(target_name ${name}-${arch})
set(stamp ${CMAKE_CURRENT_BINARY_DIR}/${target_name}.syms-stamp)
set(extra_args)
foreach(arg ${ARG_EXTRA})
list(APPEND extra_args "--extra" ${arg})
endforeach()
add_custom_command(OUTPUT ${stamp}
COMMAND ${PYTHON_EXECUTABLE}
${SANITIZER_GEN_DYNAMIC_LIST} ${extra_args} $
> $.syms
COMMAND ${CMAKE_COMMAND} -E touch ${stamp}
DEPENDS ${target_name} ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating exported symbols for ${target_name}"
VERBATIM)
add_custom_target(${target_name}-symbols ALL
DEPENDS ${stamp}
SOURCES ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA})
install(FILES $.syms
DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR})
if(ARG_PARENT_TARGET)
add_dependencies(${ARG_PARENT_TARGET} ${target_name}-symbols)
endif()
endforeach()
endmacro()
macro(add_sanitizer_rt_version_list name)
set(vers ${CMAKE_CURRENT_BINARY_DIR}/${name}.vers)
cmake_parse_arguments(ARG "" "" "LIBS;EXTRA" ${ARGN})
set(args)
foreach(arg ${ARG_EXTRA})
list(APPEND args "--extra" ${arg})
endforeach()
foreach(arg ${ARG_LIBS})
list(APPEND args "$")
endforeach()
add_custom_command(OUTPUT ${vers}
COMMAND ${PYTHON_EXECUTABLE}
${SANITIZER_GEN_DYNAMIC_LIST} --version-list ${args}
> ${vers}
DEPENDS ${SANITIZER_GEN_DYNAMIC_LIST} ${ARG_EXTRA} ${ARG_LIBS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating version list for ${name}"
VERBATIM)
add_custom_target(${name}-version-list ALL
DEPENDS ${vers})
endmacro()
# Add target to check code style for sanitizer runtimes.
if(CMAKE_HOST_UNIX)
add_custom_target(SanitizerLintCheck
COMMAND env LLVM_CHECKOUT=${LLVM_MAIN_SRC_DIR} SILENT=1 TMPDIR=
PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
COMPILER_RT=${COMPILER_RT_SOURCE_DIR}
${SANITIZER_LINT_SCRIPT}
DEPENDS ${SANITIZER_LINT_SCRIPT}
COMMENT "Running lint check for sanitizer sources..."
VERBATIM)
endif()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/Modules/BuiltinTests.cmake 0000664 0001750 0001750 00000007011 12764310376 027334 0 ustar mwhudson mwhudson include(CMakeCheckCompilerFlagCommonPatterns)
# This function takes an OS and a list of architectures and identifies the
# subset of the architectures list that the installed toolchain can target.
function(try_compile_only output)
cmake_parse_arguments(ARG "" "" "SOURCE;FLAGS" ${ARGN})
if(NOT ARG_SOURCE)
set(ARG_SOURCE "int foo(int x, int y) { return x + y; }\n")
endif()
set(SIMPLE_C ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.c)
file(WRITE ${SIMPLE_C} "${ARG_SOURCE}\n")
string(REGEX MATCHALL "<[A-Za-z0-9_]*>" substitutions
${CMAKE_C_COMPILE_OBJECT})
set(TRY_COMPILE_FLAGS "${ARG_FLAGS}")
if(CMAKE_C_COMPILER_ID MATCHES Clang AND CMAKE_C_COMPILER_TARGET)
list(APPEND TRY_COMPILE_FLAGS "-target ${CMAKE_C_COMPILER_TARGET}")
endif()
string(REPLACE ";" " " extra_flags "${TRY_COMPILE_FLAGS}")
set(test_compile_command "${CMAKE_C_COMPILE_OBJECT}")
foreach(substitution ${substitutions})
if(substitution STREQUAL "")
string(REPLACE ""
"${CMAKE_C_COMPILER}" test_compile_command ${test_compile_command})
elseif(substitution STREQUAL "")
string(REPLACE ""
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/test.o"
test_compile_command ${test_compile_command})
elseif(substitution STREQUAL "")
string(REPLACE "" "${SIMPLE_C}" test_compile_command
${test_compile_command})
elseif(substitution STREQUAL "")
string(REPLACE "" "${CMAKE_C_FLAGS} ${extra_flags}"
test_compile_command ${test_compile_command})
else()
string(REPLACE "${substitution}" "" test_compile_command
${test_compile_command})
endif()
endforeach()
string(REPLACE " " ";" test_compile_command "${test_compile_command}")
execute_process(
COMMAND ${test_compile_command}
RESULT_VARIABLE result
OUTPUT_VARIABLE TEST_OUTPUT
ERROR_VARIABLE TEST_ERROR
)
CHECK_COMPILER_FLAG_COMMON_PATTERNS(_CheckCCompilerFlag_COMMON_PATTERNS)
set(ERRORS_FOUND OFF)
foreach(var ${_CheckCCompilerFlag_COMMON_PATTERNS})
if("${var}" STREQUAL "FAIL_REGEX")
continue()
endif()
if("${TEST_ERROR}" MATCHES "${var}" OR "${TEST_OUTPUT}" MATCHES "${var}")
set(ERRORS_FOUND ON)
endif()
endforeach()
if(result EQUAL 0 AND NOT ERRORS_FOUND)
set(${output} True PARENT_SCOPE)
else()
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Testing compiler for supporting " ${ARGN} ":\n"
"Command: ${test_compile_command}\n"
"${TEST_OUTPUT}\n${TEST_ERROR}\n${result}\n")
set(${output} False PARENT_SCOPE)
endif()
endfunction()
function(builtin_check_c_compiler_flag flag output)
if(NOT DEFINED ${output})
message(STATUS "Performing Test ${output}")
try_compile_only(result FLAGS ${flag})
set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}")
if(${result})
message(STATUS "Performing Test ${output} - Success")
else()
message(STATUS "Performing Test ${output} - Failed")
endif()
endif()
endfunction()
function(builtin_check_c_compiler_source output source)
if(NOT DEFINED ${output})
message(STATUS "Performing Test ${output}")
try_compile_only(result SOURCE ${source})
set(${output} ${result} CACHE INTERNAL "Compiler supports ${flag}")
if(${result})
message(STATUS "Performing Test ${output} - Success")
else()
message(STATUS "Performing Test ${output} - Failed")
endif()
endif()
endfunction()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/config-ix.cmake 0000664 0001750 0001750 00000046225 12775420063 025165 0 ustar mwhudson mwhudson include(CMakePushCheckState)
include(CheckCXXCompilerFlag)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(TestBigEndian)
function(check_linker_flag flag out_var)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
check_cxx_compiler_flag("" ${out_var})
cmake_pop_check_state()
endfunction()
# CodeGen options.
check_cxx_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG)
check_cxx_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
check_cxx_compiler_flag(-fno-exceptions COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG)
check_cxx_compiler_flag(-funwind-tables COMPILER_RT_HAS_FUNWIND_TABLES_FLAG)
check_cxx_compiler_flag(-fno-stack-protector COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG)
check_cxx_compiler_flag(-fno-sanitize=safe-stack COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG)
check_cxx_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG)
check_cxx_compiler_flag(-frtti COMPILER_RT_HAS_FRTTI_FLAG)
check_cxx_compiler_flag(-fno-rtti COMPILER_RT_HAS_FNO_RTTI_FLAG)
check_cxx_compiler_flag(-ffreestanding COMPILER_RT_HAS_FFREESTANDING_FLAG)
check_cxx_compiler_flag("-Werror -fno-function-sections" COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG)
check_cxx_compiler_flag(-std=c++11 COMPILER_RT_HAS_STD_CXX11_FLAG)
check_cxx_compiler_flag(-ftls-model=initial-exec COMPILER_RT_HAS_FTLS_MODEL_INITIAL_EXEC)
check_cxx_compiler_flag(-fno-lto COMPILER_RT_HAS_FNO_LTO_FLAG)
check_cxx_compiler_flag("-Werror -msse3" COMPILER_RT_HAS_MSSE3_FLAG)
check_cxx_compiler_flag(--sysroot=. COMPILER_RT_HAS_SYSROOT_FLAG)
if(NOT WIN32 AND NOT CYGWIN)
# MinGW warns if -fvisibility-inlines-hidden is used.
check_cxx_compiler_flag("-fvisibility-inlines-hidden" COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG)
endif()
check_cxx_compiler_flag(/GR COMPILER_RT_HAS_GR_FLAG)
check_cxx_compiler_flag(/GS COMPILER_RT_HAS_GS_FLAG)
check_cxx_compiler_flag(/MT COMPILER_RT_HAS_MT_FLAG)
check_cxx_compiler_flag(/Oy COMPILER_RT_HAS_Oy_FLAG)
# Debug info flags.
check_cxx_compiler_flag(-gline-tables-only COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG)
check_cxx_compiler_flag(-g COMPILER_RT_HAS_G_FLAG)
check_cxx_compiler_flag(/Zi COMPILER_RT_HAS_Zi_FLAG)
# Warnings.
check_cxx_compiler_flag(-Wall COMPILER_RT_HAS_WALL_FLAG)
check_cxx_compiler_flag(-Werror COMPILER_RT_HAS_WERROR_FLAG)
check_cxx_compiler_flag("-Werror -Wframe-larger-than=512" COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG)
check_cxx_compiler_flag("-Werror -Wglobal-constructors" COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG)
check_cxx_compiler_flag("-Werror -Wc99-extensions" COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG)
check_cxx_compiler_flag("-Werror -Wgnu" COMPILER_RT_HAS_WGNU_FLAG)
check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG)
check_cxx_compiler_flag("-Werror -Wvariadic-macros" COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG)
check_cxx_compiler_flag("-Werror -Wunused-parameter" COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag(/W4 COMPILER_RT_HAS_W4_FLAG)
check_cxx_compiler_flag(/WX COMPILER_RT_HAS_WX_FLAG)
check_cxx_compiler_flag(/wd4146 COMPILER_RT_HAS_WD4146_FLAG)
check_cxx_compiler_flag(/wd4291 COMPILER_RT_HAS_WD4291_FLAG)
check_cxx_compiler_flag(/wd4221 COMPILER_RT_HAS_WD4221_FLAG)
check_cxx_compiler_flag(/wd4391 COMPILER_RT_HAS_WD4391_FLAG)
check_cxx_compiler_flag(/wd4722 COMPILER_RT_HAS_WD4722_FLAG)
check_cxx_compiler_flag(/wd4800 COMPILER_RT_HAS_WD4800_FLAG)
# Symbols.
check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL)
# Libraries.
check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
check_library_exists(dl dlopen "" COMPILER_RT_HAS_LIBDL)
check_library_exists(rt shm_open "" COMPILER_RT_HAS_LIBRT)
check_library_exists(m pow "" COMPILER_RT_HAS_LIBM)
check_library_exists(pthread pthread_create "" COMPILER_RT_HAS_LIBPTHREAD)
check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)
# Linker flags.
if(ANDROID)
check_linker_flag("-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)
endif()
# Architectures.
# List of all architectures we can target.
set(COMPILER_RT_SUPPORTED_ARCH)
# Try to compile a very simple source file to ensure we can target the given
# platform. We use the results of these tests to build only the various target
# runtime libraries supported by our current compilers cross-compiling
# abilities.
set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
file(WRITE ${SIMPLE_SOURCE} "#include \n#include \nint main() { printf(\"hello, world\"); }\n")
# Add $arch as supported with no additional flags.
macro(add_default_target_arch arch)
set(TARGET_${arch}_CFLAGS "")
set(CAN_TARGET_${arch} 1)
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
endmacro()
# Detect whether the current target platform is 32-bit or 64-bit, and setup
# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
if (NOT CMAKE_SIZEOF_VOID_P EQUAL 4 AND
NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
message(FATAL_ERROR "Please use architecture with 4 or 8 byte pointers.")
endif()
test_targets()
# Returns a list of architecture specific target cflags in @out_var list.
function(get_target_flags_for_arch arch out_var)
list(FIND COMPILER_RT_SUPPORTED_ARCH ${arch} ARCH_INDEX)
if(ARCH_INDEX EQUAL -1)
message(FATAL_ERROR "Unsupported architecture: ${arch}")
else()
if (NOT APPLE)
set(${out_var} ${TARGET_${arch}_CFLAGS} PARENT_SCOPE)
else()
# This is only called in constructing cflags for tests executing on the
# host. This will need to all be cleaned up to support building tests
# for cross-targeted hardware (i.e. iOS).
set(${out_var} -arch ${arch} PARENT_SCOPE)
endif()
endif()
endfunction()
set(ARM64 aarch64)
set(ARM32 arm armhf)
set(X86 i386 i686)
set(X86_64 x86_64)
set(MIPS32 mips mipsel)
set(MIPS64 mips64 mips64el)
set(PPC64 powerpc64 powerpc64le)
set(S390X s390x)
set(WASM32 wasm32)
set(WASM64 wasm64)
if(APPLE)
set(ARM64 arm64)
set(ARM32 armv7 armv7s armv7k)
set(X86_64 x86_64 x86_64h)
endif()
set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64}
${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${S390X})
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
${MIPS32} ${MIPS64} ${PPC64})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64})
set(ALL_PROFILE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC64}
${MIPS32} ${MIPS64})
set(ALL_TSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64} ${PPC64})
set(ALL_UBSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
${MIPS32} ${MIPS64} ${PPC64} ${S390X})
set(ALL_SAFESTACK_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64} ${MIPS32} ${MIPS64})
set(ALL_CFI_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64})
set(ALL_ESAN_SUPPORTED_ARCH ${X86_64} ${MIPS64})
set(ALL_SCUDO_SUPPORTED_ARCH ${X86_64})
set(ALL_XRAY_SUPPORTED_ARCH ${X86_64} ${ARM32})
if(APPLE)
include(CompilerRTDarwinUtils)
find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
find_darwin_sdk_dir(DARWIN_watchos_SYSROOT watchos)
find_darwin_sdk_dir(DARWIN_tvossim_SYSROOT appletvsimulator)
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
if(NOT DARWIN_osx_SYSROOT)
if(EXISTS /usr/include)
set(DARWIN_osx_SYSROOT /)
else()
message(ERROR "Could not detect OS X Sysroot. Either install Xcode or the Apple Command Line Tools")
endif()
endif()
if(COMPILER_RT_ENABLE_IOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
set(DARWIN_ios_SANITIZER_MIN_VER_FLAG
${DARWIN_ios_MIN_VER_FLAG}=7.0)
endif()
if(COMPILER_RT_ENABLE_WATCHOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
set(DARWIN_watchos_MIN_VER_FLAG -mwatchos-version-min)
set(DARWIN_watchos_SANITIZER_MIN_VER_FLAG
${DARWIN_watchos_MIN_VER_FLAG}=2.0)
endif()
if(COMPILER_RT_ENABLE_TVOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS tvos)
set(DARWIN_tvos_MIN_VER_FLAG -mtvos-version-min)
set(DARWIN_tvos_SANITIZER_MIN_VER_FLAG
${DARWIN_tvos_MIN_VER_FLAG}=9.0)
endif()
# Note: In order to target x86_64h on OS X the minimum deployment target must
# be 10.8 or higher.
set(SANITIZER_COMMON_SUPPORTED_OS osx)
set(PROFILE_SUPPORTED_OS osx)
set(TSAN_SUPPORTED_OS osx)
if(NOT SANITIZER_MIN_OSX_VERSION)
string(REGEX MATCH "-mmacosx-version-min=([.0-9]+)"
MACOSX_VERSION_MIN_FLAG "${CMAKE_CXX_FLAGS}")
if(MACOSX_VERSION_MIN_FLAG)
set(SANITIZER_MIN_OSX_VERSION "${CMAKE_MATCH_1}")
elseif(CMAKE_OSX_DEPLOYMENT_TARGET)
set(SANITIZER_MIN_OSX_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
else()
set(SANITIZER_MIN_OSX_VERSION 10.9)
endif()
if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")
message(FATAL_ERROR "Too old OS X version: ${SANITIZER_MIN_OSX_VERSION}")
endif()
endif()
# We're setting the flag manually for each target OS
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
set(DARWIN_COMMON_CFLAGS -stdlib=libc++)
set(DARWIN_COMMON_LINKFLAGS
-stdlib=libc++
-lc++
-lc++abi)
check_linker_flag("-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
if(COMPILER_RT_HAS_APP_EXTENSION)
list(APPEND DARWIN_COMMON_LINKFLAGS "-fapplication-extension")
endif()
set(DARWIN_osx_CFLAGS
${DARWIN_COMMON_CFLAGS}
-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
set(DARWIN_osx_LINKFLAGS
${DARWIN_COMMON_LINKFLAGS}
-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION})
if(DARWIN_osx_SYSROOT)
list(APPEND DARWIN_osx_CFLAGS -isysroot ${DARWIN_osx_SYSROOT})
list(APPEND DARWIN_osx_LINKFLAGS -isysroot ${DARWIN_osx_SYSROOT})
endif()
# Figure out which arches to use for each OS
darwin_get_toolchain_supported_archs(toolchain_arches)
message(STATUS "Toolchain supported arches: ${toolchain_arches}")
if(NOT MACOSX_VERSION_MIN_FLAG)
darwin_test_archs(osx
DARWIN_osx_ARCHS
${toolchain_arches})
message(STATUS "OSX supported arches: ${DARWIN_osx_ARCHS}")
foreach(arch ${DARWIN_osx_ARCHS})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
set(CAN_TARGET_${arch} 1)
endforeach()
foreach(platform ${DARWIN_EMBEDDED_PLATFORMS})
if(DARWIN_${platform}sim_SYSROOT)
set(DARWIN_${platform}sim_CFLAGS
${DARWIN_COMMON_CFLAGS}
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
-isysroot ${DARWIN_${platform}sim_SYSROOT})
set(DARWIN_${platform}sim_LINKFLAGS
${DARWIN_COMMON_LINKFLAGS}
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
-isysroot ${DARWIN_${platform}sim_SYSROOT})
set(DARWIN_${platform}sim_SKIP_CC_KEXT On)
darwin_test_archs(${platform}sim
DARWIN_${platform}sim_ARCHS
${toolchain_arches})
message(STATUS "${platform} Simulator supported arches: ${DARWIN_${platform}sim_ARCHS}")
if(DARWIN_${platform}sim_ARCHS)
list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform}sim)
list(APPEND PROFILE_SUPPORTED_OS ${platform}sim)
if(DARWIN_${platform}_SYSROOT_INTERNAL)
list(APPEND TSAN_SUPPORTED_OS ${platform}sim)
endif()
endif()
foreach(arch ${DARWIN_${platform}sim_ARCHS})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
set(CAN_TARGET_${arch} 1)
endforeach()
endif()
if(DARWIN_${platform}_SYSROOT)
set(DARWIN_${platform}_CFLAGS
${DARWIN_COMMON_CFLAGS}
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
-isysroot ${DARWIN_${platform}_SYSROOT})
set(DARWIN_${platform}_LINKFLAGS
${DARWIN_COMMON_LINKFLAGS}
${DARWIN_${platform}_SANITIZER_MIN_VER_FLAG}
-isysroot ${DARWIN_${platform}_SYSROOT})
darwin_test_archs(${platform}
DARWIN_${platform}_ARCHS
${toolchain_arches})
message(STATUS "${platform} supported arches: ${DARWIN_${platform}_ARCHS}")
if(DARWIN_${platform}_ARCHS)
list(APPEND SANITIZER_COMMON_SUPPORTED_OS ${platform})
list(APPEND PROFILE_SUPPORTED_OS ${platform})
endif()
foreach(arch ${DARWIN_${platform}_ARCHS})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
set(CAN_TARGET_${arch} 1)
endforeach()
endif()
endforeach()
endif()
# for list_intersect
include(CompilerRTUtils)
list_intersect(SANITIZER_COMMON_SUPPORTED_ARCH
ALL_SANITIZER_COMMON_SUPPORTED_ARCH
COMPILER_RT_SUPPORTED_ARCH
)
set(LSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})
set(UBSAN_COMMON_SUPPORTED_ARCH ${SANITIZER_COMMON_SUPPORTED_ARCH})
list_intersect(ASAN_SUPPORTED_ARCH
ALL_ASAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(DFSAN_SUPPORTED_ARCH
ALL_DFSAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(LSAN_SUPPORTED_ARCH
ALL_LSAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(MSAN_SUPPORTED_ARCH
ALL_MSAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(PROFILE_SUPPORTED_ARCH
ALL_PROFILE_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(TSAN_SUPPORTED_ARCH
ALL_TSAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(UBSAN_SUPPORTED_ARCH
ALL_UBSAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(SAFESTACK_SUPPORTED_ARCH
ALL_SAFESTACK_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(CFI_SUPPORTED_ARCH
ALL_CFI_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(ESAN_SUPPORTED_ARCH
ALL_ESAN_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(SCUDO_SUPPORTED_ARCH
ALL_SCUDO_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
list_intersect(XRAY_SUPPORTED_ARCH
ALL_XRAY_SUPPORTED_ARCH
SANITIZER_COMMON_SUPPORTED_ARCH)
else()
# Architectures supported by compiler-rt libraries.
filter_available_targets(SANITIZER_COMMON_SUPPORTED_ARCH
${ALL_SANITIZER_COMMON_SUPPORTED_ARCH})
# LSan and UBSan common files should be available on all architectures
# supported by other sanitizers (even if they build into dummy object files).
filter_available_targets(LSAN_COMMON_SUPPORTED_ARCH
${SANITIZER_COMMON_SUPPORTED_ARCH})
filter_available_targets(UBSAN_COMMON_SUPPORTED_ARCH
${SANITIZER_COMMON_SUPPORTED_ARCH})
filter_available_targets(ASAN_SUPPORTED_ARCH ${ALL_ASAN_SUPPORTED_ARCH})
filter_available_targets(DFSAN_SUPPORTED_ARCH ${ALL_DFSAN_SUPPORTED_ARCH})
filter_available_targets(LSAN_SUPPORTED_ARCH ${ALL_LSAN_SUPPORTED_ARCH})
filter_available_targets(MSAN_SUPPORTED_ARCH ${ALL_MSAN_SUPPORTED_ARCH})
filter_available_targets(PROFILE_SUPPORTED_ARCH ${ALL_PROFILE_SUPPORTED_ARCH})
filter_available_targets(TSAN_SUPPORTED_ARCH ${ALL_TSAN_SUPPORTED_ARCH})
filter_available_targets(UBSAN_SUPPORTED_ARCH ${ALL_UBSAN_SUPPORTED_ARCH})
filter_available_targets(SAFESTACK_SUPPORTED_ARCH
${ALL_SAFESTACK_SUPPORTED_ARCH})
filter_available_targets(CFI_SUPPORTED_ARCH ${ALL_CFI_SUPPORTED_ARCH})
filter_available_targets(ESAN_SUPPORTED_ARCH ${ALL_ESAN_SUPPORTED_ARCH})
filter_available_targets(SCUDO_SUPPORTED_ARCH
${ALL_SCUDO_SUPPORTED_ARCH})
filter_available_targets(XRAY_SUPPORTED_ARCH ${ALL_XRAY_SUPPORTED_ARCH})
endif()
if (MSVC)
# See if the DIA SDK is available and usable.
set(MSVC_DIA_SDK_DIR "$ENV{VSINSTALLDIR}DIA SDK")
if (IS_DIRECTORY ${MSVC_DIA_SDK_DIR})
set(CAN_SYMBOLIZE 1)
else()
set(CAN_SYMBOLIZE 0)
endif()
else()
set(CAN_SYMBOLIZE 1)
endif()
find_program(GOLD_EXECUTABLE NAMES ${LLVM_DEFAULT_TARGET_TRIPLE}-ld.gold ld.gold ${LLVM_DEFAULT_TARGET_TRIPLE}-ld ld DOC "The gold linker")
message(STATUS "Compiler-RT supported architectures: ${COMPILER_RT_SUPPORTED_ARCH}")
if(ANDROID)
set(OS_NAME "Android")
else()
set(OS_NAME "${CMAKE_SYSTEM_NAME}")
endif()
set(ALL_SANITIZERS asan;dfsan;msan;tsan;safestack;cfi;esan;scudo)
set(COMPILER_RT_SANITIZERS_TO_BUILD ${ALL_SANITIZERS} CACHE STRING
"sanitizers to build if supported on the target (all;${ALL_SANITIZERS})")
list_replace(COMPILER_RT_SANITIZERS_TO_BUILD all "${ALL_SANITIZERS}")
if (SANITIZER_COMMON_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
(OS_NAME MATCHES "Android|Darwin|Linux|FreeBSD" OR
(OS_NAME MATCHES "Windows" AND (NOT MINGW AND NOT CYGWIN))))
set(COMPILER_RT_HAS_SANITIZER_COMMON TRUE)
else()
set(COMPILER_RT_HAS_SANITIZER_COMMON FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON)
set(COMPILER_RT_HAS_INTERCEPTION TRUE)
else()
set(COMPILER_RT_HAS_INTERCEPTION FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ASAN_SUPPORTED_ARCH)
set(COMPILER_RT_HAS_ASAN TRUE)
else()
set(COMPILER_RT_HAS_ASAN FALSE)
endif()
if (OS_NAME MATCHES "Linux|FreeBSD|Windows")
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME TRUE)
else()
set(COMPILER_RT_ASAN_HAS_STATIC_RUNTIME FALSE)
endif()
# TODO: Add builtins support.
if (COMPILER_RT_HAS_SANITIZER_COMMON AND DFSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_DFSAN TRUE)
else()
set(COMPILER_RT_HAS_DFSAN FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND LSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux|FreeBSD")
set(COMPILER_RT_HAS_LSAN TRUE)
else()
set(COMPILER_RT_HAS_LSAN FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND MSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_MSAN TRUE)
else()
set(COMPILER_RT_HAS_MSAN FALSE)
endif()
if (PROFILE_SUPPORTED_ARCH AND NOT LLVM_USE_SANITIZER AND
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows")
set(COMPILER_RT_HAS_PROFILE TRUE)
else()
set(COMPILER_RT_HAS_PROFILE FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND TSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
set(COMPILER_RT_HAS_TSAN TRUE)
else()
set(COMPILER_RT_HAS_TSAN FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Darwin|Linux|FreeBSD|Windows")
set(COMPILER_RT_HAS_UBSAN TRUE)
else()
set(COMPILER_RT_HAS_UBSAN FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SAFESTACK_SUPPORTED_ARCH AND
OS_NAME MATCHES "Darwin|Linux|FreeBSD")
set(COMPILER_RT_HAS_SAFESTACK TRUE)
else()
set(COMPILER_RT_HAS_SAFESTACK FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND CFI_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_CFI TRUE)
else()
set(COMPILER_RT_HAS_CFI FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND ESAN_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_ESAN TRUE)
else()
set(COMPILER_RT_HAS_ESAN FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND SCUDO_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_SCUDO TRUE)
else()
set(COMPILER_RT_HAS_SCUDO FALSE)
endif()
if (COMPILER_RT_HAS_SANITIZER_COMMON AND XRAY_SUPPORTED_ARCH AND
OS_NAME MATCHES "Linux")
set(COMPILER_RT_HAS_XRAY TRUE)
else()
set(COMPILER_RT_HAS_XRAY FALSE)
endif()
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/builtin-config-ix.cmake 0000664 0001750 0001750 00000013720 12756660653 026635 0 ustar mwhudson mwhudson include(BuiltinTests)
include(CheckCSourceCompiles)
# Make all the tests only check the compiler
set(TEST_COMPILE_ONLY On)
builtin_check_c_compiler_flag(-fPIC COMPILER_RT_HAS_FPIC_FLAG)
builtin_check_c_compiler_flag(-fPIE COMPILER_RT_HAS_FPIE_FLAG)
builtin_check_c_compiler_flag(-fno-builtin COMPILER_RT_HAS_FNO_BUILTIN_FLAG)
builtin_check_c_compiler_flag(-std=c99 COMPILER_RT_HAS_STD_C99_FLAG)
builtin_check_c_compiler_flag(-fvisibility=hidden COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG)
builtin_check_c_compiler_flag(-fomit-frame-pointer COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG)
builtin_check_c_compiler_flag(-ffreestanding COMPILER_RT_HAS_FREESTANDING_FLAG)
builtin_check_c_compiler_source(COMPILER_RT_HAS_ATOMIC_KEYWORD
"
int foo(int x, int y) {
_Atomic int result = x * y;
return result;
}
")
set(ARM64 aarch64)
set(ARM32 arm armhf)
set(X86 i386 i686)
set(X86_64 x86_64)
set(MIPS32 mips mipsel)
set(MIPS64 mips64 mips64el)
set(PPC64 powerpc64 powerpc64le)
set(WASM32 wasm32)
set(WASM64 wasm64)
if(APPLE)
set(ARM64 arm64)
set(ARM32 armv7 armv7k armv7s)
set(X86_64 x86_64 x86_64h)
endif()
set(ALL_BUILTIN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
${MIPS32} ${MIPS64} ${WASM32} ${WASM64})
include(CompilerRTUtils)
include(CompilerRTDarwinUtils)
if(APPLE)
find_darwin_sdk_dir(DARWIN_osx_SYSROOT macosx)
find_darwin_sdk_dir(DARWIN_iossim_SYSROOT iphonesimulator)
find_darwin_sdk_dir(DARWIN_ios_SYSROOT iphoneos)
find_darwin_sdk_dir(DARWIN_watchossim_SYSROOT watchsimulator)
find_darwin_sdk_dir(DARWIN_watchos_SYSROOT watchos)
find_darwin_sdk_dir(DARWIN_tvossim_SYSROOT appletvsimulator)
find_darwin_sdk_dir(DARWIN_tvos_SYSROOT appletvos)
set(DARWIN_EMBEDDED_PLATFORMS)
set(DARWIN_osx_BUILTIN_MIN_VER 10.5)
set(DARWIN_osx_BUILTIN_MIN_VER_FLAG
-mmacosx-version-min=${DARWIN_osx_BUILTIN_MIN_VER})
if(COMPILER_RT_ENABLE_IOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS ios)
set(DARWIN_ios_MIN_VER_FLAG -miphoneos-version-min)
set(DARWIN_ios_BUILTIN_MIN_VER 6.0)
set(DARWIN_ios_BUILTIN_MIN_VER_FLAG
${DARWIN_ios_MIN_VER_FLAG}=${DARWIN_ios_BUILTIN_MIN_VER})
endif()
if(COMPILER_RT_ENABLE_WATCHOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS watchos)
set(DARWIN_watchos_MIN_VER_FLAG -mwatchos-version-min)
set(DARWIN_watchos_BUILTIN_MIN_VER 2.0)
set(DARWIN_watchos_BUILTIN_MIN_VER_FLAG
${DARWIN_watchos_MIN_VER_FLAG}=${DARWIN_watchos_BUILTIN_MIN_VER})
endif()
if(COMPILER_RT_ENABLE_TVOS)
list(APPEND DARWIN_EMBEDDED_PLATFORMS tvos)
set(DARWIN_tvos_MIN_VER_FLAG -mtvos-version-min)
set(DARWIN_tvos_BUILTIN_MIN_VER 9.0)
set(DARWIN_tvos_BUILTIN_MIN_VER_FLAG
${DARWIN_tvos_MIN_VER_FLAG}=${DARWIN_tvos_BUILTIN_MIN_VER})
endif()
set(BUILTIN_SUPPORTED_OS osx)
# We're setting the flag manually for each target OS
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
if(NOT DARWIN_osx_ARCHS)
set(DARWIN_osx_ARCHS i386 x86_64 x86_64h)
endif()
set(DARWIN_sim_ARCHS i386 x86_64)
set(DARWIN_device_ARCHS armv7 armv7s armv7k arm64)
message(STATUS "OSX supported arches: ${DARWIN_osx_ARCHS}")
foreach(arch ${DARWIN_osx_ARCHS})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
set(CAN_TARGET_${arch} 1)
endforeach()
# Need to build a 10.4 compatible libclang_rt
set(DARWIN_10.4_SYSROOT ${DARWIN_osx_SYSROOT})
set(DARWIN_10.4_BUILTIN_MIN_VER 10.4)
set(DARWIN_10.4_BUILTIN_MIN_VER_FLAG
-mmacosx-version-min=${DARWIN_10.4_BUILTIN_MIN_VER})
set(DARWIN_10.4_SKIP_CC_KEXT On)
darwin_test_archs(10.4 DARWIN_10.4_ARCHS i386 x86_64)
message(STATUS "OSX 10.4 supported builtin arches: ${DARWIN_10.4_ARCHS}")
if(DARWIN_10.4_ARCHS)
# don't include the Haswell slice in the 10.4 compatibility library
list(REMOVE_ITEM DARWIN_10.4_ARCHS x86_64h)
list(APPEND BUILTIN_SUPPORTED_OS 10.4)
endif()
foreach(platform ${DARWIN_EMBEDDED_PLATFORMS})
if(DARWIN_${platform}sim_SYSROOT)
set(DARWIN_${platform}sim_BUILTIN_MIN_VER
${DARWIN_${platform}_BUILTIN_MIN_VER})
set(DARWIN_${platform}sim_BUILTIN_MIN_VER_FLAG
${DARWIN_${platform}_BUILTIN_MIN_VER_FLAG})
set(DARWIN_${platform}sim_SKIP_CC_KEXT On)
set(test_arches ${DARWIN_sim_ARCHS})
if(DARWIN_${platform}sim_ARCHS)
set(test_arches DARWIN_${platform}sim_ARCHS)
endif()
darwin_test_archs(${platform}sim
DARWIN_${platform}sim_ARCHS
${test_arches})
message(STATUS "${platform} Simulator supported builtin arches: ${DARWIN_${platform}sim_ARCHS}")
if(DARWIN_${platform}sim_ARCHS)
list(APPEND BUILTIN_SUPPORTED_OS ${platform}sim)
endif()
foreach(arch ${DARWIN_${platform}sim_ARCHS})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
set(CAN_TARGET_${arch} 1)
endforeach()
endif()
if(DARWIN_${platform}_SYSROOT)
set(test_arches ${DARWIN_device_ARCHS})
if(DARWIN_${platform}_ARCHS)
set(test_arches DARWIN_${platform}_ARCHS)
endif()
darwin_test_archs(${platform}
DARWIN_${platform}_ARCHS
${test_arches})
message(STATUS "${platform} supported builtin arches: ${DARWIN_${platform}_ARCHS}")
if(DARWIN_${platform}_ARCHS)
list(APPEND BUILTIN_SUPPORTED_OS ${platform})
endif()
foreach(arch ${DARWIN_${platform}_ARCHS})
list(APPEND COMPILER_RT_SUPPORTED_ARCH ${arch})
set(CAN_TARGET_${arch} 1)
endforeach()
endif()
endforeach()
list_intersect(BUILTIN_SUPPORTED_ARCH ALL_BUILTIN_SUPPORTED_ARCH COMPILER_RT_SUPPORTED_ARCH)
else()
# If we're not building the builtins standalone, just rely on the tests in
# config-ix.cmake to tell us what to build. Otherwise we need to do some leg
# work here...
if(COMPILER_RT_BUILTINS_STANDALONE_BUILD)
test_targets()
endif()
# Architectures supported by compiler-rt libraries.
filter_available_targets(BUILTIN_SUPPORTED_ARCH
${ALL_BUILTIN_SUPPORTED_ARCH})
endif()
message(STATUS "Builtin supported architectures: ${BUILTIN_SUPPORTED_ARCH}")
golang-1.8-race-detector-runtime_0.0+svn285455/cmake/caches/ 0000775 0001750 0001750 00000000000 13040224625 023505 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/cmake/caches/Apple.cmake 0000664 0001750 0001750 00000001430 12710452535 025554 0 ustar mwhudson mwhudson # This file sets up a CMakeCache for Apple-style builds of compiler-rt.
# This configuration matches Apple uses when shipping Xcode releases.
set(COMPILER_RT_INCLUDE_TESTS OFF CACHE BOOL "")
set(COMPILER_RT_HAS_SAFESTACK OFF CACHE BOOL "")
set(COMPILER_RT_EXTERNALIZE_DEBUGINFO ON CACHE BOOL "")
set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
set(CMAKE_C_FLAGS_RELEASE "-O3" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELEASE "-O3" CACHE STRING "")
set(CMAKE_ASM_FLAGS_RELEASE "-O3" CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "-O3 -gline-tables-only -DNDEBUG" CACHE STRING "")
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
golang-1.8-race-detector-runtime_0.0+svn285455/CMakeLists.txt 0000664 0001750 0001750 00000024611 12776132747 023765 0 ustar mwhudson mwhudson # CMake build for CompilerRT.
#
# This build assumes that CompilerRT is checked out into the
# 'projects/compiler-rt' or 'runtimes/compiler-rt' inside of an LLVM tree.
# Standalone build system for CompilerRT is not yet ready.
#
# An important constraint of the build is that it only produces libraries
# based on the ability of the host toolchain to target various platforms.
# Check if compiler-rt is built as a standalone project.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
project(CompilerRT C CXX ASM)
set(COMPILER_RT_STANDALONE_BUILD TRUE)
endif()
cmake_minimum_required(VERSION 3.4.3)
# FIXME:
# The OLD behavior (pre 3.2) for this policy is to not set the value of the
# CMAKE_EXE_LINKER_FLAGS variable in the generated test project. The NEW behavior
# for this policy is to set the value of the CMAKE_EXE_LINKER_FLAGS variable
# in the test project to the same as it is in the calling project. The new
# behavior cause the compiler_rt test to fail during try_compile: see
# projects/compiler-rt/cmake/Modules/CompilerRTUtils.cmake:121 such that
# CAN_TARGET_${arch} is not set properly. This results in COMPILER_RT_SUPPORTED_ARCH
# not being updated properly leading to poblems.
cmake_policy(SET CMP0056 OLD)
# Add path for custom compiler-rt modules.
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
include(base-config-ix)
include(CompilerRTUtils)
option(COMPILER_RT_BUILD_BUILTINS "Build builtins" ON)
mark_as_advanced(COMPILER_RT_BUILD_BUILTINS)
option(COMPILER_RT_BUILD_SANITIZERS "Build sanitizers" ON)
mark_as_advanced(COMPILER_RT_BUILD_SANITIZERS)
option(COMPILER_RT_BUILD_XRAY "Build xray" ON)
mark_as_advanced(COMPILER_RT_BUILD_XRAY)
if (COMPILER_RT_STANDALONE_BUILD)
load_llvm_config()
# Find Python interpreter.
set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
include(FindPythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "
Unable to find Python interpreter required testing. Please install Python
or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
# Define default arguments to lit.
set(LIT_ARGS_DEFAULT "-sv")
if (MSVC OR XCODE)
set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
endif()
set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
endif()
construct_compiler_rt_default_triple()
if ("${COMPILER_RT_DEFAULT_TARGET_ABI}" STREQUAL "androideabi")
set(ANDROID 1)
endif()
set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
# We support running instrumented tests when we're not cross compiling
# and target a UNIX-like system or Windows.
# We can run tests on Android even when we are cross-compiling.
if(("${CMAKE_HOST_SYSTEM}" STREQUAL "${CMAKE_SYSTEM}" AND (UNIX OR WIN32)) OR ANDROID
OR COMPILER_RT_EMULATOR)
option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" ON)
else()
option(COMPILER_RT_CAN_EXECUTE_TESTS "Can we execute instrumented tests" OFF)
endif()
option(COMPILER_RT_DEBUG "Build runtimes with full debug info" OFF)
option(COMPILER_RT_EXTERNALIZE_DEBUGINFO
"Generate dSYM files and strip executables and libraries (Darwin Only)" OFF)
# COMPILER_RT_DEBUG_PYBOOL is used by lit.common.configured.in.
pythonize_bool(COMPILER_RT_DEBUG)
include(config-ix)
if(APPLE AND SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.9")
# Mac OS X prior to 10.9 had problems with exporting symbols from
# libc++/libc++abi.
set(use_cxxabi_default OFF)
elseif(MSVC)
set(use_cxxabi_default OFF)
else()
set(use_cxxabi_default ON)
endif()
option(SANITIZER_CAN_USE_CXXABI "Sanitizers can use cxxabi" ${use_cxxabi_default})
pythonize_bool(SANITIZER_CAN_USE_CXXABI)
#================================
# Setup Compiler Flags
#================================
if(MSVC)
# Override any existing /W flags with /W4. This is what LLVM does. Failing to
# remove other /W[0-4] flags will result in a warning about overriding a
# previous flag.
if (COMPILER_RT_HAS_W4_FLAG)
string(REGEX REPLACE " /W[0-4]" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REGEX REPLACE " /W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
append_string_if(COMPILER_RT_HAS_W4_FLAG /W4 CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
else()
append_string_if(COMPILER_RT_HAS_WALL_FLAG -Wall CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
if(COMPILER_RT_ENABLE_WERROR)
append_string_if(COMPILER_RT_HAS_WERROR_FLAG -Werror CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
append_string_if(COMPILER_RT_HAS_WX_FLAG /WX CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
append_string_if(COMPILER_RT_HAS_STD_CXX11_FLAG -std=c++11 CMAKE_CXX_FLAGS)
# Emulate C99 and C++11's __func__ for MSVC prior to 2013 CTP.
if(NOT COMPILER_RT_HAS_FUNC_SYMBOL)
add_definitions(-D__func__=__FUNCTION__)
endif()
# Provide some common commmandline flags for Sanitizer runtimes.
if(NOT WIN32)
append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC SANITIZER_COMMON_CFLAGS)
endif()
append_list_if(COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions SANITIZER_COMMON_CFLAGS)
if(NOT COMPILER_RT_DEBUG)
append_list_if(COMPILER_RT_HAS_FOMIT_FRAME_POINTER_FLAG -fomit-frame-pointer SANITIZER_COMMON_CFLAGS)
endif()
append_list_if(COMPILER_RT_HAS_FUNWIND_TABLES_FLAG -funwind-tables SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FNO_STACK_PROTECTOR_FLAG -fno-stack-protector SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FNO_SANITIZE_SAFE_STACK_FLAG -fno-sanitize=safe-stack SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FVISIBILITY_HIDDEN_FLAG -fvisibility=hidden SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FVISIBILITY_INLINES_HIDDEN_FLAG -fvisibility-inlines-hidden SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FNO_FUNCTION_SECTIONS_FLAG -fno-function-sections SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_FNO_LTO_FLAG -fno-lto SANITIZER_COMMON_CFLAGS)
if(MSVC)
# Replace the /M[DT][d] flags with /MT, and strip any definitions of _DEBUG,
# which cause definition mismatches at link time.
# FIXME: In fact, sanitizers should support both /MT and /MD, see PR20214.
if(COMPILER_RT_HAS_MT_FLAG)
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
string(REGEX REPLACE "/M[DT]d" "/MT" ${flag_var} "${${flag_var}}")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
string(REGEX REPLACE "/D_DEBUG" "" ${flag_var} "${${flag_var}}")
endforeach()
endif()
append_list_if(COMPILER_RT_HAS_Oy_FLAG /Oy- SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS)
# VS 2015 (version 1900) added support for thread safe static initialization.
# However, ASan interceptors run before CRT initialization, which causes the
# new thread safe code to crash. Disable this feature for now.
if (MSVC_VERSION GREATER 1899 OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
list(APPEND SANITIZER_COMMON_CFLAGS /Zc:threadSafeInit-)
endif()
endif()
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS)
# Build with optimization, unless we're in debug mode. If we're using MSVC,
# always respect the optimization flags set by CMAKE_BUILD_TYPE instead.
if(NOT COMPILER_RT_DEBUG AND NOT MSVC)
list(APPEND SANITIZER_COMMON_CFLAGS -O3)
endif()
# Determine if we should restrict stack frame sizes.
# Stack frames on PowerPC and Mips and in debug biuld can be much larger than
# anticipated.
# FIXME: Fix all sanitizers and add -Wframe-larger-than to
# SANITIZER_COMMON_FLAGS
if(COMPILER_RT_HAS_WFRAME_LARGER_THAN_FLAG AND NOT COMPILER_RT_DEBUG
AND NOT ${COMPILER_RT_DEFAULT_TARGET_ARCH} MATCHES "powerpc|mips")
set(SANITIZER_LIMIT_FRAME_SIZE TRUE)
else()
set(SANITIZER_LIMIT_FRAME_SIZE FALSE)
endif()
# Build sanitizer runtimes with debug info.
if(COMPILER_RT_HAS_GLINE_TABLES_ONLY_FLAG AND NOT COMPILER_RT_DEBUG)
list(APPEND SANITIZER_COMMON_CFLAGS -gline-tables-only)
elseif(COMPILER_RT_HAS_G_FLAG)
list(APPEND SANITIZER_COMMON_CFLAGS -g)
elseif(MSVC)
# Use /Z7 instead of /Zi for the asan runtime. This avoids the LNK4099
# warning from the MS linker complaining that it can't find the 'vc140.pdb'
# file used by our object library compilations.
list(APPEND SANITIZER_COMMON_CFLAGS /Z7)
llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/Z[i7I]" "/Z7")
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_DEBUG "/Z[i7I]" "/Z7")
llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z[i7I]" "/Z7")
endif()
if(LLVM_ENABLE_MODULES)
# Sanitizers cannot be built with -fmodules. The interceptors intentionally
# don't include system headers, which is incompatible with modules.
list(APPEND SANITIZER_COMMON_CFLAGS -fno-modules)
endif()
# Turn off several warnings.
append_list_if(COMPILER_RT_HAS_WGNU_FLAG -Wno-gnu SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WVARIADIC_MACROS_FLAG -Wno-variadic-macros SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WC99_EXTENSIONS_FLAG -Wno-c99-extensions SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WNON_VIRTUAL_DTOR_FLAG -Wno-non-virtual-dtor SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WD4146_FLAG /wd4146 SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WD4291_FLAG /wd4291 SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WD4391_FLAG /wd4391 SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WD4722_FLAG /wd4722 SANITIZER_COMMON_CFLAGS)
append_list_if(COMPILER_RT_HAS_WD4800_FLAG /wd4800 SANITIZER_COMMON_CFLAGS)
# Warnings to turn off for all libraries, not just sanitizers.
append_string_if(COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG -Wno-unused-parameter CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
add_subdirectory(include)
set(COMPILER_RT_LIBCXX_PATH ${LLVM_MAIN_SRC_DIR}/projects/libcxx)
if(EXISTS ${COMPILER_RT_LIBCXX_PATH}/)
set(COMPILER_RT_HAS_LIBCXX_SOURCES TRUE)
else()
set(COMPILER_RT_HAS_LIBCXX_SOURCES FALSE)
endif()
set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
if(EXISTS ${COMPILER_RT_LLD_PATH}/)
set(COMPILER_RT_HAS_LLD_SOURCES TRUE)
else()
set(COMPILER_RT_HAS_LLD_SOURCES FALSE)
endif()
pythonize_bool(COMPILER_RT_HAS_LLD_SOURCES)
add_subdirectory(lib)
if(COMPILER_RT_INCLUDE_TESTS)
add_subdirectory(unittests)
add_subdirectory(test)
endif()
golang-1.8-race-detector-runtime_0.0+svn285455/test/ 0000775 0001750 0001750 00000000000 13040224625 022156 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/ 0000775 0001750 0001750 00000000000 13040224625 023266 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/CMakeLists.txt 0000664 0001750 0001750 00000003757 12741012374 026045 0 ustar mwhudson mwhudson set(UBSAN_LIT_TESTS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(UBSAN_TESTSUITES)
set(UBSAN_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
macro(add_ubsan_testsuite test_mode sanitizer arch)
set(UBSAN_LIT_TEST_MODE "${test_mode}")
set(CONFIG_NAME ${UBSAN_LIT_TEST_MODE}-${arch})
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg)
list(APPEND UBSAN_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND UBSAN_TEST_DEPS ${sanitizer})
endif()
endmacro()
set(UBSAN_TEST_ARCH ${UBSAN_SUPPORTED_ARCH})
if(APPLE)
darwin_filter_host_archs(UBSAN_SUPPORTED_ARCH UBSAN_TEST_ARCH)
endif()
foreach(arch ${UBSAN_TEST_ARCH})
set(UBSAN_TEST_TARGET_ARCH ${arch})
if(${arch} MATCHES "arm|aarch64")
# This is only true if we're cross-compiling.
set(UBSAN_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
else()
get_target_flags_for_arch(${arch} UBSAN_TEST_TARGET_CFLAGS)
string(REPLACE ";" " " UBSAN_TEST_TARGET_CFLAGS "${UBSAN_TEST_TARGET_CFLAGS}")
endif()
add_ubsan_testsuite("Standalone" ubsan ${arch})
if(COMPILER_RT_HAS_ASAN AND ";${ASAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
# TODO(wwchrome): Re-enable ubsan for asan win 64-bit when ready.
# Disable ubsan with AddressSanitizer tests for Windows 64-bit.
if(NOT OS_NAME MATCHES "Windows" OR CMAKE_SIZEOF_VOID_P EQUAL 4)
add_ubsan_testsuite("AddressSanitizer" asan ${arch})
endif()
endif()
if(COMPILER_RT_HAS_MSAN AND ";${MSAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
add_ubsan_testsuite("MemorySanitizer" msan ${arch})
endif()
if(COMPILER_RT_HAS_TSAN AND ";${TSAN_SUPPORTED_ARCH};" MATCHES ";${arch};")
add_ubsan_testsuite("ThreadSanitizer" tsan ${arch})
endif()
endforeach()
add_lit_testsuite(check-ubsan "Running UndefinedBehaviorSanitizer tests"
${UBSAN_TESTSUITES}
DEPENDS ${UBSAN_TEST_DEPS})
set_target_properties(check-ubsan PROPERTIES FOLDER "Compiler-RT Misc")
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/lit.site.cfg.in 0000664 0001750 0001750 00000000737 12704361721 026123 0 ustar mwhudson mwhudson @LIT_SITE_CFG_IN_HEADER@
# Tool-specific config options.
config.ubsan_lit_test_mode = "@UBSAN_LIT_TEST_MODE@"
config.target_cflags = "@UBSAN_TEST_TARGET_CFLAGS@"
config.target_arch = "@UBSAN_TEST_TARGET_ARCH@"
# Load common config for all compiler-rt lit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
# Load tool-specific config that would do the real work.
lit_config.load_config(config, "@UBSAN_LIT_TESTS_DIR@/lit.common.cfg")
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/lit.common.cfg 0000664 0001750 0001750 00000006100 12653727130 026033 0 ustar mwhudson mwhudson # -*- Python -*-
import os
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
if attr_value == None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
"to lit.site.cfg " % attr_name)
return attr_value
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
default_ubsan_opts = []
# Choose between standalone and UBSan+ASan modes.
ubsan_lit_test_mode = get_required_attr(config, 'ubsan_lit_test_mode')
if ubsan_lit_test_mode == "Standalone":
config.name = 'UBSan-Standalone-' + config.target_arch
config.available_features.add("ubsan-standalone")
clang_ubsan_cflags = []
elif ubsan_lit_test_mode == "AddressSanitizer":
config.name = 'UBSan-ASan-' + config.target_arch
config.available_features.add("ubsan-asan")
clang_ubsan_cflags = ["-fsanitize=address"]
default_ubsan_opts += ['detect_leaks=0']
elif ubsan_lit_test_mode == "MemorySanitizer":
config.name = 'UBSan-MSan-' + config.target_arch
config.available_features.add("ubsan-msan")
clang_ubsan_cflags = ["-fsanitize=memory"]
elif ubsan_lit_test_mode == "ThreadSanitizer":
config.name = 'UBSan-TSan-' + config.target_arch
config.available_features.add("ubsan-tsan")
clang_ubsan_cflags = ["-fsanitize=thread"]
else:
lit_config.fatal("Unknown UBSan test mode: %r" % ubsan_lit_test_mode)
# Platform-specific default for lit tests.
if config.host_os == 'Darwin':
# On Darwin, we default to `abort_on_error=1`, which would make tests run
# much slower. Let's override this and run lit tests with 'abort_on_error=0'.
default_ubsan_opts += ['abort_on_error=0']
default_ubsan_opts += ['log_to_syslog=0']
default_ubsan_opts_str = ':'.join(default_ubsan_opts)
if default_ubsan_opts_str:
config.environment['UBSAN_OPTIONS'] = default_ubsan_opts_str
default_ubsan_opts_str += ':'
# Substitution to setup UBSAN_OPTIONS in portable way.
config.substitutions.append(('%env_ubsan_opts=',
'env UBSAN_OPTIONS=' + default_ubsan_opts_str))
def build_invocation(compile_flags):
return " " + " ".join([config.clang] + compile_flags) + " "
target_cflags = [get_required_attr(config, "target_cflags")]
clang_ubsan_cflags += target_cflags
clang_ubsan_cxxflags = config.cxx_mode_flags + clang_ubsan_cflags
# Define %clang and %clangxx substitutions to use in test RUN lines.
config.substitutions.append( ("%clang ", build_invocation(clang_ubsan_cflags)) )
config.substitutions.append( ("%clangxx ", build_invocation(clang_ubsan_cxxflags)) )
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
# Check that the host supports UndefinedBehaviorSanitizer tests
if config.host_os not in ['Linux', 'Darwin', 'FreeBSD', 'Windows']:
config.unsupported = True
# Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL
# because the test hangs or fails on one configuration and not the other.
if config.target_arch.startswith('arm') == False and config.target_arch != 'aarch64':
config.available_features.add('stable-runtime')
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/ 0000775 0001750 0001750 00000000000 13040224625 025164 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/ 0000775 0001750 0001750 00000000000 13040224625 027043 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/Function/ 0000775 0001750 0001750 00000000000 13040224625 030630 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg0000664 0001750 0001750 00000000230 12231045512 033162 0 ustar mwhudson mwhudson # The function type checker is only supported on x86 and x86_64 for now.
if config.root.host_arch not in ['x86', 'x86_64']:
config.unsupported = True
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/Function/function.cpp 0000664 0001750 0001750 00000002275 12567135630 033201 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=function %s -O3 -g -o %t
// RUN: %run %t 2>&1 | FileCheck %s
// Verify that we can disable symbolization if needed:
// RUN: %env_ubsan_opts=symbolize=0 %run %t 2>&1 | FileCheck %s --check-prefix=NOSYM
// -fsanitize=function is unsupported on Darwin yet.
// XFAIL: darwin
#include
void f() {}
void g(int x) {}
void make_valid_call() {
// CHECK-NOT: runtime error: call to function g
reinterpret_cast(reinterpret_cast(g))(42);
}
void make_invalid_call() {
// CHECK: function.cpp:25:3: runtime error: call to function f() through pointer to incorrect function type 'void (*)(int)'
// CHECK-NEXT: function.cpp:11: note: f() defined here
// NOSYM: function.cpp:25:3: runtime error: call to function (unknown) through pointer to incorrect function type 'void (*)(int)'
// NOSYM-NEXT: ({{.*}}+0x{{.*}}): note: (unknown) defined here
reinterpret_cast(reinterpret_cast(f))(42);
}
int main(void) {
make_valid_call();
make_invalid_call();
// Check that no more errors will be printed.
// CHECK-NOT: runtime error: call to function
// NOSYM-NOT: runtime error: call to function
make_invalid_call();
}
././@LongLink 0000644 0000000 0000000 00000000160 00000000000 011600 L ustar root root golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-itanium.cpp golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-corrupted-vtable-0000664 0001750 0001750 00000002461 12724076234 033332 0 ustar mwhudson mwhudson // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-CORRUPTED-VTABLE --strict-whitespace
// UNSUPPORTED: win32
// REQUIRES: stable-runtime, cxxabi
#include
#include
struct S {
S() {}
~S() {}
virtual int v() { return 0; }
};
// See the proper definition in ubsan_type_hash_itanium.cc
struct VtablePrefix {
signed long Offset;
std::type_info *TypeInfo;
};
int main(int argc, char **argv) {
// Test that we don't crash on corrupted vtable when
// offset is too large or too small.
S Obj;
void *Ptr = &Obj;
VtablePrefix* RealPrefix = reinterpret_cast(
*reinterpret_cast(Ptr)) - 1;
VtablePrefix Prefix[2];
Prefix[0].Offset = 1<<21; // Greater than VptrMaxOffset
Prefix[0].TypeInfo = RealPrefix->TypeInfo;
// Hack Vtable ptr for Obj.
*reinterpret_cast(Ptr) = static_cast(&Prefix[1]);
// CHECK-CORRUPTED-VTABLE: vptr-corrupted-vtable-itanium.cpp:[[@LINE+3]]:16: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'S'
// CHECK-CORRUPTED-VTABLE-NEXT: [[PTR]]: note: object has a possibly invalid vptr: abs(offset to top) too big
S* Ptr2 = reinterpret_cast(Ptr);
return Ptr2->v();
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/Helpers/ 0000775 0001750 0001750 00000000000 13040224625 030445 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr.cpp 0000664 0001750 0001750 00000016654 13004151634 030555 0 ustar mwhudson mwhudson // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t -mllvm -enable-tail-merge=false
// RUN: %run %t rT && %run %t mT && %run %t fT && %run %t cT
// RUN: %run %t rU && %run %t mU && %run %t fU && %run %t cU
// RUN: %run %t rS && %run %t rV && %run %t oV
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fS 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cS 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t mV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER --check-prefix=CHECK-%os-MEMBER --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t fV 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t cV 2>&1 | FileCheck %s --check-prefix=CHECK-DOWNCAST --check-prefix=CHECK-%os-DOWNCAST --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t oU 2>&1 | FileCheck %s --check-prefix=CHECK-OFFSET --check-prefix=CHECK-%os-OFFSET --strict-whitespace
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t m0 2>&1 | FileCheck %s --check-prefix=CHECK-NULL-MEMBER --check-prefix=CHECK-%os-NULL-MEMBER --strict-whitespace
// RUN: (echo "vptr_check:S"; echo "vptr_check:T"; echo "vptr_check:U") > %t.supp
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mS
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t fS
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t cS
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t mV
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t fV
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t cV
// RUN: %env_ubsan_opts=suppressions='"%t.supp"' %run %t oU
// RUN: echo "vptr_check:S" > %t.loc-supp
// RUN: %env_ubsan_opts=suppressions='"%t.loc-supp"' not %run %t x- 2>&1 | FileCheck %s --check-prefix=CHECK-LOC-SUPPRESS
// REQUIRES: stable-runtime, cxxabi
#include
#include
#include
struct S {
S() : a(0) {}
~S() {}
int a;
int f() { return 0; }
virtual int v() { return 0; }
};
struct T : S {
T() : b(0) {}
int b;
int g() { return 0; }
virtual int v() { return 1; }
};
struct U : S, T { virtual int v() { return 2; } };
struct V : S {};
// Make p global so that lsan does not complain.
T *p = 0;
volatile void *sink1, *sink2;
int access_p(T *p, char type);
int main(int argc, char **argv) {
assert(argc > 1);
fprintf(stderr, "Test case: %s\n", argv[1]);
T t;
(void)t.a;
(void)t.b;
(void)t.f();
(void)t.g();
(void)t.v();
(void)t.S::v();
U u;
(void)u.T::a;
(void)u.b;
(void)u.T::f();
(void)u.g();
(void)u.v();
(void)u.T::v();
(void)((T&)u).S::v();
char Buffer[sizeof(U)] = {};
char TStorage[sizeof(T)];
// Allocate two dummy objects so that the real object
// is not on the boundary of mapped memory. Otherwise ubsan
// will not be able to describe the vptr in detail.
sink1 = new T;
sink2 = new U;
switch (argv[1][1]) {
case '0':
p = reinterpret_cast(Buffer);
break;
case 'S':
// Make sure p points to the memory chunk of sufficient size to prevent ASan
// reports about out-of-bounds access.
p = reinterpret_cast(new(TStorage) S);
break;
case 'T':
p = new T;
break;
case 'U':
p = new U;
break;
case 'V':
p = reinterpret_cast(new U);
break;
}
access_p(p, argv[1][0]);
return 0;
}
int access_p(T *p, char type) {
switch (type) {
case 'r':
// Binding a reference to storage of appropriate size and alignment is OK.
{T &r = *p;}
return 0;
case 'x':
for (int i = 0; i < 2; i++) {
// Check that the first iteration ("S") succeeds, while the second ("V") fails.
p = reinterpret_cast((i == 0) ? new S : new V);
// CHECK-LOC-SUPPRESS: vptr.cpp:[[@LINE+5]]:10: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-LOC-SUPPRESS-NEXT: [[PTR]]: note: object is of type 'V'
// CHECK-LOC-SUPPRESS-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
// CHECK-LOC-SUPPRESS-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
// CHECK-LOC-SUPPRESS-NEXT: {{^ vptr for 'V'}}
p->g();
}
return 0;
case 'm':
// CHECK-MEMBER: vptr.cpp:[[@LINE+6]]:15: runtime error: member access within address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-MEMBER-NEXT: [[PTR]]: note: object is of type [[DYN_TYPE:'S'|'U']]
// CHECK-MEMBER-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
// CHECK-MEMBER-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
// CHECK-MEMBER-NEXT: {{^ vptr for}} [[DYN_TYPE]]
// CHECK-Linux-MEMBER: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
return p->b;
// CHECK-NULL-MEMBER: vptr.cpp:[[@LINE-2]]:15: runtime error: member access within address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-NULL-MEMBER-NEXT: [[PTR]]: note: object has invalid vptr
// CHECK-NULL-MEMBER-NEXT: {{^ ?.. .. .. .. ?00 00 00 00 ?00 00 00 00 ?}}
// CHECK-NULL-MEMBER-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
// CHECK-NULL-MEMBER-NEXT: {{^ invalid vptr}}
// CHECK-Linux-NULL-MEMBER: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE-7]]
case 'f':
// CHECK-MEMFUN: vptr.cpp:[[@LINE+6]]:15: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-MEMFUN-NEXT: [[PTR]]: note: object is of type [[DYN_TYPE:'S'|'U']]
// CHECK-MEMFUN-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
// CHECK-MEMFUN-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
// CHECK-MEMFUN-NEXT: {{^ vptr for}} [[DYN_TYPE]]
// TODO: Add check for stacktrace here.
return p->g();
case 'o':
// CHECK-OFFSET: vptr.cpp:[[@LINE+6]]:37: runtime error: member call on address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'U'
// CHECK-OFFSET-NEXT: 0x{{[0-9a-f]*}}: note: object is base class subobject at offset {{8|16}} within object of type [[DYN_TYPE:'U']]
// CHECK-OFFSET-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }}
// CHECK-OFFSET-NEXT: {{^ \^ ( ~~~~~~~~~~~~)?~~~~~~~~~~~ *$}}
// CHECK-OFFSET-NEXT: {{^ ( )?vptr for}} 'T' base class of [[DYN_TYPE]]
// CHECK-Linux-OFFSET: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
return reinterpret_cast(p)->v() - 2;
case 'c':
// CHECK-DOWNCAST: vptr.cpp:[[@LINE+6]]:11: runtime error: downcast of address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-DOWNCAST-NEXT: [[PTR]]: note: object is of type [[DYN_TYPE:'S'|'U']]
// CHECK-DOWNCAST-NEXT: {{^ .. .. .. .. .. .. .. .. .. .. .. .. }}
// CHECK-DOWNCAST-NEXT: {{^ \^~~~~~~~~~~(~~~~~~~~~~~~)? *$}}
// CHECK-DOWNCAST-NEXT: {{^ vptr for}} [[DYN_TYPE]]
// CHECK-Linux-DOWNCAST: #0 {{.*}}access_p{{.*}}vptr.cpp:[[@LINE+1]]
(void)static_cast(reinterpret_cast(p));
return 0;
}
return 0;
}
././@LongLink 0000644 0000000 0000000 00000000161 00000000000 011601 L ustar root root golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-construction.cpp golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-virtual-base-cons0000664 0001750 0001750 00000000443 12560462622 033325 0 ustar mwhudson mwhudson // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr %s -o %t
// RUN: %run %t
// REQUIRES: cxxabi
int volatile n;
struct A { virtual ~A() {} };
struct B: virtual A {};
struct C: virtual A { ~C() { n = 0; } };
struct D: virtual B, virtual C {};
int main() { delete new D; }
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typeinfo.cpp golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-non-unique-typein0000664 0001750 0001750 00000000660 12665522260 033375 0 ustar mwhudson mwhudson // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -fPIC -shared -o %t-lib.so -DBUILD_SO
// RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -I%p/Helpers -g %s -O3 -o %t %t-lib.so
// RUN: %run %t
//
// REQUIRES: cxxabi
struct X {
virtual ~X() {}
};
X *libCall();
#ifdef BUILD_SO
X *libCall() {
return new X;
}
#else
int main() {
X *px = libCall();
delete px;
}
#endif
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/vptr-virtual-base.cpp 0000664 0001750 0001750 00000001100 12542651006 033131 0 ustar mwhudson mwhudson // RUN: %clangxx -frtti -fsanitize=vptr -fno-sanitize-recover=vptr -g %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// REQUIRES: cxxabi
struct S { virtual int f() { return 0; } };
struct T : virtual S {};
struct Foo { virtual int f() { return 0; } };
int main(int argc, char **argv) {
Foo foo;
T *t = (T*)&foo;
S *s = t;
// CHECK: vptr-virtual-base.cpp:[[@LINE-1]]:10: runtime error: cast to virtual base of address [[PTR:0x[0-9a-f]*]] which does not point to an object of type 'T'
// CHECK-NEXT: [[PTR]]: note: object is of type 'Foo'
return s->f();
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/null.cpp 0000664 0001750 0001750 00000002302 12721434626 030527 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=null %s -O3 -o %t
// RUN: %run %t l 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD
// RUN: %expect_crash %run %t s 2>&1 | FileCheck %s --check-prefix=CHECK-STORE
// RUN: %run %t r 2>&1 | FileCheck %s --check-prefix=CHECK-REFERENCE
// RUN: %run %t m 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
// RUN: %run %t f 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
struct S {
int f() { return 0; }
int k;
};
int main(int, char **argv) {
int *p = 0;
S *s = 0;
(void)*p; // ok!
switch (argv[1][0]) {
case 'l':
// CHECK-LOAD: null.cpp:[[@LINE+1]]:12: runtime error: load of null pointer of type 'int'
return *p;
case 's':
// CHECK-STORE: null.cpp:[[@LINE+1]]:5: runtime error: store to null pointer of type 'int'
*p = 1;
break;
case 'r':
// CHECK-REFERENCE: null.cpp:[[@LINE+1]]:15: runtime error: reference binding to null pointer of type 'int'
{int &r = *p;}
break;
case 'm':
// CHECK-MEMBER: null.cpp:[[@LINE+1]]:15: runtime error: member access within null pointer of type 'S'
return s->k;
case 'f':
// CHECK-MEMFUN: null.cpp:[[@LINE+1]]:15: runtime error: member call on null pointer of type 'S'
return s->f();
}
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/TypeCheck/misaligned.cpp 0000664 0001750 0001750 00000011325 12721434626 031676 0 ustar mwhudson mwhudson // FIXME: This test currently fails on Windows because we use the MSVC linker,
// which throws away DWARF debug info.
// XFAIL: win32
//
// RUN: %clangxx -fsanitize=alignment -g %s -O3 -o %t
// RUN: %run %t l0 && %run %t s0 && %run %t r0 && %run %t m0 && %run %t f0 && %run %t n0 && %run %t u0
// RUN: %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --strict-whitespace
// RUN: %run %t s1 2>&1 | FileCheck %s --check-prefix=CHECK-STORE
// RUN: %run %t r1 2>&1 | FileCheck %s --check-prefix=CHECK-REFERENCE
// RUN: %run %t m1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
// RUN: %run %t f1 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
// RUN: %run %t n1 2>&1 | FileCheck %s --check-prefix=CHECK-NEW
// RUN: %run %t u1 2>&1 | FileCheck %s --check-prefix=CHECK-UPCAST
// RUN: %env_ubsan_opts=print_stacktrace=1 %run %t l1 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD --check-prefix=CHECK-%os-STACK-LOAD
// RUN: %clangxx -fsanitize=alignment -fno-sanitize-recover=alignment %s -O3 -o %t
// RUN: not %run %t w1 2>&1 | FileCheck %s --check-prefix=CHECK-WILD
#include
struct S {
S() {}
int f() { return 0; }
int k;
};
struct T : S {
int t;
};
int main(int, char **argv) {
char c[] __attribute__((aligned(8))) = { 0, 0, 0, 0, 1, 2, 3, 4, 5 };
// Pointer value may be unspecified here, but behavior is not undefined.
int *p = (int*)&c[4 + argv[1][1] - '0'];
S *s = (S*)p;
T *t = (T*)p;
void *wild = reinterpret_cast(0x123L);
(void)*p; // ok!
switch (argv[1][0]) {
case 'l':
// CHECK-LOAD: misaligned.cpp:[[@LINE+4]]{{(:12)?}}: runtime error: load of misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment
// CHECK-LOAD-NEXT: [[PTR]]: note: pointer points here
// CHECK-LOAD-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-LOAD-NEXT: {{^ \^}}
return *p && 0;
// Slow stack unwinding is disabled on Darwin for now, see
// https://code.google.com/p/address-sanitizer/issues/detail?id=137
// CHECK-Linux-STACK-LOAD: #0 {{.*}}main{{.*}}misaligned.cpp
// Check for the already checked line to avoid lit error reports.
// CHECK-Darwin-STACK-LOAD: {{ }}
case 's':
// CHECK-STORE: misaligned.cpp:[[@LINE+4]]{{(:5)?}}: runtime error: store to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment
// CHECK-STORE-NEXT: [[PTR]]: note: pointer points here
// CHECK-STORE-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-STORE-NEXT: {{^ \^}}
*p = 1;
break;
case 'r':
// CHECK-REFERENCE: misaligned.cpp:[[@LINE+4]]{{(:(5|15))?}}: runtime error: reference binding to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int', which requires 4 byte alignment
// CHECK-REFERENCE-NEXT: [[PTR]]: note: pointer points here
// CHECK-REFERENCE-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-REFERENCE-NEXT: {{^ \^}}
{int &r = *p;}
break;
case 'm':
// CHECK-MEMBER: misaligned.cpp:[[@LINE+4]]{{(:15)?}}: runtime error: member access within misaligned address [[PTR:0x[0-9a-f]*]] for type 'S', which requires 4 byte alignment
// CHECK-MEMBER-NEXT: [[PTR]]: note: pointer points here
// CHECK-MEMBER-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-MEMBER-NEXT: {{^ \^}}
return s->k && 0;
case 'f':
// CHECK-MEMFUN: misaligned.cpp:[[@LINE+4]]{{(:15)?}}: runtime error: member call on misaligned address [[PTR:0x[0-9a-f]*]] for type 'S', which requires 4 byte alignment
// CHECK-MEMFUN-NEXT: [[PTR]]: note: pointer points here
// CHECK-MEMFUN-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-MEMFUN-NEXT: {{^ \^}}
return s->f() && 0;
case 'n':
// CHECK-NEW: misaligned.cpp:[[@LINE+4]]{{(:21)?}}: runtime error: constructor call on misaligned address [[PTR:0x[0-9a-f]*]] for type 'S', which requires 4 byte alignment
// CHECK-NEW-NEXT: [[PTR]]: note: pointer points here
// CHECK-NEW-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-NEW-NEXT: {{^ \^}}
return (new (s) S)->k && 0;
case 'u': {
// CHECK-UPCAST: misaligned.cpp:[[@LINE+4]]{{(:17)?}}: runtime error: upcast of misaligned address [[PTR:0x[0-9a-f]*]] for type 'T', which requires 4 byte alignment
// CHECK-UPCAST-NEXT: [[PTR]]: note: pointer points here
// CHECK-UPCAST-NEXT: {{^ 00 00 00 01 02 03 04 05}}
// CHECK-UPCAST-NEXT: {{^ \^}}
S *s2 = (S*)t;
return s2->f();
}
case 'w':
// CHECK-WILD: misaligned.cpp:[[@LINE+3]]{{(:35)?}}: runtime error: member access within misaligned address 0x{{0+}}123 for type 'S', which requires 4 byte alignment
// CHECK-WILD-NEXT: 0x{{0+}}123: note: pointer points here
// CHECK-WILD-NEXT:
return static_cast(wild)->k;
}
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Float/ 0000775 0001750 0001750 00000000000 13040224625 026231 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Float/cast-overflow.cpp 0000664 0001750 0001750 00000013000 12670673613 031537 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=float-cast-overflow %s -o %t
// RUN: %run %t _
// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 %run %t 0 2>&1 | FileCheck %s --check-prefix=CHECK-0
// RUN: %run %t 1 2>&1 | FileCheck %s --check-prefix=CHECK-1
// RUN: %run %t 2 2>&1 | FileCheck %s --check-prefix=CHECK-2
// RUN: %run %t 3 2>&1 | FileCheck %s --check-prefix=CHECK-3
// RUN: %run %t 4 2>&1 | FileCheck %s --check-prefix=CHECK-4
// RUN: %run %t 5 2>&1 | FileCheck %s --check-prefix=CHECK-5
// RUN: %run %t 6 2>&1 | FileCheck %s --check-prefix=CHECK-6
// FIXME: %run %t 7 2>&1 | FileCheck %s --check-prefix=CHECK-7
// FIXME: not %run %t 8 2>&1 | FileCheck %s --check-prefix=CHECK-8
// RUN: not %run %t 9 2>&1 | FileCheck %s --check-prefix=CHECK-9
// This test assumes float and double are IEEE-754 single- and double-precision.
#if defined(__APPLE__)
# include
# define BYTE_ORDER __DARWIN_BYTE_ORDER
# define BIG_ENDIAN __DARWIN_BIG_ENDIAN
# define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
#elif defined(__FreeBSD__)
# include
# define BYTE_ORDER _BYTE_ORDER
# define BIG_ENDIAN _BIG_ENDIAN
# define LITTLE_ENDIAN _LITTLE_ENDIAN
#elif defined(_WIN32)
# define BYTE_ORDER 0
# define BIG_ENDIAN 1
# define LITTLE_ENDIAN 0
#else
# include
# define BYTE_ORDER __BYTE_ORDER
# define BIG_ENDIAN __BIG_ENDIAN
# define LITTLE_ENDIAN __LITTLE_ENDIAN
#endif // __APPLE__
#include
#include
#include
float Inf;
float NaN;
int main(int argc, char **argv) {
float MaxFloatRepresentableAsInt = 0x7fffff80;
(int)MaxFloatRepresentableAsInt; // ok
(int)-MaxFloatRepresentableAsInt; // ok
float MinFloatRepresentableAsInt = -0x7fffffff - 1;
(int)MinFloatRepresentableAsInt; // ok
float MaxFloatRepresentableAsUInt = 0xffffff00u;
(unsigned int)MaxFloatRepresentableAsUInt; // ok
#ifdef __SIZEOF_INT128__
unsigned __int128 FloatMaxAsUInt128 = -((unsigned __int128)1 << 104);
(void)(float)FloatMaxAsUInt128; // ok
#endif
float NearlyMinusOne = -0.99999;
unsigned Zero = NearlyMinusOne; // ok
// Build a '+Inf'.
#if BYTE_ORDER == LITTLE_ENDIAN
unsigned char InfVal[] = { 0x00, 0x00, 0x80, 0x7f };
#else
unsigned char InfVal[] = { 0x7f, 0x80, 0x00, 0x00 };
#endif
float Inf;
memcpy(&Inf, InfVal, 4);
// Build a 'NaN'.
#if BYTE_ORDER == LITTLE_ENDIAN
unsigned char NaNVal[] = { 0x01, 0x00, 0x80, 0x7f };
#else
unsigned char NaNVal[] = { 0x7f, 0x80, 0x00, 0x01 };
#endif
float NaN;
memcpy(&NaN, NaNVal, 4);
double DblInf = (double)Inf; // ok
switch (argv[1][0]) {
// FIXME: Produce a source location for these checks and test for it here.
// Floating point -> integer overflow.
case '0': {
// Note that values between 0x7ffffe00 and 0x80000000 may or may not
// successfully round-trip, depending on the rounding mode.
// CHECK-0: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: value 2.14748{{.*}} is outside the range of representable values of type 'int'
static int test_int = MaxFloatRepresentableAsInt + 0x80;
// CHECK-0: SUMMARY: {{.*}}Sanitizer: float-cast-overflow {{.*}}cast-overflow.cpp:[[@LINE-1]]
return 0;
}
case '1': {
// CHECK-1: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: value -2.14748{{.*}} is outside the range of representable values of type 'int'
static int test_int = MinFloatRepresentableAsInt - 0x100;
return 0;
}
case '2': {
// CHECK-2: {{.*}}cast-overflow.cpp:[[@LINE+2]]:37: runtime error: value -1 is outside the range of representable values of type 'unsigned int'
volatile float f = -1.0;
volatile unsigned u = (unsigned)f;
return 0;
}
case '3': {
// CHECK-3: {{.*}}cast-overflow.cpp:[[@LINE+1]]:37: runtime error: value 4.2949{{.*}} is outside the range of representable values of type 'unsigned int'
static int test_int = (unsigned)(MaxFloatRepresentableAsUInt + 0x100);
return 0;
}
case '4': {
// CHECK-4: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: value {{.*}} is outside the range of representable values of type 'int'
static int test_int = Inf;
return 0;
}
case '5': {
// CHECK-5: {{.*}}cast-overflow.cpp:[[@LINE+1]]:27: runtime error: value {{.*}} is outside the range of representable values of type 'int'
static int test_int = NaN;
return 0;
}
// Integer -> floating point overflow.
case '6': {
// CHECK-6: cast-overflow.cpp:[[@LINE+2]]:{{34: runtime error: value 0xffffff00000000000000000000000001 is outside the range of representable values of type 'float'| __int128 not supported}}
#if defined(__SIZEOF_INT128__) && !defined(_WIN32)
static int test_int = (float)(FloatMaxAsUInt128 + 1);
return 0;
#else
// Print the same line as the check above. That way the test is robust to
// line changes around it
printf("%s:%d: __int128 not supported", __FILE__, __LINE__ - 5);
return 0;
#endif
}
// FIXME: The backend cannot lower __fp16 operations on x86 yet.
//case '7':
// (__fp16)65504; // ok
// // CHECK-7: runtime error: value 65505 is outside the range of representable values of type '__fp16'
// return (__fp16)65505;
// Floating point -> floating point overflow.
case '8':
// CHECK-8: {{.*}}cast-overflow.cpp:[[@LINE+1]]:19: runtime error: value 1e+39 is outside the range of representable values of type 'float'
return (float)1e39;
case '9':
volatile long double ld = 300.0;
// CHECK-9: {{.*}}cast-overflow.cpp:[[@LINE+1]]:14: runtime error: value 300 is outside the range of representable values of type 'char'
char c = ld;
return c;
}
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/ 0000775 0001750 0001750 00000000000 13040224625 026057 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/coverage-levels.cc 0000664 0001750 0001750 00000004506 12730343031 031454 0 ustar mwhudson mwhudson // Test various levels of coverage
//
// FIXME: Port the environment variable logic below for the lit shell.
// REQUIRES: shell
//
// RUN: rm -rf %T/coverage-levels && mkdir %T/coverage-levels
// RUN: %clangxx -fsanitize=shift -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
// RUN: %clangxx -fsanitize=undefined -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
// Also works without any sanitizer.
// RUN: %clangxx -DGOOD_SHIFT=1 -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_NOWARN
// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=func %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK_WARN
// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=bb %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK_WARN
// RUN: %clangxx -fsanitize=shift -O1 -fsanitize-coverage=edge %s -o %t
// RUN: %env_ubsan_opts=coverage=1:verbosity=1:coverage_dir='"%T/coverage-levels"' %run %t 2>&1 | FileCheck %s --check-prefix=CHECK3 --check-prefix=CHECK_WARN
// Coverage is not yet implemented in TSan.
// XFAIL: ubsan-tsan
volatile int sink;
int main(int argc, char **argv) {
int shift = argc * 32;
#if GOOD_SHIFT
shift = 3;
#endif
if ((argc << shift) == 16) // False.
return 1;
return 0;
}
// CHECK_WARN: shift exponent 32 is too large
// CHECK_NOWARN-NOT: ERROR
// FIXME: Currently, coverage instrumentation kicks in after ubsan, so we get
// more than the minimal number of instrumented blocks.
// FIXME: Currently, ubsan with -fno-sanitize-recover and w/o asan will fail
// to dump coverage.
// CHECK1: 1 PCs written
// CHECK2: 2 PCs written
// CHECK3: 2 PCs written
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/Linux/ 0000775 0001750 0001750 00000000000 13040224625 027156 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/Linux/lit.local.cfg 0000664 0001750 0001750 00000000266 12500267022 031522 0 ustar mwhudson mwhudson def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
root = getRoot(config)
if root.host_os not in ['Linux']:
config.unsupported = True
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/Linux/ubsan_options.cc 0000664 0001750 0001750 00000000741 12627423454 032365 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=integer -fsanitize-recover=integer %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// __ubsan_default_options() doesn't work on Darwin.
// XFAIL: darwin
#include
extern "C" const char *__ubsan_default_options() {
return "halt_on_error=1";
}
int main() {
(void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
// CHECK: ubsan_options.cc:[[@LINE-1]]:44: runtime error: unsigned integer overflow
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/bool.cpp 0000664 0001750 0001750 00000001000 12567135630 027517 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=bool %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %env_ubsan_opts=print_summary=1:report_error_type=1 not %run %t 2>&1 | FileCheck %s --check-prefix=SUMMARY
unsigned char NotABool = 123;
int main(int argc, char **argv) {
bool *p = (bool*)&NotABool;
// CHECK: bool.cpp:[[@LINE+1]]:10: runtime error: load of value 123, which is not a valid value for type 'bool'
return *p;
// SUMMARY: SUMMARY: {{.*}}Sanitizer: invalid-bool-load {{.*}}bool.cpp:[[@LINE-1]]
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/missing_return.cpp 0000664 0001750 0001750 00000001311 12567135630 031641 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=return -g %s -O3 -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %env_ubsan_opts=print_stacktrace=1 not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-%os-STACKTRACE
// CHECK: missing_return.cpp:[[@LINE+1]]:5: runtime error: execution reached the end of a value-returning function without returning a value
int f() {
// Slow stack unwinding is not available on Darwin for now, see
// https://code.google.com/p/address-sanitizer/issues/detail?id=137
// CHECK-Linux-STACKTRACE: #0 {{.*}}f(){{.*}}missing_return.cpp:[[@LINE-3]]
// CHECK-FreeBSD-STACKTRACE: #0 {{.*}}f(void){{.*}}missing_return.cpp:[[@LINE-4]]
}
int main(int, char **argv) {
return f();
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/bounds.cpp 0000664 0001750 0001750 00000001350 12545333146 030064 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=bounds %s -O3 -o %t
// RUN: %run %t 0 0 0
// RUN: %run %t 1 2 3
// RUN: %expect_crash %run %t 2 0 0 2>&1 | FileCheck %s --check-prefix=CHECK-A-2
// RUN: %run %t 0 3 0 2>&1 | FileCheck %s --check-prefix=CHECK-B-3
// RUN: %run %t 0 0 4 2>&1 | FileCheck %s --check-prefix=CHECK-C-4
int main(int argc, char **argv) {
int arr[2][3][4] = {};
return arr[argv[1][0] - '0'][argv[2][0] - '0'][argv[3][0] - '0'];
// CHECK-A-2: bounds.cpp:[[@LINE-1]]:10: runtime error: index 2 out of bounds for type 'int [2][3][4]'
// CHECK-B-3: bounds.cpp:[[@LINE-2]]:10: runtime error: index 3 out of bounds for type 'int [3][4]'
// CHECK-C-4: bounds.cpp:[[@LINE-3]]:10: runtime error: index 4 out of bounds for type 'int [4]'
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/log-path_test.cc 0000664 0001750 0001750 00000001743 12571365661 031163 0 ustar mwhudson mwhudson // FIXME: https://code.google.com/p/address-sanitizer/issues/detail?id=316
// XFAIL: android
// The globs below do not work in the lit shell.
// REQUIRES: shell
// RUN: %clangxx -fsanitize=undefined %s -O1 -o %t
// Regular run.
// RUN: %run %t -4 2> %t.out
// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.out
// Good log_path.
// RUN: rm -f %t.log.*
// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t -4 2> %t.out
// RUN: FileCheck %s --check-prefix=CHECK-ERROR < %t.log.*
// Run w/o errors should not produce any log.
// RUN: rm -f %t.log.*
// RUN: %env_ubsan_opts=log_path='"%t.log"' %run %t 4
// RUN: not cat %t.log.*
// FIXME: log_path is not supported on Windows yet.
// XFAIL: win32
#include
#include
int main(int argc, char *argv[]) {
double a = atof(argv[1]);
unsigned int ai = (unsigned int) a;
printf("%f %u\n", a, ai);
return 0;
}
// CHECK-ERROR: runtime error: value -4 is outside the range of representable values of type 'unsigned int'
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/unreachable.cpp 0000664 0001750 0001750 00000000364 12365565411 031051 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=unreachable %s -O3 -o %t && not %run %t 2>&1 | FileCheck %s
int main(int, char **argv) {
// CHECK: unreachable.cpp:5:3: runtime error: execution reached a __builtin_unreachable() call
__builtin_unreachable();
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/deduplication.cpp 0000664 0001750 0001750 00000000764 12545333146 031426 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=undefined %s -o %t && %run %t 2>&1 | FileCheck %s
// Verify deduplication works by ensuring only one diag is emitted.
#include
#include
void overflow() {
int i = INT_MIN;
--i;
}
int main() {
// CHECK: Start
fprintf(stderr, "Start\n");
fflush(stderr);
// CHECK: runtime error
// CHECK-NOT: runtime error
// CHECK-NOT: runtime error
overflow();
overflow();
overflow();
// CHECK: End
fprintf(stderr, "End\n");
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/nonnull-arg.cpp 0000664 0001750 0001750 00000004410 12577031120 031016 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=nonnull-attribute -fno-sanitize-recover=all %s -O3 -o %t
// RUN: %run %t nc
// RUN: %run %t nm
// RUN: %run %t nf
// RUN: %run %t nv
// RUN: not %run %t 0c 2>&1 | FileCheck %s --check-prefix=CTOR
// RUN: not %run %t 0m 2>&1 | FileCheck %s --check-prefix=METHOD
// RUN: not %run %t 0f 2>&1 | FileCheck %s --check-prefix=FUNC
// RUN: not %run %t 0v 2>&1 | FileCheck %s --check-prefix=VARIADIC
//
// AArch64 lacks variadic instrumentation for MSAN.
// REQUIRES: stable-runtime
class C {
int *null_;
int *nonnull_;
public:
C(int *null, __attribute__((nonnull)) int *nonnull)
: null_(null), nonnull_(nonnull) {}
int value() { return *nonnull_; }
int method(int *nonnull, int *null) __attribute__((nonnull(2))) {
return *nonnull_ + *nonnull;
}
};
__attribute__((nonnull)) int func(int *nonnull) { return *nonnull; }
#include
__attribute__((nonnull)) int variadic(int x, ...) {
va_list args;
va_start(args, x);
int *nonnull = va_arg(args, int*);
int res = *nonnull;
va_end(args);
return res;
}
int main(int argc, char *argv[]) {
int local = 0;
int *arg = (argv[1][0] == '0') ? 0x0 : &local;
switch (argv[1][1]) {
case 'c':
return C(0x0, arg).value();
// CTOR: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:21: runtime error: null pointer passed as argument 2, which is declared to never be null
// CTOR-NEXT: {{.*}}nonnull-arg.cpp:19:31: note: nonnull attribute specified here
case 'm':
return C(0x0, &local).method(arg, 0x0);
// METHOD: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:36: runtime error: null pointer passed as argument 1, which is declared to never be null
// METHOD-NEXT: {{.*}}nonnull-arg.cpp:22:54: note: nonnull attribute specified here
case 'f':
return func(arg);
// FUNC: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:19: runtime error: null pointer passed as argument 1, which is declared to never be null
// FUNC-NEXT: {{.*}}nonnull-arg.cpp:27:16: note: nonnull attribute specified here
case 'v':
return variadic(42, arg);
// VARIADIC: {{.*}}nonnull-arg.cpp:[[@LINE-1]]:27: runtime error: null pointer passed as argument 2, which is declared to never be null
// VARIADIC-NEXT: {{.*}}nonnull-arg.cpp:30:16: note: nonnull attribute specified here
}
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/enum.cpp 0000664 0001750 0001750 00000001621 12545333146 027537 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=enum %s -O3 -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-PLAIN
// RUN: %clangxx -fsanitize=enum -std=c++11 -DE="class E" %s -O3 -o %t && %run %t
// RUN: %clangxx -fsanitize=enum -std=c++11 -DE="class E : bool" %s -O3 -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-BOOL
// FIXME: UBSan fails to add the correct instrumentation code for some reason on
// Windows.
// XFAIL: win32
enum E { a = 1 } e;
#undef E
int main(int argc, char **argv) {
// memset(&e, 0xff, sizeof(e));
for (unsigned char *p = (unsigned char*)&e; p != (unsigned char*)(&e + 1); ++p)
*p = 0xff;
// CHECK-PLAIN: error: load of value 4294967295, which is not a valid value for type 'enum E'
// FIXME: Support marshalling and display of enum class values.
// CHECK-BOOL: error: load of value , which is not a valid value for type 'enum E'
return (int)e != -1;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/nonnull.cpp 0000664 0001750 0001750 00000000752 12403407317 030257 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=returns-nonnull-attribute %s -O3 -o %t
// RUN: %run %t foo
// RUN: %run %t 2>&1 | FileCheck %s
__attribute__((returns_nonnull)) char *foo(char *a);
char *foo(char *a) {
return a;
// CHECK: nonnull.cpp:[[@LINE+2]]:1: runtime error: null pointer returned from function declared to never return null
// CHECK-NEXT: nonnull.cpp:[[@LINE-5]]:16: note: returns_nonnull attribute specified here
}
int main(int argc, char **argv) {
return foo(argv[1]) == 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Misc/vla.c 0000664 0001750 0001750 00000000750 12330266131 027006 0 ustar mwhudson mwhudson // RUN: %clang -fsanitize=vla-bound %s -O3 -o %t
// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-MINUS-ONE
// RUN: %run %t a 2>&1 | FileCheck %s --check-prefix=CHECK-ZERO
// RUN: %run %t a b
int main(int argc, char **argv) {
// CHECK-MINUS-ONE: vla.c:9:11: runtime error: variable length array bound evaluates to non-positive value -1
// CHECK-ZERO: vla.c:9:11: runtime error: variable length array bound evaluates to non-positive value 0
int arr[argc - 2];
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/ 0000775 0001750 0001750 00000000000 13040224625 026561 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/umul-overflow.cpp 0000664 0001750 0001750 00000001146 12330266131 032111 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
#include
int main() {
// These promote to 'int'.
(void)(int8_t(-2) * int8_t(0x7f));
(void)(int16_t(0x7fff) * int16_t(0x7fff));
(void)(uint16_t(0xffff) * int16_t(0x7fff));
(void)(uint16_t(0xffff) * uint16_t(0x8000));
// Not an unsigned overflow
(void)(uint16_t(0xffff) * uint16_t(0x8001));
(void)(uint32_t(0xffffffff) * uint32_t(0x2));
// CHECK: umul-overflow.cpp:15:31: runtime error: unsigned integer overflow: 4294967295 * 2 cannot be represented in type 'unsigned int'
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/div-overflow.cpp 0000664 0001750 0001750 00000000457 12330266131 031715 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
#include
int main() {
unsigned(0x80000000) / -1;
// CHECK: div-overflow.cpp:9:23: runtime error: division of -2147483648 by -1 cannot be represented in type 'int'
int32_t(0x80000000) / -1;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/div-zero.cpp 0000664 0001750 0001750 00000001212 12545333146 031030 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=0 %s -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND=1U %s -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx -fsanitize=float-divide-by-zero -DDIVIDEND=1.5 %s -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clangxx -fsanitize=integer-divide-by-zero -DDIVIDEND='intmax(123)' %s -o %t && %run %t 2>&1 | FileCheck %s
#if defined(__SIZEOF_INT128__) && !defined(_WIN32)
typedef __int128 intmax;
#else
typedef long long intmax;
#endif
int main() {
// CHECK: div-zero.cpp:[[@LINE+1]]:12: runtime error: division by zero
DIVIDEND / 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/sub-overflow.cpp 0000664 0001750 0001750 00000002431 12545333146 031727 0 ustar mwhudson mwhudson // RUN: %clangxx -DSUB_I32 -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I32
// RUN: %clangxx -DSUB_I64 -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I64
// RUN: %clangxx -DSUB_I128 -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I128
#include
#include
int main() {
// These promote to 'int'.
(void)(int8_t(-2) - int8_t(0x7f));
(void)(int16_t(-2) - int16_t(0x7fff));
#ifdef SUB_I32
(void)(int32_t(-2) - int32_t(0x7fffffff));
// CHECK-SUB_I32: sub-overflow.cpp:[[@LINE-1]]:22: runtime error: signed integer overflow: -2 - 2147483647 cannot be represented in type 'int'
#endif
#ifdef SUB_I64
(void)(int64_t(-8000000000000000000ll) - int64_t(2000000000000000000ll));
// CHECK-SUB_I64: -8000000000000000000 - 2000000000000000000 cannot be represented in type '{{long( long)?}}'
#endif
#ifdef SUB_I128
# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
(void)(-(__int128_t(1) << 126) - (__int128_t(1) << 126) - 1);
# else
puts("__int128 not supported");
# endif
// CHECK-SUB_I128: {{0x80000000000000000000000000000000 - 1 cannot be represented in type '__int128'|__int128 not supported}}
#endif
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/summary.cpp 0000664 0001750 0001750 00000001061 12627423454 030773 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=integer %s -o %t
// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NOTYPE
// RUN: %env_ubsan_opts=report_error_type=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-TYPE
// REQUIRES: ubsan-asan
#include
int main() {
(void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
// CHECK-NOTYPE: SUMMARY: AddressSanitizer: undefined-behavior {{.*}}summary.cpp:[[@LINE-1]]:44
// CHECK-TYPE: SUMMARY: AddressSanitizer: unsigned-integer-overflow {{.*}}summary.cpp:[[@LINE-2]]:44
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/mul-overflow.cpp 0000664 0001750 0001750 00000000773 12330266131 031731 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s
#include
int main() {
// These promote to 'int'.
(void)(int8_t(-2) * int8_t(0x7f));
(void)(int16_t(0x7fff) * int16_t(0x7fff));
(void)(uint16_t(0xffff) * int16_t(0x7fff));
(void)(uint16_t(0xffff) * uint16_t(0x8000));
// CHECK: mul-overflow.cpp:13:27: runtime error: signed integer overflow: 65535 * 32769 cannot be represented in type 'int'
(void)(uint16_t(0xffff) * uint16_t(0x8001));
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/suppressions.cpp 0000664 0001750 0001750 00000002711 12650510142 032041 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=integer -g0 %s -o %t
// Suppression by symbol name (unsigned-integer-overflow:do_overflow below)
// requires the compiler-rt runtime to be able to symbolize stack addresses.
// REQUIRES: can-symbolize
// Fails without any suppression.
// RUN: %env_ubsan_opts=halt_on_error=1 not %run %t 2>&1 | FileCheck %s
// RUN: echo "signed-integer-overflow:%t" > %t.wrong-supp
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.wrong-supp"' not %run %t 2>&1 | FileCheck %s
// RUN: echo "unsigned-integer-overflow:do_overflow" > %t.func-supp
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.func-supp"' %run %t
// RUN: echo "unsigned-integer-overflow:%t" > %t.module-supp
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' %run %t
// Note: file-level suppressions should work even without debug info.
// RUN: echo "unsigned-integer-overflow:%s" > %t.file-supp
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.file-supp"' %run %t
// Suppressions don't work for unrecoverable kinds.
// RUN: %clangxx -fsanitize=integer -fno-sanitize-recover=integer %s -o %t-norecover
// RUN: %env_ubsan_opts=halt_on_error=1:suppressions='"%t.module-supp"' not %run %t-norecover 2>&1 | FileCheck %s
#include
extern "C" void do_overflow() {
(void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
// CHECK: runtime error: unsigned integer overflow
}
int main() {
do_overflow();
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/add-overflow.cpp 0000664 0001750 0001750 00000002500 12545333146 031663 0 ustar mwhudson mwhudson // RUN: %clangxx -DADD_I32 -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I32
// RUN: %clangxx -DADD_I64 -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I64
// RUN: %clangxx -DADD_I128 -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I128
#include
#include
int main() {
// These promote to 'int'.
(void)(int8_t(0x7f) + int8_t(0x7f));
(void)(int16_t(0x3fff) + int16_t(0x4000));
#ifdef ADD_I32
int32_t k = 0x12345678;
k += 0x789abcde;
// CHECK-ADD_I32: add-overflow.cpp:[[@LINE-1]]:5: runtime error: signed integer overflow: 305419896 + 2023406814 cannot be represented in type 'int'
#endif
#ifdef ADD_I64
(void)(int64_t(8000000000000000000ll) + int64_t(2000000000000000000ll));
// CHECK-ADD_I64: 8000000000000000000 + 2000000000000000000 cannot be represented in type '{{long( long)?}}'
#endif
#ifdef ADD_I128
# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
(void)((__int128_t(1) << 126) + (__int128_t(1) << 126));
# else
puts("__int128 not supported");
# endif
// CHECK-ADD_I128: {{0x40000000000000000000000000000000 \+ 0x40000000000000000000000000000000 cannot be represented in type '__int128'|__int128 not supported}}
#endif
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/uadd-overflow.cpp 0000664 0001750 0001750 00000002563 12545333146 032061 0 ustar mwhudson mwhudson // RUN: %clangxx -DADD_I32 -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I32
// RUN: %clangxx -DADD_I64 -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I64
// RUN: %clangxx -DADD_I128 -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-ADD_I128
#include
#include
int main() {
// These promote to 'int'.
(void)(uint8_t(0xff) + uint8_t(0xff));
(void)(uint16_t(0xf0fff) + uint16_t(0x0fff));
#ifdef ADD_I32
uint32_t k = 0x87654321;
k += 0xedcba987;
// CHECK-ADD_I32: uadd-overflow.cpp:[[@LINE-1]]:5: runtime error: unsigned integer overflow: 2271560481 + 3989547399 cannot be represented in type 'unsigned int'
#endif
#ifdef ADD_I64
(void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
// CHECK-ADD_I64: 10000000000000000000 + 9000000000000000000 cannot be represented in type 'unsigned {{long( long)?}}'
#endif
#ifdef ADD_I128
# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
(void)((__uint128_t(1) << 127) + (__uint128_t(1) << 127));
# else
puts("__int128 not supported");
# endif
// CHECK-ADD_I128: {{0x80000000000000000000000000000000 \+ 0x80000000000000000000000000000000 cannot be represented in type 'unsigned __int128'|__int128 not supported}}
#endif
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/incdec-overflow.cpp 0000664 0001750 0001750 00000001543 12545333146 032366 0 ustar mwhudson mwhudson // RUN: %clangxx -DOP=n++ -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=PLUS
// RUN: %clangxx -DOP=++n -fsanitize=signed-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=PLUS
// RUN: %clangxx -DOP=m-- -fsanitize=signed-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=MINUS
// RUN: %clangxx -DOP=--m -fsanitize=signed-integer-overflow %s -o %t4 && %run %t4 2>&1 | FileCheck %s --check-prefix=MINUS
#include
int main() {
int n = 0x7ffffffd;
n++;
n++;
int m = -n - 1;
OP;
// PLUS: incdec-overflow.cpp:[[@LINE-1]]:3: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
// MINUS: incdec-overflow.cpp:[[@LINE-2]]:3: runtime error: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int'
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/negate-overflow.cpp 0000664 0001750 0001750 00000001326 12545333146 032403 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=signed-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECKS
// RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECKU
int main() {
// CHECKS-NOT: runtime error
// CHECKU: negate-overflow.cpp:[[@LINE+2]]:3: runtime error: negation of 2147483648 cannot be represented in type 'unsigned int'
// CHECKU-NOT: cast to an unsigned
-unsigned(-0x7fffffff - 1); // ok
// CHECKS: negate-overflow.cpp:[[@LINE+2]]:10: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
// CHECKU-NOT: runtime error
return -(-0x7fffffff - 1);
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/uincdec-overflow.cpp 0000664 0001750 0001750 00000001607 12545333146 032554 0 ustar mwhudson mwhudson // RUN: %clangxx -DOP=n++ -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck --check-prefix=CHECK-INC %s
// RUN: %clangxx -DOP=++n -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck --check-prefix=CHECK-INC %s
// RUN: %clangxx -DOP=m-- -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck --check-prefix=CHECK-DEC %s
// RUN: %clangxx -DOP=--m -fsanitize=unsigned-integer-overflow %s -o %t4 && %run %t4 2>&1 | FileCheck --check-prefix=CHECK-DEC %s
#include
int main() {
unsigned n = 0xfffffffd;
n++;
n++;
unsigned m = 0;
// CHECK-INC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 4294967295 + 1 cannot be represented in type 'unsigned int'
// CHECK-DEC: uincdec-overflow.cpp:15:3: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
OP;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/shift.cpp 0000664 0001750 0001750 00000005546 12545333146 030424 0 ustar mwhudson mwhudson // RUN: %clangxx -DLSH_OVERFLOW -DOP='<<' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t1 && not %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-LSH_OVERFLOW
// RUN: %clangxx -DLSH_OVERFLOW -DOP='<<=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t2 && not %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-LSH_OVERFLOW
// RUN: %clangxx -DTOO_LOW -DOP='<<' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t3 && not %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
// RUN: %clangxx -DTOO_LOW -DOP='>>' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t4 && not %run %t4 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
// RUN: %clangxx -DTOO_LOW -DOP='<<=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t5 && not %run %t5 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
// RUN: %clangxx -DTOO_LOW -DOP='>>=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t6 && not %run %t6 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_LOW
// RUN: %clangxx -DTOO_HIGH -DOP='<<' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t7 && not %run %t7 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
// RUN: %clangxx -DTOO_HIGH -DOP='>>' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t8 && not %run %t8 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
// RUN: %clangxx -DTOO_HIGH -DOP='<<=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t9 && not %run %t9 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
// RUN: %clangxx -DTOO_HIGH -DOP='>>=' -fsanitize=shift -fno-sanitize-recover=shift %s -o %t10 && not %run %t10 2>&1 | FileCheck %s --check-prefix=CHECK-TOO_HIGH
// RUN: %clangxx -DLSH_OVERFLOW -DOP='<<' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t12 && %run %t12
// RUN: %clangxx -DLSH_OVERFLOW -DOP='>>' -fsanitize=shift-exponent -fno-sanitize-recover=shift %s -o %t13 && %run %t13
// RUN: %clangxx -DTOO_LOW -DOP='<<' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t14 && %run %t14
// RUN: %clangxx -DTOO_LOW -DOP='>>' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t15 && %run %t15
// RUN: %clangxx -DTOO_HIGH -DOP='<<' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t16 && %run %t16
// RUN: %clangxx -DTOO_HIGH -DOP='>>' -fsanitize=shift-base -fno-sanitize-recover=shift %s -o %t17 && %run %t17
#include
int main() {
int a = 1;
unsigned b = 1;
a <<= 31; // ok in C++11, not ok in C99/C11
b <<= 31; // ok
b <<= 1; // still ok, unsigned
#ifdef LSH_OVERFLOW
// CHECK-LSH_OVERFLOW: shift.cpp:[[@LINE+1]]:5: runtime error: left shift of negative value -2147483648
a OP 1;
#endif
#ifdef TOO_LOW
a = 0;
// CHECK-TOO_LOW: shift.cpp:[[@LINE+1]]:5: runtime error: shift exponent -3 is negative
a OP (-3);
#endif
#ifdef TOO_HIGH
a = 0;
// CHECK-TOO_HIGH: shift.cpp:[[@LINE+1]]:5: runtime error: shift exponent 32 is too large for 32-bit type 'int'
a OP 32;
#endif
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/no-recover.cpp 0000664 0001750 0001750 00000002366 12455051222 031353 0 ustar mwhudson mwhudson // RUN: %clangxx -fsanitize=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=RECOVER
// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=all -fsanitize-recover=unsigned-integer-overflow %s -o %t && %run %t 2>&1 | FileCheck %s --check-prefix=RECOVER
// RUN: %clangxx -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=unsigned-integer-overflow %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=ABORT
#include
int main() {
// These promote to 'int'.
(void)(uint8_t(0xff) + uint8_t(0xff));
(void)(uint16_t(0xf0fff) + uint16_t(0x0fff));
// RECOVER-NOT: runtime error
// ABORT-NOT: runtime error
uint32_t k = 0x87654321;
k += 0xedcba987;
// RECOVER: no-recover.cpp:[[@LINE-1]]:5: runtime error: unsigned integer overflow: 2271560481 + 3989547399 cannot be represented in type 'unsigned int'
// ABORT: no-recover.cpp:[[@LINE-2]]:5: runtime error: unsigned integer overflow: 2271560481 + 3989547399 cannot be represented in type 'unsigned int'
(void)(uint64_t(10000000000000000000ull) + uint64_t(9000000000000000000ull));
// RECOVER: 10000000000000000000 + 9000000000000000000 cannot be represented in type 'unsigned {{long( long)?}}'
// ABORT-NOT: runtime error
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/ubsan/TestCases/Integer/usub-overflow.cpp 0000664 0001750 0001750 00000002515 12545333146 032117 0 ustar mwhudson mwhudson // RUN: %clangxx -DSUB_I32 -fsanitize=unsigned-integer-overflow %s -o %t1 && %run %t1 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I32
// RUN: %clangxx -DSUB_I64 -fsanitize=unsigned-integer-overflow %s -o %t2 && %run %t2 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I64
// RUN: %clangxx -DSUB_I128 -fsanitize=unsigned-integer-overflow %s -o %t3 && %run %t3 2>&1 | FileCheck %s --check-prefix=CHECK-SUB_I128
#include
#include
int main() {
// These promote to 'int'.
(void)(uint8_t(0) - uint8_t(0x7f));
(void)(uint16_t(0) - uint16_t(0x7fff));
#ifdef SUB_I32
(void)(uint32_t(1) - uint32_t(2));
// CHECK-SUB_I32: usub-overflow.cpp:[[@LINE-1]]:22: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned int'
#endif
#ifdef SUB_I64
(void)(uint64_t(8000000000000000000ll) - uint64_t(9000000000000000000ll));
// CHECK-SUB_I64: 8000000000000000000 - 9000000000000000000 cannot be represented in type 'unsigned {{long( long)?}}'
#endif
#ifdef SUB_I128
# if defined(__SIZEOF_INT128__) && !defined(_WIN32)
(void)((__uint128_t(1) << 126) - (__uint128_t(1) << 127));
# else
puts("__int128 not supported\n");
# endif
// CHECK-SUB_I128: {{0x40000000000000000000000000000000 - 0x80000000000000000000000000000000 cannot be represented in type 'unsigned __int128'|__int128 not supported}}
#endif
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/ 0000775 0001750 0001750 00000000000 13040224625 024122 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/utils.h 0000664 0001750 0001750 00000000223 12537637337 025452 0 ustar mwhudson mwhudson #ifndef UTILS_H
#define UTILS_H
static inline void break_optimization(void *arg) {
__asm__ __volatile__("" : : "r" (arg) : "memory");
}
#endif
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/init.c 0000664 0001750 0001750 00000000221 12537637337 025246 0 ustar mwhudson mwhudson // RUN: %clang_safestack %s -o %t
// RUN: %run %t
// Basic smoke test for the runtime library.
int main(int argc, char **argv)
{
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/canary.c 0000664 0001750 0001750 00000001751 12703241411 025544 0 ustar mwhudson mwhudson // RUN: %clang_safestack -fno-stack-protector -D_FORTIFY_SOURCE=0 -g %s -o %t.nossp
// RUN: %run %t.nossp 2>&1 | FileCheck --check-prefix=NOSSP %s
// RUN: %clang_safestack -fstack-protector-all -D_FORTIFY_SOURCE=0 -g %s -o %t.ssp
// RUN: not --crash %run %t.ssp 2>&1 | FileCheck -check-prefix=SSP %s
// Test stack canaries on the unsafe stack.
// REQUIRES: stable-runtime
#include
#include
#include
__attribute__((noinline)) void f(unsigned *y) {
char x;
char *volatile p = &x;
char *volatile q = (char *)y;
assert(p < q);
assert(q - p < 1024); // sanity
// This has technically undefined behavior, but we know the actual layout of
// the unsafe stack and this should not touch anything important.
memset(&x, 0xab, q - p + sizeof(*y));
}
int main(int argc, char **argv)
{
unsigned y;
// NOSSP: main 1
// SSP: main 1
fprintf(stderr, "main 1\n");
f(&y);
// NOSSP: main 2
// SSP-NOT: main 2
fprintf(stderr, "main 2\n");
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/CMakeLists.txt 0000664 0001750 0001750 00000001526 12741012374 026671 0 ustar mwhudson mwhudson set(SAFESTACK_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SAFESTACK_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(SAFESTACK_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SAFESTACK_TEST_DEPS safestack)
# Some tests require LTO, so add a dependency on the relevant LTO plugin.
if(LLVM_ENABLE_PIC AND LLVM_BINUTILS_INCDIR)
list(APPEND SAFESTACK_TEST_DEPS
LLVMgold
)
endif()
if(APPLE)
list(APPEND SAFESTACK_TEST_DEPS
LTO
)
endif()
endif()
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
)
add_lit_testsuite(check-safestack "Running the SafeStack tests"
${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${SAFESTACK_TEST_DEPS})
set_target_properties(check-safestack PROPERTIES FOLDER "Compiler-RT Misc")
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/lit.site.cfg.in 0000664 0001750 0001750 00000000443 12704361721 026751 0 ustar mwhudson mwhudson @LIT_SITE_CFG_IN_HEADER@
# Load common config for all compiler-rt lit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
# Load tool-specific config that would do the real work.
lit_config.load_config(config, "@SAFESTACK_LIT_SOURCE_DIR@/lit.cfg")
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/lto.c 0000664 0001750 0001750 00000000264 12537637337 025110 0 ustar mwhudson mwhudson // REQUIRES: lto
// RUN: %clang_lto_safestack %s -o %t
// RUN: %run %t
// Test that safe stack works with LTO.
int main() {
char c[] = "hello world";
puts(c);
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/pthread.c 0000664 0001750 0001750 00000001321 12540070157 025715 0 ustar mwhudson mwhudson // RUN: %clang_safestack %s -pthread -o %t
// RUN: %run %t
// XFAIL: darwin
// Test that pthreads receive their own unsafe stack.
#include
#include
#include
#include "utils.h"
static int ptr_test = 42;
void *t1_start(void *ptr)
{
if (ptr != &ptr_test)
abort();
// safe stack
int val = ptr_test * 5;
// unsafe stack
char buffer[8096]; // two pages
memset(buffer, val, sizeof (buffer));
break_optimization(buffer);
return ptr;
}
int main(int argc, char **argv)
{
pthread_t t1;
void *ptr = NULL;
if (pthread_create(&t1, NULL, t1_start, &ptr_test))
abort();
if (pthread_join(t1, &ptr))
abort();
if (ptr != &ptr_test)
abort();
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/overflow.c 0000664 0001750 0001750 00000001102 12643562140 026130 0 ustar mwhudson mwhudson // RUN: %clang_safestack %s -o %t
// RUN: %run %t
// RUN: %clang_nosafestack -fno-stack-protector %s -o %t
// RUN: not %run %t
// Test that buffer overflows on the unsafe stack do not affect variables on the
// safe stack.
// REQUIRES: stable-runtime
__attribute__((noinline))
void fct(volatile int *buffer)
{
memset(buffer - 1, 0, 7 * sizeof(int));
}
int main(int argc, char **argv)
{
int prebuf[7];
int value1 = 42;
int buffer[5];
int value2 = 42;
int postbuf[7];
fct(prebuf + 1);
fct(postbuf + 1);
fct(buffer);
return value1 != 42 || value2 != 42;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/buffer-copy-vla.c 0000664 0001750 0001750 00000001103 12537637337 027304 0 ustar mwhudson mwhudson // RUN: %clang_safestack %s -o %t
// RUN: %run %t
#include "utils.h"
// Test that loads/stores work correctly for VLAs on the unsafe stack.
int main(int argc, char **argv)
{
int i = 128;
break_optimization(&i);
char buffer[i];
// check that we can write to a buffer
for (i = 0; argv[0][i] && i < sizeof (buffer) - 1; ++i)
buffer[i] = argv[0][i];
buffer[i] = '\0';
break_optimization(buffer);
// check that we can read from a buffer
for (i = 0; argv[0][i] && i < sizeof (buffer) - 1; ++i)
if (buffer[i] != argv[0][i])
return 1;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/lit.cfg 0000664 0001750 0001750 00000002010 12766255016 025400 0 ustar mwhudson mwhudson # -*- Python -*-
import os
# Setup config name.
config.name = 'SafeStack'
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Test suffixes.
config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
# Add clang substitutions.
config.substitutions.append( ("%clang_nosafestack ", config.clang + " -O0 -fno-sanitize=safe-stack ") )
config.substitutions.append( ("%clang_safestack ", config.clang + " -O0 -fsanitize=safe-stack ") )
if config.lto_supported:
config.substitutions.append((r"%clang_lto_safestack ", ' '.join(config.lto_launch + [config.clang] + config.lto_flags + ['-flto -fsanitize=safe-stack '])))
# SafeStack tests are currently supported on Linux, FreeBSD and Darwin only.
if config.host_os not in ['Linux', 'FreeBSD', 'Darwin']:
config.unsupported = True
# Allow tests to use REQUIRES=stable-runtime. For use when you cannot use XFAIL
# because the test fail due some runtime issue.
if config.target_arch != 'aarch64':
config.available_features.add('stable-runtime')
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/pthread-cleanup.c 0000664 0001750 0001750 00000001074 12537637337 027366 0 ustar mwhudson mwhudson // RUN: %clang_safestack %s -pthread -o %t
// RUN: not --crash %run %t
// Test that unsafe stacks are deallocated correctly on thread exit.
#include
#include
#include
enum { kBufferSize = (1 << 15) };
void *t1_start(void *ptr)
{
char buffer[kBufferSize];
return buffer;
}
int main(int argc, char **argv)
{
pthread_t t1;
char *buffer = NULL;
if (pthread_create(&t1, NULL, t1_start, NULL))
abort();
if (pthread_join(t1, &buffer))
abort();
// should segfault here
memset(buffer, 0, kBufferSize);
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/safestack/buffer-copy.c 0000664 0001750 0001750 00000001052 12537637337 026527 0 ustar mwhudson mwhudson // RUN: %clang_safestack %s -o %t
// RUN: %run %t
#include "utils.h"
// Test that loads/stores work correctly for variables on the unsafe stack.
int main(int argc, char **argv)
{
int i;
char buffer[128];
// check that we can write to a buffer
for (i = 0; argv[0][i] && i < sizeof (buffer) - 1; ++i)
buffer[i] = argv[0][i];
buffer[i] = '\0';
break_optimization(buffer);
// check that we can read from a buffer
for (i = 0; argv[0][i] && i < sizeof (buffer) - 1; ++i)
if (buffer[i] != argv[0][i])
return 1;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/lit.common.configured.in 0000664 0001750 0001750 00000003656 12771042144 026727 0 ustar mwhudson mwhudson @LIT_SITE_CFG_IN_HEADER@
# Set attribute value if it is unset.
def set_default(attr, value):
if not getattr(config, attr, None):
setattr(config, attr, value)
# Generic config options for all compiler-rt lit tests.
set_default("target_triple", "@COMPILER_RT_DEFAULT_TARGET_TRIPLE@")
set_default("target_cflags", "@COMPILER_RT_TEST_COMPILER_CFLAGS@")
set_default("host_arch", "@HOST_ARCH@")
set_default("target_arch", "@COMPILER_RT_DEFAULT_TARGET_ARCH@")
set_default("host_os", "@HOST_OS@")
set_default("llvm_build_mode", "@LLVM_BUILD_MODE@")
set_default("llvm_src_root", "@LLVM_MAIN_SRC_DIR@")
set_default("llvm_obj_root", "@LLVM_BINARY_DIR@")
set_default("compiler_rt_src_root", "@COMPILER_RT_SOURCE_DIR@")
set_default("compiler_rt_obj_root", "@COMPILER_RT_BINARY_DIR@")
set_default("llvm_tools_dir", "@LLVM_TOOLS_BINARY_DIR@")
set_default("llvm_shlib_dir", "@LLVM_LIBRARY_OUTPUT_INTDIR@")
set_default("gold_executable", "@GOLD_EXECUTABLE@")
set_default("clang", "@COMPILER_RT_TEST_COMPILER@")
set_default("compiler_id", "@COMPILER_RT_TEST_COMPILER_ID@")
set_default("python_executable", "@PYTHON_EXECUTABLE@")
set_default("compiler_rt_debug", @COMPILER_RT_DEBUG_PYBOOL@)
set_default("compiler_rt_libdir", "@COMPILER_RT_LIBRARY_OUTPUT_DIR@")
set_default("emulator", "@COMPILER_RT_EMULATOR@")
set_default("sanitizer_can_use_cxxabi", @SANITIZER_CAN_USE_CXXABI_PYBOOL@)
set_default("has_lld", @COMPILER_RT_HAS_LLD_SOURCES_PYBOOL@)
set_default("can_symbolize", @CAN_SYMBOLIZE@)
config.available_features.add('target-is-%s' % config.target_arch)
# LLVM tools dir can be passed in lit parameters, so try to
# apply substitution.
try:
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
except KeyError as e:
key, = e.args
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key, key))
# Setup attributes common for all compiler-rt projects.
lit_config.load_config(config, "@COMPILER_RT_SOURCE_DIR@/test/lit.common.cfg")
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/ 0000775 0001750 0001750 00000000000 13040224625 023616 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-visibility.cpp 0000664 0001750 0001750 00000005663 12752442526 030562 0 ustar mwhudson mwhudson // RUN: %clangxx_profgen -fcoverage-mapping %S/Inputs/instrprof-visibility-helper.cpp -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge %t.profraw -o %t.profdata
// RUN: llvm-profdata show --all-functions %t.profraw | FileCheck %s --check-prefix=PROFILE
// RUN: llvm-cov show %t -instr-profile=%t.profdata | FileCheck %s --check-prefix=COV
namespace {
#define NO_WEAK
#define NO_EXTERN
#include "instrprof-visibility-kinds.inc"
#undef NO_EXTERN
#undef NO_WEAK
}
namespace N1 {
#include "instrprof-visibility-kinds.inc"
}
int main() {
call();
N1::call();
return 0;
}
// PROFILE-DAG: _ZN2N12f1Ev
// PROFILE-DAG: _ZN2N12f2Ev
// PROFILE-DAG: _ZN2N12f3Ev
// PROFILE-DAG: _ZN2N12f4Ev
// PROFILE-DAG: _ZN2N12f5Ev
// PROFILE-DAG: _ZN2N12f6Ev
// PROFILE-DAG: _ZN2N12f7Ev
// PROFILE-DAG: _ZN2N14callEv
// PROFILE-DAG: main
// PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_14callEv
// PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f1Ev
// PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f3Ev
// PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f5Ev
// PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f6Ev
// PROFILE-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f7Ev
// PROFILE-DAG: Total functions: 15
// COV-DAG: instrprof-visibility-helper.cpp
// COV-DAG: instrprof-visibility-kinds.inc
// COV-DAG: _ZN2N12f1Ev
// COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f1Ev
// COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f3Ev
// COV-DAG: _ZN2N12f3Ev
// COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f5Ev
// COV-DAG: _ZN2N12f5Ev
// COV-DAG: _ZN2N12f6Ev
// COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f6Ev
// COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_12f7Ev
// COV-DAG: _ZN2N12f7Ev
// --- Check coverage for functions in the anonymous namespace.
// COV-DAG: instrprof-visibility.cpp:_ZN12_GLOBAL__N_14callEv
// COV-DAG: [[CALL:[0-9]+]]|{{ *}}1|void call() {
// COV-DAG: {{.*}}|{{ *}}1| f1();
// COV-DAG: {{.*}}|{{ *}}1|#ifndef NO_WEAK
// COV-DAG: {{.*}}|{{ *}} | f2();
// COV-DAG: {{.*}}|{{ *}} |#endif
// COV-DAG: {{.*}}|{{ *}}1| f3();
// COV-DAG: {{.*}}|{{ *}}1|#ifndef NO_EXTERN
// COV-DAG: {{.*}}|{{ *}} | f4();
// COV-DAG: {{.*}}|{{ *}} |#endif
// COV-DAG: {{.*}}|{{ *}}1| f5();
// COV-DAG: {{.*}}|{{ *}}1| f6();
// COV-DAG: {{.*}}|{{ *}}1| f7();
// COV-DAG: {{.*}}|{{ *}}1|}
// --- Check coverage for functions in namespace N1.
// COV-DAG: _ZN2N14callEv
// COV-DAG: {{ *}}[[CALL]]|{{ *}}1|void call() {
// COV-DAG: {{.*}}|{{ *}}1| f1();
// COV-DAG: {{.*}}|{{ *}}1|#ifndef NO_WEAK
// COV-DAG: {{.*}}|{{ *}}1| f2();
// COV-DAG: {{.*}}|{{ *}}1|#endif
// COV-DAG: {{.*}}|{{ *}}1| f3();
// COV-DAG: {{.*}}|{{ *}}1|#ifndef NO_EXTERN
// COV-DAG: {{.*}}|{{ *}}1| f4();
// COV-DAG: {{.*}}|{{ *}}1|#endif
// COV-DAG: {{.*}}|{{ *}}1| f5();
// COV-DAG: {{.*}}|{{ *}}1| f6();
// COV-DAG: {{.*}}|{{ *}}1| f7();
// COV-DAG: {{.*}}|{{ *}}1|}
// COV-DAG: instrprof-visibility.cpp
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-dlopen.test 0000664 0001750 0001750 00000004330 12415036750 030031 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -o %t.d/func.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func.c
RUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared %S/Inputs/instrprof-dlopen-func2.c
RUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/Inputs/instrprof-dlopen-main.c
RUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/Inputs/instrprof-dlopen-main.c
RUN: %clang -c -o %t.d/main.o %S/Inputs/instrprof-dlopen-main.c
RUN: %clang_profgen -o %t-static %S/Inputs/instrprof-dlopen-func.c %S/Inputs/instrprof-dlopen-func2.c %t.d/main.o
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-local.profraw %run %t-local
RUN: env LLVM_PROFILE_FILE=%t-global.profraw %run %t-global
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-local.profdata %t-local.profraw
RUN: llvm-profdata merge -o %t-global.profdata %t-global.profraw
RUN: %clang_profuse=%t-static.profdata -o %t-func.static.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func.c
RUN: %clang_profuse=%t-local.profdata -o %t-func.local.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func.c
RUN: %clang_profuse=%t-global.profdata -o %t-func.global.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func.c
RUN: diff %t-func.static.ll %t-func.local.ll
RUN: diff %t-func.static.ll %t-func.global.ll
RUN: %clang_profuse=%t-static.profdata -o %t-func2.static.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func2.c
RUN: %clang_profuse=%t-local.profdata -o %t-func2.local.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func2.c
RUN: %clang_profuse=%t-global.profdata -o %t-func2.global.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-func2.c
RUN: diff %t-func2.static.ll %t-func2.local.ll
RUN: diff %t-func2.static.ll %t-func2.global.ll
RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-main.c
RUN: %clang_profuse=%t-local.profdata -o %t-main.local.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-main.c
RUN: %clang_profuse=%t-local.profdata -o %t-main.global.ll -S -emit-llvm %S/Inputs/instrprof-dlopen-main.c
RUN: diff %t-main.static.ll %t-main.local.ll
RUN: diff %t-main.static.ll %t-main.global.ll
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-dump.c 0000664 0001750 0001750 00000003070 12752255072 026764 0 ustar mwhudson mwhudson /*
RUN: rm -fr %t.profdir
RUN: %clang_profgen=%t.profdir/default_%m.profraw -o %t -O2 %s
RUN: %run %t 2>&1 | FileCheck %s --check-prefix=NO_EXIT_WRITE
RUN: llvm-profdata merge -o %t.profdata %t.profdir
RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=PROF
NO_EXIT_WRITE: Profile data not written to file: already written
*/
int __llvm_profile_dump(void);
void __llvm_profile_reset_counters(void);
int foo(int);
int bar(int);
int skip(int);
int main(int argc, const char *argv[]) {
int Ret = foo(0); /* region 1 */
__llvm_profile_dump();
/* not profiled -- cleared later. */
skip(0); /* skipped region */
__llvm_profile_reset_counters();
Ret += bar(0); /* region 2 */
__llvm_profile_dump();
skip(1);
__llvm_profile_reset_counters();
/* foo's profile will be merged. */
foo(1); /* region 3 */
__llvm_profile_dump();
return Ret;
}
__attribute__((noinline)) int foo(int X) {
/* PROF: define {{.*}} @foo({{.*}}!prof ![[ENT:[0-9]+]]
PROF: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
*/
return X <= 0 ? -X : X;
}
__attribute__((noinline)) int skip(int X) {
/* PROF: define {{.*}} @skip(
PROF: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
*/
return X <= 0 ? -X : X;
}
__attribute__((noinline)) int bar(int X) {
/* PROF-LABEL: define {{.*}} @bar(
PROF: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
*/
return X <= 0 ? -X : X;
}
/*
PROF: ![[ENT]] = !{!"function_entry_count", i64 2}
PROF: ![[PD1]] = !{!"branch_weights", i32 2, i32 2}
*/
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-bufferio.c 0000664 0001750 0001750 00000011227 12715416122 027615 0 ustar mwhudson mwhudson // RUN: %clang_profgen -O3 -o %t %s
// RUN: %run %t %t.out.1 %t.out.2 %t.out.3 %t.out.4
// RUN: cat %t.out.1 | FileCheck %s
// RUN: diff %t.out.1 %t.out.2
// RUN: diff %t.out.2 %t.out.3
// RUN: diff %t.out.3 %t.out.4
#include
#include
#include
#include
typedef struct ProfBufferIO ProfBufferIO;
ProfBufferIO *lprofCreateBufferIOInternal(void *File, uint32_t BufferSz);
void lprofDeleteBufferIO(ProfBufferIO *BufferIO);
int lprofBufferIOWrite(ProfBufferIO *BufferIO, const char *Data, uint32_t Size);
int lprofBufferIOFlush(ProfBufferIO *BufferIO);
int __llvm_profile_runtime = 0;
const char *SmallData = "ABC\n";
const char *MediumData =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\n";
char LargeData[10 * 1024];
int main(int argc, const char *argv[]) {
ProfBufferIO *BufferIO;
FILE *File[4];
uint32_t IOBufferSize[4] = {8, 128, 8 * 1024, 11 * 1024};
int I, J;
if (argc < 5)
return 1;
for (I = 0; I < 10 * 1024 - 2; I++)
LargeData[I] = 'A';
LargeData[I++] = '\n';
LargeData[I++] = '\0';
for (J = 0; J < 4; J++) {
File[J] = fopen(argv[1 + J], "w");
if (!File[J])
return 1;
BufferIO = lprofCreateBufferIOInternal(File[J], IOBufferSize[J]);
lprofBufferIOWrite(BufferIO, "Short Strings:\n",
strlen("Short Strings:\n"));
for (I = 0; I < 1024; I++) {
lprofBufferIOWrite(BufferIO, SmallData, strlen(SmallData));
}
lprofBufferIOWrite(BufferIO, "Long Strings:\n", strlen("Long Strings:\n"));
for (I = 0; I < 1024; I++) {
lprofBufferIOWrite(BufferIO, MediumData, strlen(MediumData));
}
lprofBufferIOWrite(BufferIO, "Extra Long Strings:\n",
strlen("Extra Long Strings:\n"));
for (I = 0; I < 10; I++) {
lprofBufferIOWrite(BufferIO, LargeData, strlen(LargeData));
}
lprofBufferIOWrite(BufferIO, "Mixed Strings:\n", strlen("Mixed Strings:\n"));
for (I = 0; I < 1024; I++) {
lprofBufferIOWrite(BufferIO, MediumData, strlen(MediumData));
lprofBufferIOWrite(BufferIO, SmallData, strlen(SmallData));
}
lprofBufferIOWrite(BufferIO, "Endings:\n", strlen("Endings:\n"));
lprofBufferIOWrite(BufferIO, "END\n", strlen("END\n"));
lprofBufferIOWrite(BufferIO, "ENDEND\n", strlen("ENDEND\n"));
lprofBufferIOWrite(BufferIO, "ENDENDEND\n", strlen("ENDENDEND\n"));
lprofBufferIOWrite(BufferIO, "ENDENDENDEND\n", strlen("ENDENDENDEND\n"));
lprofBufferIOFlush(BufferIO);
lprofDeleteBufferIO(BufferIO);
fclose(File[J]);
}
return 0;
}
// CHECK-LABEL: Short Strings:
// CHECK: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-NEXT: ABC
// CHECK-LABEL: Long Strings:
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-LABEL: Mixed Strings:
// CHECK: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-NEXT: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
// CHECK-NEXT: ABC
// CHECK-LABEL: Endings:
// CHECK: END
// CHECK-NEXT: ENDEND
// CHECK-NEXT: ENDENDEND
// CHECK-NEXT: ENDENDENDEND
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/ 0000775 0001750 0001750 00000000000 13040224625 024715 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-dlopen.test 0000664 0001750 0001750 00000004727 12645124335 031144 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -o %t.d/func.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections %S/../Inputs/instrprof-dlopen-func.c
RUN: %clang_profgen -o %t.d/func2.shared -fPIC -shared -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections %S/../Inputs/instrprof-dlopen-func2.c
RUN: %clang -o %t-local -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_LOCAL" %S/../Inputs/instrprof-dlopen-main.c
RUN: %clang -o %t-global -fPIC -DDLOPEN_FUNC_DIR=\"%t.d\" -DDLOPEN_FLAGS="RTLD_LAZY | RTLD_GLOBAL" %S/../Inputs/instrprof-dlopen-main.c
RUN: %clang -c -o %t.d/main.o %S/../Inputs/instrprof-dlopen-main.c
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-static %S/../Inputs/instrprof-dlopen-func.c %S/../Inputs/instrprof-dlopen-func2.c %t.d/main.o
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-local.profraw %run %t-local
RUN: env LLVM_PROFILE_FILE=%t-global.profraw %run %t-global
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-local.profdata %t-local.profraw
RUN: llvm-profdata merge -o %t-global.profdata %t-global.profraw
RUN: %clang_profuse=%t-static.profdata -o %t-func.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
RUN: %clang_profuse=%t-local.profdata -o %t-func.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
RUN: %clang_profuse=%t-global.profdata -o %t-func.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func.c
RUN: diff %t-func.static.ll %t-func.local.ll
RUN: diff %t-func.static.ll %t-func.global.ll
RUN: %clang_profuse=%t-static.profdata -o %t-func2.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
RUN: %clang_profuse=%t-local.profdata -o %t-func2.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
RUN: %clang_profuse=%t-global.profdata -o %t-func2.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-func2.c
RUN: diff %t-func2.static.ll %t-func2.local.ll
RUN: diff %t-func2.static.ll %t-func2.global.ll
RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
RUN: %clang_profuse=%t-local.profdata -o %t-main.local.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
RUN: %clang_profuse=%t-local.profdata -o %t-main.global.ll -S -emit-llvm %S/../Inputs/instrprof-dlopen-main.c
RUN: diff %t-main.static.ll %t-main.local.ll
RUN: diff %t-main.static.ll %t-main.global.ll
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/lit.local.cfg 0000664 0001750 0001750 00000001656 12645124335 027276 0 ustar mwhudson mwhudson import subprocess
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
def is_gold_linker_available():
if not config.gold_executable:
return False
try:
ld_cmd = subprocess.Popen([config.gold_executable, '--help'], stdout = subprocess.PIPE)
ld_out = ld_cmd.stdout.read().decode()
ld_cmd.wait()
except:
return False
if not '-plugin' in ld_out:
return False
clang_cmd = subprocess.Popen([config.clang, '-fuse-ld=gold', '-xc', '-'],
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.PIPE)
clang_err = clang_cmd.communicate('int main() { return 0; }')[1]
if not 'invalid linker' in clang_err:
return True
return False
root = getRoot(config)
if root.host_os not in ['Linux'] or not is_gold_linker_available():
config.unsupported = True
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/comdat_rename.test 0000664 0001750 0001750 00000000740 12771264430 030425 0 ustar mwhudson mwhudson // RUN: rm -fr %t.prof
// RUN: %clangxx_pgogen=%t.prof/ -o %t.gen -O2 %S/../Inputs/comdat_rename_1.cc %S/../Inputs/comdat_rename_2.cc
// RUN: %run %t.gen
// RUN: llvm-profdata merge -o %t.profdata %t.prof/
// RUN: %clangxx_profuse=%t.profdata -O2 -emit-llvm -S %S/../Inputs/comdat_rename_1.cc -o - | FileCheck %S/../Inputs/comdat_rename_1.cc
// RUN: %clangxx_profuse=%t.profdata -O2 -emit-llvm -S %S/../Inputs/comdat_rename_2.cc -o - | FileCheck %S/../Inputs/comdat_rename_2.cc
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/coverage_test.cpp 0000664 0001750 0001750 00000004150 12752442526 030266 0 ustar mwhudson mwhudson // RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fcoverage-mapping -Wl,--gc-sections -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s
// BFD linker older than 2.26 has a bug that per-func profile data will be wrongly garbage collected when GC is turned on. We only do end-to-end test here without GC:
// RUN: %clang_profgen -O2 -fcoverage-mapping -o %t.2 %s
// RUN: env LLVM_PROFILE_FILE=%t.2.profraw %run %t.2
// RUN: llvm-profdata merge -o %t.2.profdata %t.2.profraw
// RUN: llvm-cov show %t.2 -instr-profile %t.2.profdata -filename-equivalence 2>&1 | FileCheck %s
// Check covmap is not garbage collected when GC is turned on with BFD linker. Due to the bug mentioned above, we can only
// do the check with objdump:
// RUN: %clang_profgen -O2 -fcoverage-mapping -Wl,--gc-sections -o %t.3 %s
// RUN: llvm-objdump -h %t.3 | FileCheck --check-prefix COVMAP %s
// Check PIE option
// RUN: %clang_profgen -fuse-ld=gold -O2 -fdata-sections -ffunction-sections -fPIE -pie -fcoverage-mapping -Wl,--gc-sections -o %t.pie %s
// RUN: env LLVM_PROFILE_FILE=%t.pie.profraw %run %t.pie
// RUN: llvm-profdata merge -o %t.pie.profdata %t.pie.profraw
// RUN: llvm-cov show %t.pie -instr-profile %t.pie.profdata -filename-equivalence 2>&1 | FileCheck %s
void foo(bool cond) { // CHECK: [[@LINE]]| 1|void foo(
if (cond) { // CHECK: [[@LINE]]| 1| if (cond) {
} // CHECK: [[@LINE]]| 0| }
} // CHECK: [[@LINE]]| 1|}
void bar() { // CHECK: [[@LINE]]| 1|void bar() {
} // CHECK: [[@LINE]]| 1|}
void func() { // CHECK: [[@LINE]]| 0|void func(
} // CHECK: [[@LINE]]| 0|}
int main() { // CHECK: [[@LINE]]| 1|int main(
foo(false); // CHECK: [[@LINE]]| 1| foo(
bar(); // CHECK: [[@LINE]]| 1| bar(
return 0; // CHECK: [[@LINE]]| 1| return
} // CHECK: [[@LINE]]| 1|}
// COVMAP: __llvm_covmap {{.*}}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/coverage_shared.test 0000664 0001750 0001750 00000002354 12656701643 030757 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -fdata-sections -ffunction-sections -fcoverage-mapping -c -o %t.d/a.shared.o -fPIC %S/../Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -fcoverage-mapping -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-static %t.d/a.shared.o %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
RUN: llvm-cov show -instr-profile %t-shared.profdata %t.d/a.shared | FileCheck --check-prefix=COV %S/../Inputs/instrprof-dynamic-a.cpp
RUN: llvm-cov show -instr-profile %t-static.profdata %t-static | FileCheck --check-prefix=COV %S/../Inputs/instrprof-dynamic-a.cpp
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-alloc.test 0000664 0001750 0001750 00000000664 12722075231 030745 0 ustar mwhudson mwhudson // RUN: %clang_profgen -Xclang -fprofile-instrument=llvm -fuse-ld=gold -Wl,-wrap,malloc -Wl,-wrap,calloc -o %t -O3 %S/../Inputs/instrprof-alloc.c
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: %clang_profgen -Xclang -fprofile-instrument=llvm -mllvm -vp-static-alloc=false -fuse-ld=gold -Wl,-wrap,malloc -Wl,-wrap,calloc -o %t.dyn -O3 %S/../Inputs/instrprof-alloc.c
// RUN: env LLVM_PROFILE_FILE=%t.profraw not %run %t.dyn
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-dynamic-two-shared.test 0000664 0001750 0001750 00000003253 12645124335 033353 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/b.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-b.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %t.d/b.shared %S/../Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profgen -o %t-static %S/../Inputs/instrprof-dynamic-a.cpp %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
RUN: diff %t-a.static.ll %t-a.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
RUN: diff %t-b.static.ll %t-b.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
RUN: diff %t-main.static.ll %t-main.shared.ll
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-basic.c 0000664 0001750 0001750 00000001516 12645124335 030200 0 ustar mwhudson mwhudson // RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
int begin(int i) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (i)
return 0;
return 1;
}
int end(int i) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
if (i)
return 0;
return 1;
}
int main(int argc, const char *argv[]) {
begin(0);
end(1);
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
if (argc)
return 0;
return 1;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
// CHECK: ![[PD2]] = !{!"branch_weights", i32 2, i32 1}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/coverage_ctors.cpp 0000664 0001750 0001750 00000001731 12752442526 030443 0 ustar mwhudson mwhudson // RUN: %clangxx_profgen -std=c++11 -fuse-ld=gold -fcoverage-mapping -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s
struct Base {
int B;
Base() : B(0) {}
Base(const Base &b2) {
B = b2.B + 5;
}
Base(Base &&b2) {
B = b2.B + 10;
}
};
struct Derived : public Base {
Derived(const Derived &) = default; // CHECK: [[@LINE]]| 2| Derived(const Derived &) = default;
Derived(Derived &&) = default; // CHECK: [[@LINE]]| 1| Derived(Derived &&) = default;
Derived() = default; // CHECK: [[@LINE]]| 1| Derived() = default
};
Derived dd;
int main() {
Derived dd2(dd);
Derived dd3(dd2);
Derived dd4(static_cast(dd3));
if (dd.B != 0 || dd2.B != 5 || dd3.B != 10 || dd4.B != 20)
return 1; // CHECK: [[@LINE]]| 0| return 1;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-dynamic-one-shared.test 0000664 0001750 0001750 00000003152 12645124335 033321 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t.d/a.shared -fPIC -shared %S/../Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t-static %S/../Inputs/instrprof-dynamic-a.cpp %S/../Inputs/instrprof-dynamic-b.cpp %S/../Inputs/instrprof-dynamic-main.cpp
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-a.cpp
RUN: diff %t-a.static.ll %t-a.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-b.cpp
RUN: diff %t-b.static.ll %t-b.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/../Inputs/instrprof-dynamic-main.cpp
RUN: diff %t-main.static.ll %t-main.shared.ll
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-merge-vp.c 0000664 0001750 0001750 00000005463 12720357763 030655 0 ustar mwhudson mwhudson // RUN: %clang_profgen -mllvm --enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=3 -O2 -o %t %s
// RUN: %run %t %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions --counts --ic-targets %t.profdata > %t.profdump
// RUN: FileCheck --input-file %t.profdump %s --check-prefix=FOO
// RUN: FileCheck --input-file %t.profdump %s --check-prefix=BAR
#include
#include
#include
#include
#include
int __llvm_profile_runtime = 0;
int __llvm_profile_write_file();
void __llvm_profile_reset_counters(void);
void __llvm_profile_merge_from_buffer(const char *, uint64_t);
void __llvm_profile_set_filename(const char *);
struct __llvm_profile_data;
struct ValueProfData;
void lprofMergeValueProfData(struct ValueProfData *, struct __llvm_profile_data *);
/* Force the vp merger module to be linked in. */
void *Dummy = &lprofMergeValueProfData;
void callee1() {}
void callee2() {}
void callee3() {}
typedef void (*FP)(void);
FP Fps[3] = {callee1, callee2, callee3};
void foo(int N) {
int I, J;
for (I = 0; I < 3; I++)
for (J = 0; J < I * 2 + 1; J++)
Fps[I]();
if (N < 2)
return;
for (I = 0; I < 3; I++)
for (J = 0; J < I * 2 + 1; J++)
Fps[2 - I]();
}
/* This function is not profiled */
void bar(void) {
int I;
for (I = 0; I < 20; I++)
Fps[I % 3]();
}
int main(int argc, const char *argv[]) {
int i;
if (argc < 2)
return 1;
const char *FileN = argv[1];
__llvm_profile_set_filename(FileN);
/* Start profiling. */
__llvm_profile_reset_counters();
foo(1);
/* End profiling by freezing counters and
* dump them to the file. */
if (__llvm_profile_write_file())
return 1;
/* Read profile data into buffer. */
FILE *File = fopen(FileN, "r");
if (!File)
return 1;
fseek(File, 0, SEEK_END);
uint64_t Size = ftell(File);
fseek(File, 0, SEEK_SET);
char *Buffer = (char *)malloc(Size);
if (Size != fread(Buffer, 1, Size, File))
return 1;
fclose(File);
/* Its profile will be discarded. */
for (i = 0; i < 10; i++)
bar();
/* Start profiling again and merge in previously
saved counters in buffer. */
__llvm_profile_reset_counters();
__llvm_profile_merge_from_buffer(Buffer, Size);
foo(2);
/* End profiling. */
truncate(FileN, 0);
if (__llvm_profile_write_file())
return 1;
/* Its profile will be discarded. */
bar();
return 0;
}
// FOO-LABEL: foo:
// FOO: Indirect Target Results:
// FOO-NEXT: [ 0, callee3, 10 ]
// FOO-NEXT: [ 0, callee2, 6 ]
// FOO-NEXT: [ 0, callee1, 2 ]
// FOO-NEXT: [ 1, callee1, 5 ]
// FOO-NEXT: [ 1, callee2, 3 ]
// FOO-NEXT: [ 1, callee3, 1 ]
// BAR-LABEL: bar:
// BAR: [ 0, callee1, 0 ]
// BAR-NEXT: [ 0, callee2, 0 ]
// BAR-NEXT: [ 0, callee3, 0 ]
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/extern_template.test 0000664 0001750 0001750 00000002304 12771264430 031025 0 ustar mwhudson mwhudson // RUN: %clang -O2 -c -o %t.0.o %S/../Inputs/extern_template.cpp
// RUN: %clang_profgen -O2 -c -o %t.o %S/../Inputs/extern_template.cpp
// RUN: %clang_profgen -O2 -fcoverage-mapping %S/../Inputs/extern_template1.cpp %S/../Inputs/extern_template2.cpp %t.o -o %t
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata show --all-functions %t.profraw | FileCheck %s
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show -instr-profile=%t.profdata %t | FileCheck %S/../Inputs/extern_template.h
// RUN: %clang_profgen -O2 -fcoverage-mapping %S/../Inputs/extern_template1.cpp %S/../Inputs/extern_template2.cpp %t.0.o -o %t.0
// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t.0
// RUN: llvm-profdata show --all-functions %t.0.profraw | FileCheck %s
// RUN: llvm-profdata merge -o %t.0.profdata %t.0.profraw
// RUN: llvm-cov show -instr-profile=%t.0.profdata %t.0 | FileCheck %S/../Inputs/extern_template.h
#define DEF
#include "extern_template.h"
#undef DEF
extern int bar();
extern int foo();
extern Test TO;
int main() {
foo();
int R = bar();
if (R != 10)
return 1;
return 0;
}
// No duplicate entries
// CHECK: _ZN4TestIiE4doItEi:
// CHECK-NOT: _ZN4TestIiE4doItEi:
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-cs.c 0000664 0001750 0001750 00000002257 12771264430 027530 0 ustar mwhudson mwhudson // RUN: rm -fr %t.prof
// RUN: %clang_pgogen=%t.prof/ -o %t.gen.cs -O2 %s
// RUN: %run %t.gen.cs
// RUN: llvm-profdata merge -o %t.cs.profdata %t.prof/
// Check context sensitive profile
// RUN: %clang_profuse=%t.cs.profdata -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CS
//
// RUN: %clang_profgen=%t.profraw -o %t.gen.cis -O2 %s
// RUN: %run %t.gen.cis
// RUN: llvm-profdata merge -o %t.cis.profdata %t.profraw
// Check context insenstive profile
// RUN: %clang_profuse=%t.cis.profdata -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CIS
int g1 = 1;
int volatile g2 = 2;
static void toggle(int t) {
if (t & 1)
g1 *= t;
else
g2 *= t;
}
int main() {
int i;
// CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
// CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]
toggle(g1);
// CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
// CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]
toggle(g2);
return 0;
}
// CS: ![[PD1]] = !{!"branch_weights", i32 0, i32 1}
// CS: ![[PD2]] = !{!"branch_weights", i32 1, i32 0}
// CIS: ![[PD]] = !{!"branch_weights", i32 2, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/coverage_dtor.cpp 0000664 0001750 0001750 00000001242 12752442526 030256 0 ustar mwhudson mwhudson // RUN: %clang_profgen -x c++ -fno-exceptions -std=c++11 -fuse-ld=gold -fcoverage-mapping -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-cov show %t -instr-profile %t.profdata -filename-equivalence 2>&1 | FileCheck %s
int g = 100;
struct Base {
int B;
Base(int B_) : B(B_) {}
~Base() { g -= B; }
};
struct Derived : public Base {
Derived(int K) : Base(K) {}
~Derived() = default; // CHECK: [[@LINE]]| 2| ~Derived() = default;
};
int main() {
{
Derived dd(10);
Derived dd2(90);
}
if (g != 0)
return 1; // CHECK: [[@LINE]]| 0| return 1;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-value-prof-warn.test 0000664 0001750 0001750 00000001121 12722216736 032674 0 ustar mwhudson mwhudson RUN: %clang_profgen -O2 -mllvm -disable-vp=false -Xclang -fprofile-instrument=llvm -mllvm -vp-static-alloc=true -DSTRESS=1 -o %t.ir.warn %S/../Inputs/instrprof-value-prof-real.c
RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.warn 2>&1 |FileCheck --check-prefix=WARNING %s
# Test that enough static counters have been allocated
RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=150 %run %t.ir.warn 2>&1 |FileCheck --check-prefix=NOWARNING --allow-empty %s
# WARNING: LLVM Profile Warning:
# NOWARNING-NOT: LLVM Profile Warning:
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-comdat.test 0000664 0001750 0001750 00000000665 12771264430 031130 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clangxx_profgen -o %t.d/comdat -fcoverage-mapping -fuse-ld=gold %S/../Inputs/instrprof-comdat-1.cpp %S/../Inputs/instrprof-comdat-2.cpp
RUN: LLVM_PROFILE_FILE=%t-comdat.profraw %run %t.d/comdat
RUN: llvm-profdata merge -o %t.d/comdat.prof %t-comdat.profraw
RUN: llvm-cov show --filename-equivalence --instr-profile=%t.d/comdat.prof %t.d/comdat | FileCheck --check-prefix=HEADER %S/../Inputs/instrprof-comdat.h
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Linux/instrprof-file_ex.test 0000664 0001750 0001750 00000001013 12725403756 031265 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -fprofile-instr-generate %S/../Inputs/instrprof-file_ex.c -o %t
RUN: rm -f %t.d/run.dump
RUN: %run %t %t.d/run.dump
RUN: sort %t.d/run.dump | FileCheck %s
CHECK: Dump from Child 0
CHECK-NEXT: Dump from Child 1
CHECK-NEXT: Dump from Child 2
CHECK-NEXT: Dump from Child 3
CHECK-NEXT: Dump from Child 4
CHECK-NEXT: Dump from Child 5
CHECK-NEXT: Dump from Child 6
CHECK-NEXT: Dump from Child 7
CHECK-NEXT: Dump from Child 8
CHECK-NEXT: Dump from Child 9
CHECK-NEXT: Dump from parent 10
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-value-prof-2.c 0000664 0001750 0001750 00000013207 12703522677 030245 0 ustar mwhudson mwhudson // RUN: %clang_profgen -O2 -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata > %t.out
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-1 < %t.out
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-2 < %t.out
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-3 < %t.out
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-4 < %t.out
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-5 < %t.out
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-6 < %t.out
#include
#include
#include
typedef struct __llvm_profile_data __llvm_profile_data;
const __llvm_profile_data *__llvm_profile_begin_data(void);
const __llvm_profile_data *__llvm_profile_end_data(void);
void __llvm_profile_set_num_value_sites(__llvm_profile_data *Data,
uint32_t ValueKind,
uint16_t NumValueSites);
__llvm_profile_data *
__llvm_profile_iterate_data(const __llvm_profile_data *Data);
void *__llvm_get_function_addr(const __llvm_profile_data *Data);
void __llvm_profile_instrument_target(uint64_t TargetValue, void *Data,
uint32_t CounterIndex);
void callee1() {}
void callee2() {}
void caller_without_value_site1() {}
void caller_with_value_site_never_called1() {}
void caller_with_vp1() {}
void caller_with_value_site_never_called2() {}
void caller_without_value_site2() {}
void caller_with_vp2() {}
void (*callee1Ptr)();
void (*callee2Ptr)();
void __attribute__ ((noinline)) setFunctionPointers () {
callee1Ptr = callee1;
callee2Ptr = callee2;
}
int main(int argc, const char *argv[]) {
unsigned S, NS = 10, V;
const __llvm_profile_data *Data, *DataEnd;
setFunctionPointers();
Data = __llvm_profile_begin_data();
DataEnd = __llvm_profile_end_data();
for (; Data < DataEnd; Data = __llvm_profile_iterate_data(Data)) {
void *func = __llvm_get_function_addr(Data);
if (func == caller_without_value_site1 ||
func == caller_without_value_site2 ||
func == callee1 || func == callee2 || func == main)
continue;
__llvm_profile_set_num_value_sites((__llvm_profile_data *)Data,
0 /*IPVK_IndirectCallTarget */, 10);
if (func == caller_with_value_site_never_called1 ||
func == caller_with_value_site_never_called2)
continue;
for (S = 0; S < NS; S++) {
unsigned C;
for (C = 0; C < S + 1; C++) {
__llvm_profile_instrument_target((uint64_t)callee1Ptr, (void *)Data, S);
if (C % 2 == 0)
__llvm_profile_instrument_target((uint64_t)callee2Ptr, (void *)Data, S);
}
}
}
}
// CHECK-1-LABEL: caller_with_value_site_never_called2:
// CHECK-1-NEXT: Hash: 0x0000000000000000
// CHECK-1-NEXT: Counters:
// CHECK-1-NEXT: Function count
// CHECK-1-NEXT: Indirect Call Site Count: 10
// CHECK-1-NEXT: Indirect Target Results:
// CHECK-2-LABEL: caller_with_vp2:
// CHECK-2-NEXT: Hash: 0x0000000000000000
// CHECK-2-NEXT: Counters:
// CHECK-2-NEXT: Function count:
// CHECK-2-NEXT: Indirect Call Site Count: 10
// CHECK-2-NEXT: Indirect Target Results:
// CHECK-2-NEXT: [ 0, callee1, 1 ]
// CHECK-2-NEXT: [ 0, callee2, 1 ]
// CHECK-2-NEXT: [ 1, callee1, 2 ]
// CHECK-2-NEXT: [ 1, callee2, 1 ]
// CHECK-2-NEXT: [ 2, callee1, 3 ]
// CHECK-2-NEXT: [ 2, callee2, 2 ]
// CHECK-2-NEXT: [ 3, callee1, 4 ]
// CHECK-2-NEXT: [ 3, callee2, 2 ]
// CHECK-2-NEXT: [ 4, callee1, 5 ]
// CHECK-2-NEXT: [ 4, callee2, 3 ]
// CHECK-2-NEXT: [ 5, callee1, 6 ]
// CHECK-2-NEXT: [ 5, callee2, 3 ]
// CHECK-2-NEXT: [ 6, callee1, 7 ]
// CHECK-2-NEXT: [ 6, callee2, 4 ]
// CHECK-2-NEXT: [ 7, callee1, 8 ]
// CHECK-2-NEXT: [ 7, callee2, 4 ]
// CHECK-2-NEXT: [ 8, callee1, 9 ]
// CHECK-2-NEXT: [ 8, callee2, 5 ]
// CHECK-2-NEXT: [ 9, callee1, 10 ]
// CHECK-2-NEXT: [ 9, callee2, 5 ]
// CHECK-3-LABEL: caller_with_vp1:
// CHECK-3-NEXT: Hash: 0x0000000000000000
// CHECK-3-NEXT: Counters:
// CHECK-3-NEXT: Function count
// CHECK-3-NEXT: Indirect Call Site Count: 10
// CHECK-3-NEXT: Indirect Target Results:
// CHECK-3-NEXT: [ 0, callee1, 1 ]
// CHECK-3-NEXT: [ 0, callee2, 1 ]
// CHECK-3-NEXT: [ 1, callee1, 2 ]
// CHECK-3-NEXT: [ 1, callee2, 1 ]
// CHECK-3-NEXT: [ 2, callee1, 3 ]
// CHECK-3-NEXT: [ 2, callee2, 2 ]
// CHECK-3-NEXT: [ 3, callee1, 4 ]
// CHECK-3-NEXT: [ 3, callee2, 2 ]
// CHECK-3-NEXT: [ 4, callee1, 5 ]
// CHECK-3-NEXT: [ 4, callee2, 3 ]
// CHECK-3-NEXT: [ 5, callee1, 6 ]
// CHECK-3-NEXT: [ 5, callee2, 3 ]
// CHECK-3-NEXT: [ 6, callee1, 7 ]
// CHECK-3-NEXT: [ 6, callee2, 4 ]
// CHECK-3-NEXT: [ 7, callee1, 8 ]
// CHECK-3-NEXT: [ 7, callee2, 4 ]
// CHECK-3-NEXT: [ 8, callee1, 9 ]
// CHECK-3-NEXT: [ 8, callee2, 5 ]
// CHECK-3-NEXT: [ 9, callee1, 10 ]
// CHECK-3-NEXT: [ 9, callee2, 5 ]
// CHECK-4-LABEL: caller_with_value_site_never_called1:
// CHECK-4-NEXT: Hash: 0x0000000000000000
// CHECK-4-NEXT: Counters:
// CHECK-4-NEXT: Function count:
// CHECK-4-NEXT: Indirect Call Site Count: 10
// CHECK-4-NEXT: Indirect Target Results:
// CHECK-5-LABEL: caller_without_value_site2:
// CHECK-5-NEXT: Hash: 0x0000000000000000
// CHECK-5-NEXT: Counters:
// CHECK-5-NEXT: Function count:
// CHECK-5-NEXT: Indirect Call Site Count: 0
// CHECK-5-NEXT: Indirect Target Results:
// CHECK-6-LABEL: caller_without_value_site1:
// CHECK-6-NEXT: Hash: 0x0000000000000000
// CHECK-6-NEXT: Counters:
// CHECK-6-NEXT: Function count:
// CHECK-6-NEXT: Indirect Call Site Count: 0
// CHECK-6-NEXT: Indirect Target Results:
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-reset-counters.c 0000664 0001750 0001750 00000001056 12443651733 031004 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
void __llvm_profile_reset_counters(void);
void foo(int);
int main(void) {
foo(0);
__llvm_profile_reset_counters();
foo(1);
return 0;
}
void foo(int N) {
// CHECK-LABEL: define void @foo(
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[FOO:[0-9]+]]
if (N) {}
}
// CHECK: ![[FOO]] = !{!"branch_weights", i32 2, i32 1}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-visibility-kinds.inc 0000664 0001750 0001750 00000000760 12675350047 031650 0 ustar mwhudson mwhudson void f1() {}
#ifndef NO_WEAK
void f2() __attribute__((weak));
void f2() {}
#endif
void f3() __attribute__((always_inline));
void f3() {}
#ifndef NO_EXTERN
extern void f4();
#endif
void f5() __attribute__((visibility("default")));
void f5() {}
void f6() __attribute__((visibility("hidden")));
void f6() {}
void f7() __attribute__((visibility("internal")));
void f7() {}
void call() {
f1();
#ifndef NO_WEAK
f2();
#endif
f3();
#ifndef NO_EXTERN
f4();
#endif
f5();
f6();
f7();
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-merge-match.test 0000664 0001750 0001750 00000000334 12666355326 030754 0 ustar mwhudson mwhudson // RUN: mkdir -p %t.d
// RUN: %clang_profgen -o %t.d/libt.so -fPIC -shared %S/Inputs/instrprof-merge-match-lib.c
// RUN: %clang_profgen -o %t -L %t.d -rpath %t.d %S/Inputs/instrprof-merge-match.c -lt
// RUN: %run %t
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-value-prof-evict.test 0000664 0001750 0001750 00000002356 12743522660 031752 0 ustar mwhudson mwhudson // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=10 -o %t %S/Inputs/instrprof-value-prof-evict.c
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c
// IR level instrumentation
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=10 -o %t.ir %S/Inputs/instrprof-value-prof-evict.c
// RUN: env LLVM_PROFILE_FILE=%t.ir.profraw %run %t.ir
// RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c
// IR level instrumentation, dynamic allocation
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -o %t.ir.dyn %S/Inputs/instrprof-value-prof-evict.c
// RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn
// RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-evict.c
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-value-prof.c 0000664 0001750 0001750 00000022724 12720163561 030102 0 ustar mwhudson mwhudson // RUN: %clang_profgen -mllvm -vp-static-alloc=false -O2 -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: env LLVM_PROFILE_FILE=%t-2.profraw %run %t DO_NOT_INSTRUMENT
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata merge -o %t-2.profdata %t-2.profraw
// RUN: llvm-profdata merge -o %t-merged.profdata %t.profraw %t-2.profdata
// RUN: llvm-profdata show --all-functions -ic-targets %t-2.profdata | FileCheck %s -check-prefix=NO-VALUE
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %s
// RUN: llvm-profdata show --all-functions -ic-targets %t-merged.profdata | FileCheck %s
//
// RUN: env LLVM_PROFILE_FILE=%t-3.profraw LLVM_VP_BUFFER_SIZE=1 %run %t
// RUN: env LLVM_PROFILE_FILE=%t-4.profraw LLVM_VP_BUFFER_SIZE=8 %run %t
// RUN: env LLVM_PROFILE_FILE=%t-5.profraw LLVM_VP_BUFFER_SIZE=128 %run %t
// RUN: env LLVM_PROFILE_FILE=%t-6.profraw LLVM_VP_BUFFER_SIZE=1024 %run %t
// RUN: env LLVM_PROFILE_FILE=%t-7.profraw LLVM_VP_BUFFER_SIZE=102400 %run %t
// RUN: llvm-profdata merge -o %t-3.profdata %t-3.profraw
// RUN: llvm-profdata merge -o %t-4.profdata %t-4.profraw
// RUN: llvm-profdata merge -o %t-5.profdata %t-5.profraw
// RUN: llvm-profdata merge -o %t-6.profdata %t-6.profraw
// RUN: llvm-profdata merge -o %t-7.profdata %t-7.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t-3.profdata | FileCheck %s
// RUN: llvm-profdata show --all-functions -ic-targets %t-4.profdata | FileCheck %s
// RUN: llvm-profdata show --all-functions -ic-targets %t-5.profdata | FileCheck %s
// RUN: llvm-profdata show --all-functions -ic-targets %t-6.profdata | FileCheck %s
// RUN: llvm-profdata show --all-functions -ic-targets %t-7.profdata | FileCheck %s
#include
#include
#include
typedef struct __llvm_profile_data __llvm_profile_data;
const __llvm_profile_data *__llvm_profile_begin_data(void);
const __llvm_profile_data *__llvm_profile_end_data(void);
void __llvm_profile_set_num_value_sites(__llvm_profile_data *Data,
uint32_t ValueKind,
uint16_t NumValueSites);
__llvm_profile_data *
__llvm_profile_iterate_data(const __llvm_profile_data *Data);
void *__llvm_get_function_addr(const __llvm_profile_data *Data);
void __llvm_profile_instrument_target(uint64_t TargetValue, void *Data,
uint32_t CounterIndex);
#define DEF_FUNC(x) \
void x() {}
#define DEF_2_FUNCS(x) DEF_FUNC(x##_1) DEF_FUNC(x##_2)
#define DEF_4_FUNCS(x) DEF_2_FUNCS(x##_1) DEF_2_FUNCS(x##_2)
#define DEF_8_FUNCS(x) DEF_4_FUNCS(x##_1) DEF_4_FUNCS(x##_2)
#define DEF_16_FUNCS(x) DEF_8_FUNCS(x##_1) DEF_8_FUNCS(x##_2)
#define DEF_32_FUNCS(x) DEF_16_FUNCS(x##_1) DEF_16_FUNCS(x##_2)
#define DEF_64_FUNCS(x) DEF_32_FUNCS(x##_1) DEF_32_FUNCS(x##_2)
#define DEF_128_FUNCS(x) DEF_64_FUNCS(x##_1) DEF_64_FUNCS(x##_2)
#define FUNC_ADDR(x) &x,
#define FUNC_2_ADDRS(x) FUNC_ADDR(x##_1) FUNC_ADDR(x##_2)
#define FUNC_4_ADDRS(x) FUNC_2_ADDRS(x##_1) FUNC_2_ADDRS(x##_2)
#define FUNC_8_ADDRS(x) FUNC_4_ADDRS(x##_1) FUNC_4_ADDRS(x##_2)
#define FUNC_16_ADDRS(x) FUNC_8_ADDRS(x##_1) FUNC_8_ADDRS(x##_2)
#define FUNC_32_ADDRS(x) FUNC_16_ADDRS(x##_1) FUNC_16_ADDRS(x##_2)
#define FUNC_64_ADDRS(x) FUNC_32_ADDRS(x##_1) FUNC_32_ADDRS(x##_2)
#define FUNC_128_ADDRS(x) FUNC_64_ADDRS(x##_1) FUNC_64_ADDRS(x##_2)
DEF_8_FUNCS(callee)
DEF_128_FUNCS(caller)
void *CallerAddrs[] = {FUNC_128_ADDRS(caller)};
void *CalleeAddrs[] = {FUNC_8_ADDRS(callee)};
typedef struct CallerInfo {
void *CallerAddr;
uint32_t NS; /* Number value sites. */
} CallerInfo;
CallerInfo CallerInfos[128];
int cmpaddr(const void *p1, const void *p2) {
CallerInfo *addr1 = (CallerInfo *)p1;
CallerInfo *addr2 = (CallerInfo *)p2;
return (intptr_t)addr2->CallerAddr - (intptr_t)addr1->CallerAddr;
}
int main(int argc, const char *argv[]) {
unsigned S, NS = 0, I, V, doInstrument = 1;
const __llvm_profile_data *Data, *DataEnd;
if (argc >= 2 && !strcmp(argv[1], "DO_NOT_INSTRUMENT"))
doInstrument = 0;
for (I = 0; I < 128; I++) {
CallerInfos[I].CallerAddr = CallerAddrs[I];
CallerInfos[I].NS = I;
}
qsort(CallerInfos, sizeof(CallerInfos) / sizeof(CallerInfo), sizeof(CallerInfo),
cmpaddr);
/* We will synthesis value profile data for 128 callers functions declared.
* The number of value sites for each caller function is recorded in
* the NS field of the CallerInfo object. For each value site, the number of
* callee values is determined by the site index (modulo 8). The frequency
* of each callee target synthesized is equal to V + 1, in which V is the
* index of the target value for the callsite. */
Data = __llvm_profile_begin_data();
DataEnd = __llvm_profile_end_data();
for (; Data < DataEnd; Data = __llvm_profile_iterate_data(Data)) {
void *func = __llvm_get_function_addr(Data);
CallerInfo Key, *Res;
Key.CallerAddr = func;
Res = (CallerInfo *) bsearch(&Key, CallerInfos, sizeof(CallerInfos) / sizeof(CallerInfo),
sizeof(CallerInfo), cmpaddr);
if (Res) {
NS = Res->NS;
__llvm_profile_set_num_value_sites((__llvm_profile_data *)Data,
0 /*IPVK_IndirectCallTarget */, NS);
if (!doInstrument) {
continue;
}
for (S = 0; S < NS; S++) {
for (V = 0; V < S % 8; V++) {
unsigned C;
for (C = 0; C < V + 1; C++)
__llvm_profile_instrument_target((uint64_t)CalleeAddrs[V],
(void *)Data, S);
}
}
}
}
}
// NO-VALUE: Indirect Call Site Count: 127
// NO-VALUE-NEXT: Indirect Target Results:
// CHECK-LABEL: caller_1_1_1_1_2_2_1:
// CHECK: Indirect Call Site Count: 6
// CHECK-NEXT: Indirect Target Results:
// CHECK-NEXT: [ 1, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 2, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 2, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 3, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 3, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 3, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 4, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 4, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 4, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 4, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 5, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 5, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 5, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 5, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 5, callee_1_1_1, 1 ]
// CHECK-LABEL: caller_2_2_2_2_2_2_2:
// CHECK: Indirect Call Site Count: 127
// CHECK-NEXT: Indirect Target Results:
// CHECK-NEXT: [ 1, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 2, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 2, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 3, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 3, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 3, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 4, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 4, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 4, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 4, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 5, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 5, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 5, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 5, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 5, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 6, callee_2_1_2, 6 ]
// CHECK-NEXT: [ 6, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 6, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 6, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 6, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 6, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 7, callee_2_2_1, 7 ]
// CHECK-NEXT: [ 7, callee_2_1_2, 6 ]
// CHECK-NEXT: [ 7, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 7, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 7, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 7, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 7, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 9, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 10, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 10, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 11, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 11, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 11, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 12, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 12, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 12, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 12, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 13, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 13, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 13, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 13, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 13, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 14, callee_2_1_2, 6 ]
// CHECK-NEXT: [ 14, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 14, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 14, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 14, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 14, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 15, callee_2_2_1, 7 ]
// CHECK-NEXT: [ 15, callee_2_1_2, 6 ]
// CHECK-NEXT: [ 15, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 15, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 15, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 15, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 15, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 17, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 18, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 18, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 19, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 19, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 19, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 20, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 20, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 20, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 20, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 21, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 21, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 21, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 21, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 21, callee_1_1_1, 1 ]
// CHECK-NEXT: [ 22, callee_2_1_2, 6 ]
// CHECK-NEXT: [ 22, callee_2_1_1, 5 ]
// CHECK-NEXT: [ 22, callee_1_2_2, 4 ]
// CHECK-NEXT: [ 22, callee_1_2_1, 3 ]
// CHECK-NEXT: [ 22, callee_1_1_2, 2 ]
// CHECK-NEXT: [ 22, callee_1_1_1, 1 ]
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-icall-promo.test 0000664 0001750 0001750 00000001527 12743522660 030777 0 ustar mwhudson mwhudson # IR based instrumentation
RUN: %clangxx_pgogen -O2 -c -o %t.1.o %S/Inputs/instrprof-icall-promo_1.cc
RUN: %clangxx_pgogen -O2 -c -o %t.2.o %S/Inputs/instrprof-icall-promo_2.cc
RUN: %clangxx_pgogen -O2 %t.2.o %t.1.o -o %t.gen.1
RUN: env LLVM_PROFILE_FILE=%t-icall.profraw %run %t.gen.1
RUN: llvm-profdata merge -o %t-icall.profdata %t-icall.profraw
RUN: %clangxx_profuse=%t-icall.profdata -O2 -Rpass=pgo-icall-prom -c -o %t.2.use.o %S/Inputs/instrprof-icall-promo_2.cc 2>&1 | FileCheck %s
RUN: %clangxx_pgogen -O2 %t.1.o %t.2.o -o %t.gen.2
RUN: env LLVM_PROFILE_FILE=%t-icall2.profraw %run %t.gen.2
RUN: llvm-profdata merge -o %t-icall2.profdata %t-icall2.profraw
RUN: %clangxx_profuse=%t-icall2.profdata -O2 -Rpass=pgo-icall-prom -c -o %t.2.use.o %S/Inputs/instrprof-icall-promo_2.cc 2>&1 | FileCheck %s
# CHECK: Promote indirect call to
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-darwin-dead-strip.c 0000664 0001750 0001750 00000005000 12777257100 031331 0 ustar mwhudson mwhudson // REQUIRES: osx-ld64-live_support
// REQUIRES: lto
// RUN: %clang_profgen=%t.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -Wl,-dead_strip -o %t %s
// RUN: %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions %t.profdata | FileCheck %s -check-prefix=PROF
// RUN: llvm-cov show %t -instr-profile %t.profdata | FileCheck %s -check-prefix=COV
// RUN: nm %t | FileCheck %s -check-prefix=NM
// RUN: otool -s __DATA __llvm_prf_names %t | FileCheck %s -check-prefix=PRF_NAMES
// RUN: otool -s __DATA __llvm_prf_cnts %t | FileCheck %s -check-prefix=PRF_CNTS
// RUN: %clang_lto_profgen=%t.lto.profraw -fcoverage-mapping -mllvm -enable-name-compression=false -Wl,-dead_strip -flto -o %t.lto %s
// RUN: %run %t.lto
// RUN: llvm-profdata merge -o %t.lto.profdata %t.lto.profraw
// RUN: llvm-profdata show --all-functions %t.lto.profdata | FileCheck %s -check-prefix=PROF
// RUN: llvm-cov show %t.lto -instr-profile %t.lto.profdata | FileCheck %s -check-prefix=COV
// RUN: nm %t.lto | FileCheck %s -check-prefix=NM
// RUN: otool -s __DATA __llvm_prf_names %t.lto | FileCheck %s -check-prefix=PRF_NAMES
// RUN: otool -s __DATA __llvm_prf_cnts %t.lto | FileCheck %s -check-prefix=PRF_CNTS
// Note: We expect foo() and some of the profiling data associated with it to
// be dead-stripped.
// COV: [[@LINE+1]]{{ *}}|{{ *}}0|void foo()
void foo() {}
// COV: [[@LINE+1]]{{ *}}|{{ *}}1|int main
int main() { return 0; }
// NM-NOT: foo
// PROF: Counters:
// PROF-NEXT: main:
// PROF-NEXT: Hash:
// PROF-NEXT: Counters: 1
// PROF-NEXT: Function count: 1
// PROF-NEXT: Functions shown: 1
// PROF-NEXT: Total functions: 1
// PROF-NEXT: Maximum function count: 1
// PROF-NEXT: Maximum internal block count: 0
// Note: We don't expect the names of dead-stripped functions to disappear from
// __llvm_prf_names, because collectPGOFuncNameStrings() glues the names
// together.
// PRF_NAMES: Contents of (__DATA,__llvm_prf_names) section
// PRF_NAMES-NEXT: {{.*}} 08 00 66 6f 6f 01 6d 61 69 6e{{ +$}}
// | | f o o # m a i n
// | |___________|
// | |
// UncompressedLen = 8 |
// |
// CompressedLen = 0
// Note: We expect the profile counters for dead-stripped functions to also be
// dead-stripped.
// PRF_CNTS: Contents of (__DATA,__llvm_prf_cnts) section
// PRF_CNTS-NEXT: {{.*}} 00 00 00 00 00 00 00 00{{ +$}}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/CMakeLists.txt 0000664 0001750 0001750 00000002425 12741012374 026364 0 ustar mwhudson mwhudson set(PROFILE_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(PROFILE_LIT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(PROFILE_TESTSUITES)
set(PROFILE_TEST_DEPS ${SANITIZER_COMMON_LIT_TEST_DEPS})
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND PROFILE_TEST_DEPS profile llvm-profdata llvm-cov)
endif()
set(PROFILE_TEST_ARCH ${PROFILE_SUPPORTED_ARCH})
if(APPLE)
darwin_filter_host_archs(PROFILE_SUPPORTED_ARCH PROFILE_TEST_ARCH)
endif()
foreach(arch ${PROFILE_TEST_ARCH})
set(PROFILE_TEST_TARGET_ARCH ${arch})
if(${arch} MATCHES "arm|aarch64")
# This is only true if we're cross-compiling.
set(PROFILE_TEST_TARGET_CFLAGS ${COMPILER_RT_TEST_COMPILER_CFLAGS})
else()
get_target_flags_for_arch(${arch} PROFILE_TEST_TARGET_CFLAGS)
string(REPLACE ";" " " PROFILE_TEST_TARGET_CFLAGS "${PROFILE_TEST_TARGET_CFLAGS}")
endif()
set(CONFIG_NAME Profile-${arch})
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg
)
list(APPEND PROFILE_TESTSUITES ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME})
endforeach()
add_lit_testsuite(check-profile "Running the profile tests"
${PROFILE_TESTSUITES}
DEPENDS ${PROFILE_TEST_DEPS})
set_target_properties(check-profile PROPERTIES FOLDER "Compiler-RT Misc")
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-hostname.c 0000664 0001750 0001750 00000001012 12733270433 027624 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%h.%t-%h.profraw_%h %run %t
// RUN: %run uname -n > %t.n
// RUN: llvm-profdata merge -o %t.profdata `cat %t.n`.%t-`cat %t.n`.profraw_`cat %t.n`
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
// REQUIRES: shell
int main(int argc, const char *argv[]) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc > 2)
return 1;
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-override-filename-with-env.c 0000664 0001750 0001750 00000000760 12744254166 033162 0 ustar mwhudson mwhudson // RUN: %clang_profgen=%t.bad.profraw -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.good.profraw %run %t %t.bad.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.good.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
void bar () {}
int main(int argc, const char *argv[]) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
bar();
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/lit.site.cfg.in 0000664 0001750 0001750 00000000745 12704361721 026452 0 ustar mwhudson mwhudson @LIT_SITE_CFG_IN_HEADER@
# Tool-specific config options.
config.profile_lit_binary_dir = "@PROFILE_LIT_BINARY_DIR@"
config.target_cflags = "@PROFILE_TEST_TARGET_CFLAGS@"
config.target_arch = "@PROFILE_TEST_TARGET_ARCH@"
# Load common config for all compiler-rt lit tests.
lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")
# Load tool-specific config that would do the real work.
lit_config.load_config(config, "@PROFILE_LIT_SOURCE_DIR@/lit.cfg")
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-override-filename.c 0000664 0001750 0001750 00000000674 12744254166 031427 0 ustar mwhudson mwhudson // RUN: %clang_profgen=%t.profraw -o %t -O3 %s
// RUN: %run %t %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
void bar() {}
int main(int argc, const char *argv[]) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
bar();
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/gcc-flag-compatibility.test 0000664 0001750 0001750 00000001404 12744030037 031032 0 ustar mwhudson mwhudson RUN: rm -rf %t.d
RUN: mkdir -p %t.d
RUN: %clang_profgen_gcc=%t.d/d1/d2 -o %t.d/code %S/Inputs/gcc-flag-compatibility.c
# Test that the instrumented code writes to %t.d/d1/d2/
RUN: %run %t.d/code
RUN: llvm-profdata merge -o %t.profdata %t.d/d1/d2/
# Test that we can override the directory and file name with LLVM_PROFILE_FILE.
RUN: env LLVM_PROFILE_FILE=%t.d/x1/prof.raw %run %t.d/code
RUN: llvm-profdata merge -o %t.profdata %t.d/x1/
# Test that we can specify a directory with -fprofile-use.
RUN: llvm-profdata merge -o %t.d/default.profdata %t.d/x1/
RUN: %clang_profuse_gcc=%t.d -o %t.d/code %S/Inputs/gcc-flag-compatibility.c
# Test that we can specify a file with -fprofile-use.
RUN: %clang_profuse_gcc=%t.profdata -o %t.d/code %S/Inputs/gcc-flag-compatibility.c
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-dynamic-two-shared.test 0000664 0001750 0001750 00000002673 12335307355 032262 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -o %t.d/a.shared -fPIC -shared %S/Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profgen -o %t.d/b.shared -fPIC -shared %S/Inputs/instrprof-dynamic-b.cpp
RUN: %clang_profgen -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %t.d/b.shared %S/Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profgen -o %t-static %S/Inputs/instrprof-dynamic-a.cpp %S/Inputs/instrprof-dynamic-b.cpp %S/Inputs/instrprof-dynamic-main.cpp
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-a.cpp
RUN: diff %t-a.static.ll %t-a.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-b.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-b.cpp
RUN: diff %t-b.static.ll %t-b.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-main.cpp
RUN: diff %t-main.static.ll %t-main.shared.ll
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-value-prof.test 0000664 0001750 0001750 00000003244 12743522660 030637 0 ustar mwhudson mwhudson // RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// IR level instrumentation
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t.ir %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir
// RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata merge -text %t.ir.profdata -o %t.ir.proftxt
// RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt
// IR level instrumentation with dynamic memory allocation
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -o %t.ir.dyn %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn
// RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata merge -text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt
// RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-basic.c 0000664 0001750 0001750 00000005147 12744527222 027107 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=ORIG
//
// RUN: rm -fr %t.dir1
// RUN: mkdir -p %t.dir1
// RUN: env LLVM_PROFILE_FILE=%t.dir1/profraw_e_%1m %run %t
// RUN: env LLVM_PROFILE_FILE=%t.dir1/profraw_e_%1m %run %t
// RUN: llvm-profdata merge -o %t.em.profdata %t.dir1
// RUN: %clang_profuse=%t.em.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=MERGE
//
// RUN: rm -fr %t.dir2
// RUN: mkdir -p %t.dir2
// RUN: %clang_profgen=%t.dir2/%m.profraw -o %t.merge -O3 %s
// RUN: %run %t.merge
// RUN: %run %t.merge
// RUN: llvm-profdata merge -o %t.m.profdata %t.dir2/
// RUN: %clang_profuse=%t.m.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=MERGE
//
// Test that merging is enabled by default with -fprofile-generate=
// RUN: rm -fr %t.dir3
// RUN: mkdir -p %t.dir3
// RUN: %clang_pgogen=%t.dir3/ -o %t.merge3 -O0 %s
// RUN: %run %t.merge3
// RUN: %run %t.merge3
// RUN: %run %t.merge3
// RUN: %run %t.merge3
// RUN: llvm-profdata merge -o %t.m3.profdata %t.dir3/
// RUN: %clang_profuse=%t.m3.profdata -O0 -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=PGOMERGE
//
// Test that merging is enabled by default with -fprofile-generate
// RUN: rm -fr %t.dir4
// RUN: mkdir -p %t.dir4
// RUN: %clang_pgogen -o %t.dir4/merge4 -O0 %s
// RUN: cd %t.dir4
// RUN: %run %t.dir4/merge4
// RUN: %run %t.dir4/merge4
// RUN: %run %t.dir4/merge4
// RUN: %run %t.dir4/merge4
// RUN: rm -f %t.dir4/merge4
// RUN: llvm-profdata merge -o %t.m4.profdata ./
// RUN: %clang_profuse=%t.m4.profdata -O0 -o - -S -emit-llvm %s | FileCheck %s --check-prefix=COMMON --check-prefix=PGOMERGE
int begin(int i) {
// COMMON: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (i)
return 0;
return 1;
}
int end(int i) {
// COMMON: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
if (i)
return 0;
return 1;
}
int main(int argc, const char *argv[]) {
begin(0);
end(1);
// COMMON: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
if (argc)
return 0;
return 1;
}
// ORIG: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
// ORIG: ![[PD2]] = !{!"branch_weights", i32 2, i32 1}
// MERGE: ![[PD1]] = !{!"branch_weights", i32 1, i32 3}
// MERGE: ![[PD2]] = !{!"branch_weights", i32 3, i32 1}
// PGOMERGE: ![[PD1]] = !{!"branch_weights", i32 0, i32 4}
// PGOMERGE: ![[PD2]] = !{!"branch_weights", i32 4, i32 0}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-set-filename.c 0000664 0001750 0001750 00000004172 12727161165 030375 0 ustar mwhudson mwhudson // 1. Test that __llvm_profile_set_filename has higher precedence than
// the default path.
// RUN: %clang_profgen -o %t -O3 %s
// RUN: %run %t %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
// RUN: rm %t.profraw
// RUN: rm %t.profdata
// 2. Test that __llvm_profile_set_filename has higher precedence than
// environment variable
// RUN: env LLVM_PROFILE_FILE=%t.env.profraw %run %t %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
// RUN: rm %t.profraw
// RUN: rm %t.profdata
// 3. Test that __llvm_profile_set_filename has higher precedence than
// the command line.
// RUN: %clang_profgen=%t.cmd.profraw -o %t.cmd -O3 %s
// RUN: %run %t.cmd %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
// RUN: rm %t.profraw
// RUN: rm %t.profdata
// 4. Test that command line has high precedence than the default path
// RUN: %clang_profgen=%t.cmd.profraw -DNO_API -o %t.cmd -O3 %s
// RUN: %run %t.cmd %t.profraw
// RUN: llvm-profdata merge -o %t.cmd.profdata %t.cmd.profraw
// RUN: %clang_profuse=%t.cmd.profdata -o - -S -emit-llvm %s | FileCheck %s
// RUN: rm %t.cmd.profraw
// RUN: rm %t.cmd.profdata
// 5. Test that the environment variable has higher precedence than
// the command line.
// RUN: env LLVM_PROFILE_FILE=%t.env.profraw %run %t.cmd %t.profraw
// RUN: llvm-profdata merge -o %t.env.profdata %t.env.profraw
// RUN: %clang_profuse=%t.env.profdata -o - -S -emit-llvm %s | FileCheck %s
// RUN: rm %t.env.profraw
// RUN: rm %t.env.profdata
#ifdef CALL_SHARED
extern void func(int);
#endif
void __llvm_profile_set_filename(const char *);
int main(int argc, const char *argv[]) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
#ifndef NO_API
__llvm_profile_set_filename(argv[1]);
#endif
#ifdef CALL_SHARED
func(1);
#endif
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
// SHARED: Total functions: 2
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-path.c 0000664 0001750 0001750 00000001750 12743576541 026765 0 ustar mwhudson mwhudson // RUN: %clang_pgogen -O2 -o %t.0 %s
// RUN: %clang_pgogen=%t.d1 -O2 -o %t.1 %s
// RUN: %clang_pgogen=%t.d1/%t.d2 -O2 -o %t.2 %s
//
// RUN: %run %t.0 ""
// RUN: env LLVM_PROFILE_FILE=%t.d1/default.profraw %run %t.0 %t.d1/
// RUN: env LLVM_PROFILE_FILE=%t.d1/%t.d2/default.profraw %run %t.0 %t.d1/%t.d2/
// RUN: %run %t.1 %t.d1/
// RUN: %run %t.2 %t.d1/%t.d2/
// RUN: %run %t.2 %t.d1/%t.d2/ %t.d1/%t.d2/%t.d3/blah.profraw %t.d1/%t.d2/%t.d3/
#include
const char *__llvm_profile_get_path_prefix();
void __llvm_profile_set_filanem(const char*);
int main(int argc, const char *argv[]) {
int i;
const char *expected;
const char *prefix;
if (argc < 2)
return 1;
expected = argv[1];
prefix = __llvm_profile_get_path_prefix();
if (strcmp(prefix, expected))
return 1;
if (argc == 4) {
__llvm_profile_set_filename(argv[2]);
prefix = __llvm_profile_get_path_prefix();
expected = argv[3];
if (strcmp(prefix, expected))
return 1;
}
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-dynamic-one-shared.test 0000664 0001750 0001750 00000002572 12335307355 032230 0 ustar mwhudson mwhudson RUN: mkdir -p %t.d
RUN: %clang_profgen -o %t.d/a.shared -fPIC -shared %S/Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profgen -o %t-shared -fPIC -rpath %t.d %t.d/a.shared %S/Inputs/instrprof-dynamic-b.cpp %S/Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profgen -o %t-static %S/Inputs/instrprof-dynamic-a.cpp %S/Inputs/instrprof-dynamic-b.cpp %S/Inputs/instrprof-dynamic-main.cpp
RUN: env LLVM_PROFILE_FILE=%t-static.profraw %run %t-static
RUN: env LLVM_PROFILE_FILE=%t-shared.profraw %run %t-shared
RUN: llvm-profdata merge -o %t-static.profdata %t-static.profraw
RUN: llvm-profdata merge -o %t-shared.profdata %t-shared.profraw
RUN: %clang_profuse=%t-static.profdata -o %t-a.static.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-a.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-a.shared.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-a.cpp
RUN: diff %t-a.static.ll %t-a.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-b.static.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-b.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-b.shared.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-b.cpp
RUN: diff %t-b.static.ll %t-b.shared.ll
RUN: %clang_profuse=%t-static.profdata -o %t-main.static.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-main.cpp
RUN: %clang_profuse=%t-shared.profdata -o %t-main.shared.ll -S -emit-llvm %S/Inputs/instrprof-dynamic-main.cpp
RUN: diff %t-main.static.ll %t-main.shared.ll
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-without-libc.c 0000664 0001750 0001750 00000004300 12676302437 030431 0 ustar mwhudson mwhudson // RUN: %clang_profgen -DCHECK_SYMBOLS -O3 -o %t.symbols %s
// RUN: llvm-nm %t.symbols | FileCheck %s --check-prefix=CHECK-SYMBOLS
// RUN: %clang_profgen -O3 -o %t %s
// RUN: %run %t %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
#include
#include
#ifndef CHECK_SYMBOLS
#include
#endif
int __llvm_profile_runtime = 0;
uint64_t __llvm_profile_get_size_for_buffer(void);
int __llvm_profile_write_buffer(char *);
void __llvm_profile_merge_from_buffer(const char *, uint64_t Size);
int write_buffer(uint64_t, const char *);
int main(int argc, const char *argv[]) {
// CHECK-LABEL: define {{.*}} @main(
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
const uint64_t MaxSize = 10000;
static char Buffer[MaxSize];
uint64_t Size = __llvm_profile_get_size_for_buffer();
if (Size > MaxSize)
return 1;
int Write = __llvm_profile_write_buffer(Buffer);
if (Write)
return Write;
#ifdef CHECK_SYMBOLS
// Don't write it out. Since we're checking the symbols, we don't have libc
// available.
// Call merge function to make sure it does not bring in libc deps:
__llvm_profile_merge_from_buffer(Buffer, Size);
return 0;
#else
// Actually write it out so we can FileCheck the output.
FILE *File = fopen(argv[1], "w");
if (!File)
return 1;
if (fwrite(Buffer, 1, Size, File) != Size)
return 1;
return fclose(File);
#endif
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
// CHECK-SYMBOLS-NOT: {{ }}___cxx_global_var_init
// CHECK-SYMBOLS-NOT: {{ }}___llvm_profile_register_write_file_atexit
// CHECK-SYMBOLS-NOT: {{ }}___llvm_profile_set_filename
// CHECK-SYMBOLS-NOT: {{ }}___llvm_profile_write_file
// CHECK-SYMBOLS-NOT: {{ }}_fdopen
// CHECK-SYMBOLS-NOT: {{ }}_fopen
// CHECK-SYMBOLS-NOT: {{ }}_fwrite
// CHECK-SYMBOLS-NOT: {{ }}_getenv
// CHECK-SYMBOLS-NOT: {{ }}getenv
// CHECK-SYMBOLS-NOT: {{ }}_malloc
// CHECK-SYMBOLS-NOT: {{ }}malloc
// CHECK-SYMBOLS-NOT: {{ }}_calloc
// CHECK-SYMBOLS-NOT: {{ }}calloc
// CHECK-SYMBOLS-NOT: {{ }}_free
// CHECK-SYMBOLS-NOT: {{ }}free
// CHECK-SYMBOLS-NOT: {{ }}_open
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-value-prof-shared.test 0000664 0001750 0001750 00000012265 12744562706 032114 0 ustar mwhudson mwhudson // RUN: mkdir -p %t.d
// RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.shared -DSHARED_LIB %S/Inputs/instrprof-value-prof-real.c
// RUN: %clang_profgen -O2 -mllvm -enable-value-profiling=true -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -o %t -rpath %t.d %t.d/t.shared -DCALL_SHARED %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_PROFILE_FILE=%t.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata show --all-functions -ic-targets %t.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
// IR level instrumentation
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.shared -DSHARED_LIB %S/Inputs/instrprof-value-prof-real.c
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir %t.d/t.ir.shared -DCALL_SHARED %S/Inputs/instrprof-value-prof-real.c
// Profile data from shared library will be concatenated to the same raw file.
// RUN: env LLVM_PROFILE_FILE=%t.ir.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir
// RUN: llvm-profdata merge -o %t.ir.profdata %t.ir.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata merge -text %t.ir.profdata -o %t.ir.proftxt
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
// RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.proftxt
// Same as above but with profile online merging enabled.
// RUN: rm -fr %t.prof/
// RUN: mkdir -p %t.prof/
// RUN: %clang_pgogen=%t.prof -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.m.shared -DSHARED_LIB %S/Inputs/instrprof-value-prof-real.c
// RUN: %clang_pgogen=%t.prof -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.m %t.d/t.ir.m.shared -DCALL_SHARED %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.m
// RUN: llvm-profdata merge -o %t.ir.m.profdata -dump-input-file-list %t.prof/ | count 2
// RUN: llvm-profdata merge -o %t.ir.m.profdata %t.prof/
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.m.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata merge -text %t.ir.m.profdata -o %t.ir.m.proftxt
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.m.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
// RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.m.proftxt
// IR level instrumentation: dynamic memory allocation
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.dyn.shared -DSHARED_LIB %S/Inputs/instrprof-value-prof-real.c
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.dyn %t.d/t.ir.dyn.shared -DCALL_SHARED %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_PROFILE_FILE=%t.ir.dyn.profraw %run %t.ir.dyn
// RUN: llvm-profdata merge -o %t.ir.dyn.profdata %t.ir.dyn.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata merge -text %t.ir.dyn.profdata -o %t.ir.dyn.proftxt
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.dyn.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
// RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.dyn.proftxt
// IR level instrumentation: main program uses static counter, shared library uses dynamic memory alloc.
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=false -mllvm -vp-counters-per-site=256 -fPIC -shared -o %t.d/t.ir.dyn.shared -DSHARED_LIB %S/Inputs/instrprof-value-prof-real.c
// RUN: %clang_pgogen -O2 -mllvm -disable-vp=false -mllvm -vp-static-alloc=true -mllvm -vp-counters-per-site=256 -rpath %t.d -o %t.ir.mixed %t.d/t.ir.dyn.shared -DCALL_SHARED %S/Inputs/instrprof-value-prof-real.c
// RUN: env LLVM_PROFILE_FILE=%t.ir.mixed.profraw LLVM_VP_MAX_NUM_VALS_PER_SITE=255 %run %t.ir.mixed
// RUN: llvm-profdata merge -o %t.ir.mixed.profdata %t.ir.mixed.profraw
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.mixed.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c
// RUN: llvm-profdata merge -text %t.ir.mixed.profdata -o %t.ir.mixed.proftxt
// RUN: llvm-profdata show --all-functions -ic-targets %t.ir.mixed.profdata | FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=SHARED
// RUN: FileCheck %S/Inputs/instrprof-value-prof-real.c --check-prefix=IR < %t.ir.mixed.proftxt
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-version-mismatch.c 0000664 0001750 0001750 00000000531 12717516576 031320 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: %run %t 1 2>&1 | FileCheck %s
// override the version variable with a bogus version:
unsigned long long __llvm_profile_raw_version = 10000;
int main(int argc, const char *argv[]) {
if (argc < 2)
return 1;
return 0;
}
// CHECK: LLVM Profile Error: Runtime and instrumentation version mismatch
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-merge.c 0000664 0001750 0001750 00000004407 12666104166 027124 0 ustar mwhudson mwhudson // RUN: %clang_profgen -O2 -o %t %s
// RUN: %run %t %t.profraw 1 1
// RUN: llvm-profdata show --all-functions --counts %t.profraw | FileCheck %s
#include
#include
#include
int __llvm_profile_runtime = 0;
uint64_t __llvm_profile_get_size_for_buffer(void);
int __llvm_profile_write_buffer(char *);
void __llvm_profile_reset_counters(void);
void __llvm_profile_merge_from_buffer(const char *, uint64_t);
int dumpBuffer(const char *FileN, const char *Buffer, uint64_t Size) {
FILE *File = fopen(FileN, "w");
if (!File)
return 1;
if (fwrite(Buffer, 1, Size, File) != Size)
return 1;
return fclose(File);
}
int g = 0;
void foo(char c) {
if (c == '1')
g++;
else
g--;
}
/* This function is not profiled */
void bar(int M) { g += M; }
int main(int argc, const char *argv[]) {
int i;
if (argc < 4)
return 1;
const uint64_t MaxSize = 10000;
static char Buffer[MaxSize];
uint64_t Size = __llvm_profile_get_size_for_buffer();
if (Size > MaxSize)
return 1;
/* Start profiling. */
__llvm_profile_reset_counters();
foo(argv[2][0]);
/* End profiling by freezing counters. */
if (__llvm_profile_write_buffer(Buffer))
return 1;
/* Its profile will be discarded. */
for (i = 0; i < 10; i++)
bar(1);
/* Start profiling again and merge in previously
saved counters in buffer. */
__llvm_profile_reset_counters();
__llvm_profile_merge_from_buffer(Buffer, Size);
foo(argv[3][0]);
/* End profiling */
if (__llvm_profile_write_buffer(Buffer))
return 1;
/* Its profile will be discarded. */
bar(2);
/* Now it is time to dump the profile to file. */
return dumpBuffer(argv[1], Buffer, Size);
}
// Not profiled
// CHECK-LABEL: dumpBuffer:
// CHECK: Counters: 3
// CHECK-NEXT: Function count: 0
// CHECK-NEXT: Block counts: [0, 0]
// Profiled with entry count == 2
// CHECK-LABEL: foo:
// CHECK: Counters: 2
// CHECK-NEXT: Function count: 2
// CHECK-NEXT: Block counts: [2]
// Not profiled
// CHECK-LABEL: bar:
// CHECK: Counters: 1
// CHECK-NEXT Function count: 0
// CHECK-NEXT Block counts: []
// Not profiled
// CHECK-LABEL: main:
// CHECK: Counters: 6
// CHECK-NEXT: Function count: 0
// CHECK-NEXT: Block counts: [0, 0, 0, 0, 0]
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-write-file-atexit-explicitly.c0000664 0001750 0001750 00000001166 12443651733 033553 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: %run %t %t.profraw
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
int __llvm_profile_runtime = 0;
int __llvm_profile_register_write_file_atexit(void);
void __llvm_profile_set_filename(const char *);
int main(int argc, const char *argv[]) {
__llvm_profile_register_write_file_atexit();
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
__llvm_profile_set_filename(argv[1]);
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-write-file-only.c 0000664 0001750 0001750 00000002331 12675404665 031054 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata merge -o %t.profdata %t.profraw
// RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
int __llvm_profile_runtime = 0;
void __llvm_profile_initialize_file(void);
int __llvm_profile_write_file(void);
void __llvm_profile_set_filename(const char *);
int foo(int);
int main(int argc, const char *argv[]) {
// CHECK-LABEL: define {{.*}} @main(
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc > 42)
return 1;
// Since the runtime has been suppressed, initialize the file name, as the
// writing will fail below as the file name has not been specified.
__llvm_profile_initialize_file();
// Write out the profile.
__llvm_profile_write_file();
// Change the profile.
return foo(0);
}
int foo(int X) {
// There should be no profiling information for @foo, since it was called
// after the profile was written (and the atexit was suppressed by defining
// profile_runtime).
// CHECK-LABEL: define {{.*}} @foo(
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
return X <= 0 ? -X : X;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/ 0000775 0001750 0001750 00000000000 13040224625 025100 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/extern_template.h 0000664 0001750 0001750 00000000711 12752442526 030463 0 ustar mwhudson mwhudson template struct Test {
Test() : M(10) {}
void doIt(int N) { // CHECK: [[@LINE]]| 2| void doIt
if (N > 10) { // CHECK: [[@LINE]]| 2| if (N > 10) {
M += 2; // CHECK: [[@LINE]]| 1| M += 2;
} else // CHECK: [[@LINE]]| 1| } else
M -= 2; // CHECK: [[@LINE]]| 1| M -= 2;
}
T M;
};
#ifdef USE
extern template struct Test;
#endif
#ifdef DEF
template struct Test;
#endif
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dlopen-func2.c 0000664 0001750 0001750 00000000040 12335535402 031562 0 ustar mwhudson mwhudson void func2(int K) { if (K) {} }
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dynamic-header.h 0000664 0001750 0001750 00000000126 12532165425 032155 0 ustar mwhudson mwhudson template void bar(int X) {
if (X) {
X *= 4;
}
}
void a();
void b();
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-shared-main.c 0000664 0001750 0001750 00000000311 12621462443 031461 0 ustar mwhudson mwhudson extern int g1, g2;
extern void foo(int n);
int main() {
int i, j;
for (i = 0; i < 1000; i++)
for (j = 0; j < 1000; j++)
foo(i * j);
if (g2 - g1 == 280001)
return 0;
return 1;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/comdat_rename_2.cc 0000664 0001750 0001750 00000000713 12747754476 030460 0 ustar mwhudson mwhudson #include "comdat_rename.h"
extern void test(FOO *);
FOO foo;
int main() {
test(&foo);
foo.caller(20);
return 0;
}
// The copy of 'caller' defined in this module -- it has
// 'callee' call remaining.
//
// CHECK-LABEL: define {{.*}}caller{{.*}}
// CHECK: {{.*}} call {{.*}}
// CHECK-NOT: br i1 {{.*}}
// CHECK: br {{.*}}label %[[BB1:.*]], label{{.*}}!prof ![[PD1:[0-9]+]]
// CHECK: {{.*}}[[BB1]]:
// CHECK:![[PD1]] = !{!"branch_weights", i32 0, i32 1}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-value-prof-real.c 0000664 0001750 0001750 00000147474 12721673267 032331 0 ustar mwhudson mwhudson #define DEF_FUNC(x) \
void x() {}
#define DEF_2_FUNCS(x) DEF_FUNC(x##_1) DEF_FUNC(x##_2)
#define DEF_4_FUNCS(x) DEF_2_FUNCS(x##_1) DEF_2_FUNCS(x##_2)
#define DEF_8_FUNCS(x) DEF_4_FUNCS(x##_1) DEF_4_FUNCS(x##_2)
#define DEF_16_FUNCS(x) DEF_8_FUNCS(x##_1) DEF_8_FUNCS(x##_2)
#define DEF_32_FUNCS(x) DEF_16_FUNCS(x##_1) DEF_16_FUNCS(x##_2)
#define DEF_64_FUNCS(x) DEF_32_FUNCS(x##_1) DEF_32_FUNCS(x##_2)
#define DEF_128_FUNCS(x) DEF_64_FUNCS(x##_1) DEF_64_FUNCS(x##_2)
#define DEF_256_FUNCS(x) DEF_128_FUNCS(x##_1) DEF_128_FUNCS(x##_2)
#define DEF_512_FUNCS(x) DEF_256_FUNCS(x##_1) DEF_256_FUNCS(x##_2)
#define FUNC_ADDR(x) &x,
#define FUNC_2_ADDRS(x) FUNC_ADDR(x##_1) FUNC_ADDR(x##_2)
#define FUNC_4_ADDRS(x) FUNC_2_ADDRS(x##_1) FUNC_2_ADDRS(x##_2)
#define FUNC_8_ADDRS(x) FUNC_4_ADDRS(x##_1) FUNC_4_ADDRS(x##_2)
#define FUNC_16_ADDRS(x) FUNC_8_ADDRS(x##_1) FUNC_8_ADDRS(x##_2)
#define FUNC_32_ADDRS(x) FUNC_16_ADDRS(x##_1) FUNC_16_ADDRS(x##_2)
#define FUNC_64_ADDRS(x) FUNC_32_ADDRS(x##_1) FUNC_32_ADDRS(x##_2)
#define FUNC_128_ADDRS(x) FUNC_64_ADDRS(x##_1) FUNC_64_ADDRS(x##_2)
#define FUNC_256_ADDRS(x) FUNC_128_ADDRS(x##_1) FUNC_128_ADDRS(x##_2)
#define FUNC_512_ADDRS(x) FUNC_256_ADDRS(x##_1) FUNC_256_ADDRS(x##_2)
DEF_512_FUNCS(foo)
void *CalleeAddrs[] = {FUNC_512_ADDRS(foo)};
typedef void (*FPT)(void);
FPT getFunc(int I) { return CalleeAddrs[I]; }
#ifdef SHARED_LIB
int shared_entry() {
#else
#ifdef CALL_SHARED
extern int shared_entry();
#endif
int main() {
#endif
int I;
for (I = 0; I < 512; I++) {
FPT Fp = getFunc(I);
int J;
for (J = 0; J < 1000 - I; J++)
Fp();
Fp = getFunc(511 - I);
for (J = 0; J < 2000 - I; J++)
Fp();
#ifdef STRESS
Fp = getFunc(I);
for (J = 0; J < 2000 - I; J++)
Fp();
Fp = getFunc(I);
for (J = 0; J < 2000 - I; J++)
Fp();
Fp = getFunc(I);
for (J = 0; J < 2000 - I; J++)
Fp();
Fp = getFunc(I);
for (J = 0; J < 2000 - I; J++)
Fp();
#endif
}
#ifdef CALL_SHARED
shared_entry();
#endif
return 0;
}
// IR: :ir
// CHECK-LABEL: main:
// CHECK: [ 0, foo_1_1_1_1_1_1_1_1_1, 1000 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_1_1_2, 999 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_1_2_1, 998 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_1_2_2, 997 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_2_1_1, 996 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_2_1_2, 995 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_2_2_1, 994 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_1_2_2_2, 993 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_1_1_1, 992 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_1_1_2, 991 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_1_2_1, 990 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_1_2_2, 989 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_2_1_1, 988 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_2_1_2, 987 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_2_2_1, 986 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_1_2_2_2_2, 985 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_1_1_1, 984 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_1_1_2, 983 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_1_2_1, 982 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_1_2_2, 981 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_2_1_1, 980 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_2_1_2, 979 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_2_2_1, 978 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_1_2_2_2, 977 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_1_1_1, 976 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_1_1_2, 975 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_1_2_1, 974 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_1_2_2, 973 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_2_1_1, 972 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_2_1_2, 971 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_2_2_1, 970 ]
// CHECK-NEXT: [ 0, foo_1_1_1_1_2_2_2_2_2, 969 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_1_1_1, 968 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_1_1_2, 967 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_1_2_1, 966 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_1_2_2, 965 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_2_1_1, 964 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_2_1_2, 963 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_2_2_1, 962 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_1_2_2_2, 961 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_1_1_1, 960 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_1_1_2, 959 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_1_2_1, 958 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_1_2_2, 957 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_2_1_1, 956 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_2_1_2, 955 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_2_2_1, 954 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_1_2_2_2_2, 953 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_1_1_1, 952 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_1_1_2, 951 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_1_2_1, 950 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_1_2_2, 949 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_2_1_1, 948 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_2_1_2, 947 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_2_2_1, 946 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_1_2_2_2, 945 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_1_1_1, 944 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_1_1_2, 943 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_1_2_1, 942 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_1_2_2, 941 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_2_1_1, 940 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_2_1_2, 939 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_2_2_1, 938 ]
// CHECK-NEXT: [ 0, foo_1_1_1_2_2_2_2_2_2, 937 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_1_1_1, 936 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_1_1_2, 935 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_1_2_1, 934 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_1_2_2, 933 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_2_1_1, 932 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_2_1_2, 931 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_2_2_1, 930 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_1_2_2_2, 929 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_1_1_1, 928 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_1_1_2, 927 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_1_2_1, 926 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_1_2_2, 925 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_2_1_1, 924 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_2_1_2, 923 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_2_2_1, 922 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_1_2_2_2_2, 921 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_1_1_1, 920 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_1_1_2, 919 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_1_2_1, 918 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_1_2_2, 917 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_2_1_1, 916 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_2_1_2, 915 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_2_2_1, 914 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_1_2_2_2, 913 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_1_1_1, 912 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_1_1_2, 911 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_1_2_1, 910 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_1_2_2, 909 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_2_1_1, 908 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_2_1_2, 907 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_2_2_1, 906 ]
// CHECK-NEXT: [ 0, foo_1_1_2_1_2_2_2_2_2, 905 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_1_1_1, 904 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_1_1_2, 903 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_1_2_1, 902 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_1_2_2, 901 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_2_1_1, 900 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_2_1_2, 899 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_2_2_1, 898 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_1_2_2_2, 897 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_1_1_1, 896 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_1_1_2, 895 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_1_2_1, 894 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_1_2_2, 893 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_2_1_1, 892 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_2_1_2, 891 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_2_2_1, 890 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_1_2_2_2_2, 889 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_1_1_1, 888 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_1_1_2, 887 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_1_2_1, 886 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_1_2_2, 885 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_2_1_1, 884 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_2_1_2, 883 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_2_2_1, 882 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_1_2_2_2, 881 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_1_1_1, 880 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_1_1_2, 879 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_1_2_1, 878 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_1_2_2, 877 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_2_1_1, 876 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_2_1_2, 875 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_2_2_1, 874 ]
// CHECK-NEXT: [ 0, foo_1_1_2_2_2_2_2_2_2, 873 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_1_1_1, 872 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_1_1_2, 871 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_1_2_1, 870 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_1_2_2, 869 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_2_1_1, 868 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_2_1_2, 867 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_2_2_1, 866 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_1_2_2_2, 865 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_1_1_1, 864 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_1_1_2, 863 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_1_2_1, 862 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_1_2_2, 861 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_2_1_1, 860 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_2_1_2, 859 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_2_2_1, 858 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_1_2_2_2_2, 857 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_1_1_1, 856 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_1_1_2, 855 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_1_2_1, 854 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_1_2_2, 853 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_2_1_1, 852 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_2_1_2, 851 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_2_2_1, 850 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_1_2_2_2, 849 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_1_1_1, 848 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_1_1_2, 847 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_1_2_1, 846 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_1_2_2, 845 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_2_1_1, 844 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_2_1_2, 843 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_2_2_1, 842 ]
// CHECK-NEXT: [ 0, foo_1_2_1_1_2_2_2_2_2, 841 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_1_1_1, 840 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_1_1_2, 839 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_1_2_1, 838 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_1_2_2, 837 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_2_1_1, 836 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_2_1_2, 835 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_2_2_1, 834 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_1_2_2_2, 833 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_1_1_1, 832 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_1_1_2, 831 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_1_2_1, 830 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_1_2_2, 829 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_2_1_1, 828 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_2_1_2, 827 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_2_2_1, 826 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_1_2_2_2_2, 825 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_1_1_1, 824 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_1_1_2, 823 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_1_2_1, 822 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_1_2_2, 821 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_2_1_1, 820 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_2_1_2, 819 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_2_2_1, 818 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_1_2_2_2, 817 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_1_1_1, 816 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_1_1_2, 815 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_1_2_1, 814 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_1_2_2, 813 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_2_1_1, 812 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_2_1_2, 811 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_2_2_1, 810 ]
// CHECK-NEXT: [ 0, foo_1_2_1_2_2_2_2_2_2, 809 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_1_1_1, 808 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_1_1_2, 807 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_1_2_1, 806 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_1_2_2, 805 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_2_1_1, 804 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_2_1_2, 803 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_2_2_1, 802 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_1_2_2_2, 801 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_1_1_1, 800 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_1_1_2, 799 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_1_2_1, 798 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_1_2_2, 797 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_2_1_1, 796 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_2_1_2, 795 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_2_2_1, 794 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_1_2_2_2_2, 793 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_1_1_1, 792 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_1_1_2, 791 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_1_2_1, 790 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_1_2_2, 789 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_2_1_1, 788 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_2_1_2, 787 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_2_2_1, 786 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_1_2_2_2, 785 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_1_1_1, 784 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_1_1_2, 783 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_1_2_1, 782 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_1_2_2, 781 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_2_1_1, 780 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_2_1_2, 779 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_2_2_1, 778 ]
// CHECK-NEXT: [ 0, foo_1_2_2_1_2_2_2_2_2, 777 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_1_1_1, 776 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_1_1_2, 775 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_1_2_1, 774 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_1_2_2, 773 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_2_1_1, 772 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_2_1_2, 771 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_2_2_1, 770 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_1_2_2_2, 769 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_1_1_1, 768 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_1_1_2, 767 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_1_2_1, 766 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_1_2_2, 765 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_2_1_1, 764 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_2_1_2, 763 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_2_2_1, 762 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_1_2_2_2_2, 761 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_1_1_1, 760 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_1_1_2, 759 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_1_2_1, 758 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_1_2_2, 757 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_2_1_1, 756 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_2_1_2, 755 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_2_2_1, 754 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_1_2_2_2, 753 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_2_1_1_1, 752 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_2_1_1_2, 751 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_2_1_2_1, 750 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_2_1_2_2, 749 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_2_2_1_1, 748 ]
// CHECK-NEXT: [ 0, foo_1_2_2_2_2_2_2_1_2, 747 ]
// CHECK-NEXT: [ 0, foo
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_2_2_2, 2000 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_2_2_1, 1999 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_2_1_2, 1998 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_2_1_1, 1997 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_1_2_2, 1996 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_1_2_1, 1995 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_1_1_2, 1994 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_2_1_1_1, 1993 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_2_2_2, 1992 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_2_2_1, 1991 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_2_1_2, 1990 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_2_1_1, 1989 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_1_2_2, 1988 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_1_2_1, 1987 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_1_1_2, 1986 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_2_1_1_1_1, 1985 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_2_2_2, 1984 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_2_2_1, 1983 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_2_1_2, 1982 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_2_1_1, 1981 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_1_2_2, 1980 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_1_2_1, 1979 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_1_1_2, 1978 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_2_1_1_1, 1977 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_2_2_2, 1976 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_2_2_1, 1975 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_2_1_2, 1974 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_2_1_1, 1973 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_1_2_2, 1972 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_1_2_1, 1971 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_1_1_2, 1970 ]
// CHECK-NEXT: [ 1, foo_2_2_2_2_1_1_1_1_1, 1969 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_2_2_2, 1968 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_2_2_1, 1967 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_2_1_2, 1966 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_2_1_1, 1965 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_1_2_2, 1964 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_1_2_1, 1963 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_1_1_2, 1962 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_2_1_1_1, 1961 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_2_2_2, 1960 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_2_2_1, 1959 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_2_1_2, 1958 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_2_1_1, 1957 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_1_2_2, 1956 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_1_2_1, 1955 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_1_1_2, 1954 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_2_1_1_1_1, 1953 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_2_2_2, 1952 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_2_2_1, 1951 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_2_1_2, 1950 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_2_1_1, 1949 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_1_2_2, 1948 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_1_2_1, 1947 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_1_1_2, 1946 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_2_1_1_1, 1945 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_2_2_2, 1944 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_2_2_1, 1943 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_2_1_2, 1942 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_2_1_1, 1941 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_1_2_2, 1940 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_1_2_1, 1939 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_1_1_2, 1938 ]
// CHECK-NEXT: [ 1, foo_2_2_2_1_1_1_1_1_1, 1937 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_2_2_2, 1936 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_2_2_1, 1935 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_2_1_2, 1934 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_2_1_1, 1933 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_1_2_2, 1932 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_1_2_1, 1931 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_1_1_2, 1930 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_2_1_1_1, 1929 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_2_2_2, 1928 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_2_2_1, 1927 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_2_1_2, 1926 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_2_1_1, 1925 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_1_2_2, 1924 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_1_2_1, 1923 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_1_1_2, 1922 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_2_1_1_1_1, 1921 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_2_2_2, 1920 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_2_2_1, 1919 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_2_1_2, 1918 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_2_1_1, 1917 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_1_2_2, 1916 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_1_2_1, 1915 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_1_1_2, 1914 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_2_1_1_1, 1913 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_2_2_2, 1912 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_2_2_1, 1911 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_2_1_2, 1910 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_2_1_1, 1909 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_1_2_2, 1908 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_1_2_1, 1907 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_1_1_2, 1906 ]
// CHECK-NEXT: [ 1, foo_2_2_1_2_1_1_1_1_1, 1905 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_2_2_2, 1904 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_2_2_1, 1903 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_2_1_2, 1902 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_2_1_1, 1901 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_1_2_2, 1900 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_1_2_1, 1899 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_1_1_2, 1898 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_2_1_1_1, 1897 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_2_2_2, 1896 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_2_2_1, 1895 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_2_1_2, 1894 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_2_1_1, 1893 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_1_2_2, 1892 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_1_2_1, 1891 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_1_1_2, 1890 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_2_1_1_1_1, 1889 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_2_2_2, 1888 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_2_2_1, 1887 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_2_1_2, 1886 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_2_1_1, 1885 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_1_2_2, 1884 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_1_2_1, 1883 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_1_1_2, 1882 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_2_1_1_1, 1881 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_2_2_2, 1880 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_2_2_1, 1879 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_2_1_2, 1878 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_2_1_1, 1877 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_1_2_2, 1876 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_1_2_1, 1875 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_1_1_2, 1874 ]
// CHECK-NEXT: [ 1, foo_2_2_1_1_1_1_1_1_1, 1873 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_2_2_2, 1872 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_2_2_1, 1871 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_2_1_2, 1870 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_2_1_1, 1869 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_1_2_2, 1868 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_1_2_1, 1867 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_1_1_2, 1866 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_2_1_1_1, 1865 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_2_2_2, 1864 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_2_2_1, 1863 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_2_1_2, 1862 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_2_1_1, 1861 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_1_2_2, 1860 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_1_2_1, 1859 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_1_1_2, 1858 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_2_1_1_1_1, 1857 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_2_2_2, 1856 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_2_2_1, 1855 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_2_1_2, 1854 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_2_1_1, 1853 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_1_2_2, 1852 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_1_2_1, 1851 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_1_1_2, 1850 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_2_1_1_1, 1849 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_2_2_2, 1848 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_2_2_1, 1847 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_2_1_2, 1846 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_2_1_1, 1845 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_1_2_2, 1844 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_1_2_1, 1843 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_1_1_2, 1842 ]
// CHECK-NEXT: [ 1, foo_2_1_2_2_1_1_1_1_1, 1841 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_2_2_2, 1840 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_2_2_1, 1839 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_2_1_2, 1838 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_2_1_1, 1837 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_1_2_2, 1836 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_1_2_1, 1835 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_1_1_2, 1834 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_2_1_1_1, 1833 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_2_2_2, 1832 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_2_2_1, 1831 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_2_1_2, 1830 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_2_1_1, 1829 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_1_2_2, 1828 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_1_2_1, 1827 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_1_1_2, 1826 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_2_1_1_1_1, 1825 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_2_2_2, 1824 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_2_2_1, 1823 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_2_1_2, 1822 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_2_1_1, 1821 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_1_2_2, 1820 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_1_2_1, 1819 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_1_1_2, 1818 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_2_1_1_1, 1817 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_2_2_2, 1816 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_2_2_1, 1815 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_2_1_2, 1814 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_2_1_1, 1813 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_1_2_2, 1812 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_1_2_1, 1811 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_1_1_2, 1810 ]
// CHECK-NEXT: [ 1, foo_2_1_2_1_1_1_1_1_1, 1809 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_2_2_2, 1808 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_2_2_1, 1807 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_2_1_2, 1806 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_2_1_1, 1805 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_1_2_2, 1804 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_1_2_1, 1803 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_1_1_2, 1802 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_2_1_1_1, 1801 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_2_2_2, 1800 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_2_2_1, 1799 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_2_1_2, 1798 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_2_1_1, 1797 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_1_2_2, 1796 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_1_2_1, 1795 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_1_1_2, 1794 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_2_1_1_1_1, 1793 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_2_2_2, 1792 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_2_2_1, 1791 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_2_1_2, 1790 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_2_1_1, 1789 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_1_2_2, 1788 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_1_2_1, 1787 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_1_1_2, 1786 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_2_1_1_1, 1785 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_2_2_2, 1784 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_2_2_1, 1783 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_2_1_2, 1782 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_2_1_1, 1781 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_1_2_2, 1780 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_1_2_1, 1779 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_1_1_2, 1778 ]
// CHECK-NEXT: [ 1, foo_2_1_1_2_1_1_1_1_1, 1777 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_2_2_2, 1776 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_2_2_1, 1775 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_2_1_2, 1774 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_2_1_1, 1773 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_1_2_2, 1772 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_1_2_1, 1771 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_1_1_2, 1770 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_2_1_1_1, 1769 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_2_2_2, 1768 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_2_2_1, 1767 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_2_1_2, 1766 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_2_1_1, 1765 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_1_2_2, 1764 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_1_2_1, 1763 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_1_1_2, 1762 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_2_1_1_1_1, 1761 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_2_2_2, 1760 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_2_2_1, 1759 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_2_1_2, 1758 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_2_1_1, 1757 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_1_2_2, 1756 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_1_2_1, 1755 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_1_1_2, 1754 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_2_1_1_1, 1753 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_1_2_2_2, 1752 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_1_2_2_1, 1751 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_1_2_1_2, 1750 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_1_2_1_1, 1749 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_1_1_2_2, 1748 ]
// CHECK-NEXT: [ 1, foo_2_1_1_1_1_1_1_2_1, 1747 ]
// CHECK-NEXT: [ 1, foo
// SHARED-LABEL: shared_entry:
// SHARED: [ 0, foo_1_1_1_1_1_1_1_1_1, 1000 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_1_1_2, 999 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_1_2_1, 998 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_1_2_2, 997 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_2_1_1, 996 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_2_1_2, 995 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_2_2_1, 994 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_1_2_2_2, 993 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_1_1_1, 992 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_1_1_2, 991 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_1_2_1, 990 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_1_2_2, 989 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_2_1_1, 988 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_2_1_2, 987 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_2_2_1, 986 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_1_2_2_2_2, 985 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_1_1_1, 984 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_1_1_2, 983 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_1_2_1, 982 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_1_2_2, 981 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_2_1_1, 980 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_2_1_2, 979 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_2_2_1, 978 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_1_2_2_2, 977 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_1_1_1, 976 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_1_1_2, 975 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_1_2_1, 974 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_1_2_2, 973 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_2_1_1, 972 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_2_1_2, 971 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_2_2_1, 970 ]
// SHARED-NEXT: [ 0, foo_1_1_1_1_2_2_2_2_2, 969 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_1_1_1, 968 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_1_1_2, 967 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_1_2_1, 966 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_1_2_2, 965 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_2_1_1, 964 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_2_1_2, 963 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_2_2_1, 962 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_1_2_2_2, 961 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_1_1_1, 960 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_1_1_2, 959 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_1_2_1, 958 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_1_2_2, 957 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_2_1_1, 956 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_2_1_2, 955 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_2_2_1, 954 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_1_2_2_2_2, 953 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_1_1_1, 952 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_1_1_2, 951 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_1_2_1, 950 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_1_2_2, 949 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_2_1_1, 948 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_2_1_2, 947 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_2_2_1, 946 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_1_2_2_2, 945 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_1_1_1, 944 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_1_1_2, 943 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_1_2_1, 942 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_1_2_2, 941 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_2_1_1, 940 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_2_1_2, 939 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_2_2_1, 938 ]
// SHARED-NEXT: [ 0, foo_1_1_1_2_2_2_2_2_2, 937 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_1_1_1, 936 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_1_1_2, 935 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_1_2_1, 934 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_1_2_2, 933 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_2_1_1, 932 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_2_1_2, 931 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_2_2_1, 930 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_1_2_2_2, 929 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_1_1_1, 928 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_1_1_2, 927 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_1_2_1, 926 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_1_2_2, 925 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_2_1_1, 924 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_2_1_2, 923 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_2_2_1, 922 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_1_2_2_2_2, 921 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_1_1_1, 920 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_1_1_2, 919 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_1_2_1, 918 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_1_2_2, 917 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_2_1_1, 916 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_2_1_2, 915 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_2_2_1, 914 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_1_2_2_2, 913 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_1_1_1, 912 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_1_1_2, 911 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_1_2_1, 910 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_1_2_2, 909 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_2_1_1, 908 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_2_1_2, 907 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_2_2_1, 906 ]
// SHARED-NEXT: [ 0, foo_1_1_2_1_2_2_2_2_2, 905 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_1_1_1, 904 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_1_1_2, 903 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_1_2_1, 902 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_1_2_2, 901 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_2_1_1, 900 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_2_1_2, 899 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_2_2_1, 898 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_1_2_2_2, 897 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_1_1_1, 896 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_1_1_2, 895 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_1_2_1, 894 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_1_2_2, 893 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_2_1_1, 892 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_2_1_2, 891 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_2_2_1, 890 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_1_2_2_2_2, 889 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_1_1_1, 888 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_1_1_2, 887 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_1_2_1, 886 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_1_2_2, 885 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_2_1_1, 884 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_2_1_2, 883 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_2_2_1, 882 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_1_2_2_2, 881 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_1_1_1, 880 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_1_1_2, 879 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_1_2_1, 878 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_1_2_2, 877 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_2_1_1, 876 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_2_1_2, 875 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_2_2_1, 874 ]
// SHARED-NEXT: [ 0, foo_1_1_2_2_2_2_2_2_2, 873 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_1_1_1, 872 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_1_1_2, 871 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_1_2_1, 870 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_1_2_2, 869 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_2_1_1, 868 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_2_1_2, 867 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_2_2_1, 866 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_1_2_2_2, 865 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_1_1_1, 864 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_1_1_2, 863 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_1_2_1, 862 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_1_2_2, 861 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_2_1_1, 860 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_2_1_2, 859 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_2_2_1, 858 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_1_2_2_2_2, 857 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_1_1_1, 856 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_1_1_2, 855 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_1_2_1, 854 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_1_2_2, 853 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_2_1_1, 852 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_2_1_2, 851 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_2_2_1, 850 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_1_2_2_2, 849 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_1_1_1, 848 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_1_1_2, 847 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_1_2_1, 846 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_1_2_2, 845 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_2_1_1, 844 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_2_1_2, 843 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_2_2_1, 842 ]
// SHARED-NEXT: [ 0, foo_1_2_1_1_2_2_2_2_2, 841 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_1_1_1, 840 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_1_1_2, 839 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_1_2_1, 838 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_1_2_2, 837 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_2_1_1, 836 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_2_1_2, 835 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_2_2_1, 834 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_1_2_2_2, 833 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_1_1_1, 832 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_1_1_2, 831 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_1_2_1, 830 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_1_2_2, 829 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_2_1_1, 828 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_2_1_2, 827 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_2_2_1, 826 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_1_2_2_2_2, 825 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_1_1_1, 824 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_1_1_2, 823 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_1_2_1, 822 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_1_2_2, 821 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_2_1_1, 820 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_2_1_2, 819 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_2_2_1, 818 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_1_2_2_2, 817 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_1_1_1, 816 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_1_1_2, 815 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_1_2_1, 814 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_1_2_2, 813 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_2_1_1, 812 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_2_1_2, 811 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_2_2_1, 810 ]
// SHARED-NEXT: [ 0, foo_1_2_1_2_2_2_2_2_2, 809 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_1_1_1, 808 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_1_1_2, 807 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_1_2_1, 806 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_1_2_2, 805 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_2_1_1, 804 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_2_1_2, 803 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_2_2_1, 802 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_1_2_2_2, 801 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_1_1_1, 800 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_1_1_2, 799 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_1_2_1, 798 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_1_2_2, 797 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_2_1_1, 796 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_2_1_2, 795 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_2_2_1, 794 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_1_2_2_2_2, 793 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_1_1_1, 792 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_1_1_2, 791 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_1_2_1, 790 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_1_2_2, 789 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_2_1_1, 788 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_2_1_2, 787 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_2_2_1, 786 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_1_2_2_2, 785 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_1_1_1, 784 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_1_1_2, 783 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_1_2_1, 782 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_1_2_2, 781 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_2_1_1, 780 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_2_1_2, 779 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_2_2_1, 778 ]
// SHARED-NEXT: [ 0, foo_1_2_2_1_2_2_2_2_2, 777 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_1_1_1, 776 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_1_1_2, 775 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_1_2_1, 774 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_1_2_2, 773 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_2_1_1, 772 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_2_1_2, 771 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_2_2_1, 770 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_1_2_2_2, 769 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_1_1_1, 768 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_1_1_2, 767 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_1_2_1, 766 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_1_2_2, 765 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_2_1_1, 764 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_2_1_2, 763 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_2_2_1, 762 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_1_2_2_2_2, 761 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_1_1_1, 760 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_1_1_2, 759 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_1_2_1, 758 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_1_2_2, 757 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_2_1_1, 756 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_2_1_2, 755 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_2_2_1, 754 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_1_2_2_2, 753 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_2_1_1_1, 752 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_2_1_1_2, 751 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_2_1_2_1, 750 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_2_1_2_2, 749 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_2_2_1_1, 748 ]
// SHARED-NEXT: [ 0, foo_1_2_2_2_2_2_2_1_2, 747 ]
// SHARED-NEXT: [ 0, foo
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_2_2_2, 2000 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_2_2_1, 1999 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_2_1_2, 1998 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_2_1_1, 1997 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_1_2_2, 1996 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_1_2_1, 1995 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_1_1_2, 1994 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_2_1_1_1, 1993 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_2_2_2, 1992 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_2_2_1, 1991 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_2_1_2, 1990 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_2_1_1, 1989 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_1_2_2, 1988 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_1_2_1, 1987 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_1_1_2, 1986 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_2_1_1_1_1, 1985 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_2_2_2, 1984 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_2_2_1, 1983 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_2_1_2, 1982 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_2_1_1, 1981 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_1_2_2, 1980 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_1_2_1, 1979 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_1_1_2, 1978 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_2_1_1_1, 1977 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_2_2_2, 1976 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_2_2_1, 1975 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_2_1_2, 1974 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_2_1_1, 1973 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_1_2_2, 1972 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_1_2_1, 1971 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_1_1_2, 1970 ]
// SHARED-NEXT: [ 1, foo_2_2_2_2_1_1_1_1_1, 1969 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_2_2_2, 1968 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_2_2_1, 1967 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_2_1_2, 1966 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_2_1_1, 1965 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_1_2_2, 1964 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_1_2_1, 1963 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_1_1_2, 1962 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_2_1_1_1, 1961 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_2_2_2, 1960 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_2_2_1, 1959 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_2_1_2, 1958 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_2_1_1, 1957 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_1_2_2, 1956 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_1_2_1, 1955 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_1_1_2, 1954 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_2_1_1_1_1, 1953 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_2_2_2, 1952 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_2_2_1, 1951 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_2_1_2, 1950 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_2_1_1, 1949 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_1_2_2, 1948 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_1_2_1, 1947 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_1_1_2, 1946 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_2_1_1_1, 1945 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_2_2_2, 1944 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_2_2_1, 1943 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_2_1_2, 1942 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_2_1_1, 1941 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_1_2_2, 1940 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_1_2_1, 1939 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_1_1_2, 1938 ]
// SHARED-NEXT: [ 1, foo_2_2_2_1_1_1_1_1_1, 1937 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_2_2_2, 1936 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_2_2_1, 1935 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_2_1_2, 1934 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_2_1_1, 1933 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_1_2_2, 1932 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_1_2_1, 1931 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_1_1_2, 1930 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_2_1_1_1, 1929 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_2_2_2, 1928 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_2_2_1, 1927 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_2_1_2, 1926 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_2_1_1, 1925 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_1_2_2, 1924 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_1_2_1, 1923 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_1_1_2, 1922 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_2_1_1_1_1, 1921 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_2_2_2, 1920 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_2_2_1, 1919 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_2_1_2, 1918 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_2_1_1, 1917 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_1_2_2, 1916 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_1_2_1, 1915 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_1_1_2, 1914 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_2_1_1_1, 1913 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_2_2_2, 1912 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_2_2_1, 1911 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_2_1_2, 1910 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_2_1_1, 1909 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_1_2_2, 1908 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_1_2_1, 1907 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_1_1_2, 1906 ]
// SHARED-NEXT: [ 1, foo_2_2_1_2_1_1_1_1_1, 1905 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_2_2_2, 1904 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_2_2_1, 1903 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_2_1_2, 1902 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_2_1_1, 1901 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_1_2_2, 1900 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_1_2_1, 1899 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_1_1_2, 1898 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_2_1_1_1, 1897 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_2_2_2, 1896 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_2_2_1, 1895 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_2_1_2, 1894 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_2_1_1, 1893 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_1_2_2, 1892 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_1_2_1, 1891 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_1_1_2, 1890 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_2_1_1_1_1, 1889 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_2_2_2, 1888 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_2_2_1, 1887 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_2_1_2, 1886 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_2_1_1, 1885 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_1_2_2, 1884 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_1_2_1, 1883 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_1_1_2, 1882 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_2_1_1_1, 1881 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_2_2_2, 1880 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_2_2_1, 1879 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_2_1_2, 1878 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_2_1_1, 1877 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_1_2_2, 1876 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_1_2_1, 1875 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_1_1_2, 1874 ]
// SHARED-NEXT: [ 1, foo_2_2_1_1_1_1_1_1_1, 1873 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_2_2_2, 1872 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_2_2_1, 1871 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_2_1_2, 1870 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_2_1_1, 1869 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_1_2_2, 1868 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_1_2_1, 1867 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_1_1_2, 1866 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_2_1_1_1, 1865 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_2_2_2, 1864 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_2_2_1, 1863 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_2_1_2, 1862 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_2_1_1, 1861 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_1_2_2, 1860 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_1_2_1, 1859 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_1_1_2, 1858 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_2_1_1_1_1, 1857 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_2_2_2, 1856 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_2_2_1, 1855 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_2_1_2, 1854 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_2_1_1, 1853 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_1_2_2, 1852 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_1_2_1, 1851 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_1_1_2, 1850 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_2_1_1_1, 1849 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_2_2_2, 1848 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_2_2_1, 1847 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_2_1_2, 1846 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_2_1_1, 1845 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_1_2_2, 1844 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_1_2_1, 1843 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_1_1_2, 1842 ]
// SHARED-NEXT: [ 1, foo_2_1_2_2_1_1_1_1_1, 1841 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_2_2_2, 1840 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_2_2_1, 1839 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_2_1_2, 1838 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_2_1_1, 1837 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_1_2_2, 1836 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_1_2_1, 1835 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_1_1_2, 1834 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_2_1_1_1, 1833 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_2_2_2, 1832 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_2_2_1, 1831 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_2_1_2, 1830 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_2_1_1, 1829 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_1_2_2, 1828 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_1_2_1, 1827 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_1_1_2, 1826 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_2_1_1_1_1, 1825 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_2_2_2, 1824 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_2_2_1, 1823 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_2_1_2, 1822 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_2_1_1, 1821 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_1_2_2, 1820 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_1_2_1, 1819 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_1_1_2, 1818 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_2_1_1_1, 1817 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_2_2_2, 1816 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_2_2_1, 1815 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_2_1_2, 1814 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_2_1_1, 1813 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_1_2_2, 1812 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_1_2_1, 1811 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_1_1_2, 1810 ]
// SHARED-NEXT: [ 1, foo_2_1_2_1_1_1_1_1_1, 1809 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_2_2_2, 1808 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_2_2_1, 1807 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_2_1_2, 1806 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_2_1_1, 1805 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_1_2_2, 1804 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_1_2_1, 1803 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_1_1_2, 1802 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_2_1_1_1, 1801 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_2_2_2, 1800 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_2_2_1, 1799 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_2_1_2, 1798 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_2_1_1, 1797 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_1_2_2, 1796 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_1_2_1, 1795 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_1_1_2, 1794 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_2_1_1_1_1, 1793 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_2_2_2, 1792 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_2_2_1, 1791 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_2_1_2, 1790 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_2_1_1, 1789 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_1_2_2, 1788 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_1_2_1, 1787 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_1_1_2, 1786 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_2_1_1_1, 1785 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_2_2_2, 1784 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_2_2_1, 1783 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_2_1_2, 1782 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_2_1_1, 1781 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_1_2_2, 1780 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_1_2_1, 1779 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_1_1_2, 1778 ]
// SHARED-NEXT: [ 1, foo_2_1_1_2_1_1_1_1_1, 1777 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_2_2_2, 1776 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_2_2_1, 1775 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_2_1_2, 1774 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_2_1_1, 1773 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_1_2_2, 1772 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_1_2_1, 1771 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_1_1_2, 1770 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_2_1_1_1, 1769 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_2_2_2, 1768 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_2_2_1, 1767 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_2_1_2, 1766 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_2_1_1, 1765 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_1_2_2, 1764 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_1_2_1, 1763 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_1_1_2, 1762 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_2_1_1_1_1, 1761 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_2_2_2, 1760 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_2_2_1, 1759 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_2_1_2, 1758 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_2_1_1, 1757 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_1_2_2, 1756 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_1_2_1, 1755 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_1_1_2, 1754 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_2_1_1_1, 1753 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_1_2_2_2, 1752 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_1_2_2_1, 1751 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_1_2_1_2, 1750 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_1_2_1_1, 1749 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_1_1_2_2, 1748 ]
// SHARED-NEXT: [ 1, foo_2_1_1_1_1_1_1_2_1, 1747 ]
// SHARED-NEXT: [ 1, foo
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-merge-match-lib.c 0000664 0001750 0001750 00000001446 12670054656 032247 0 ustar mwhudson mwhudson #include
#include
#include
int __llvm_profile_runtime = 0;
uint64_t __llvm_profile_get_size_for_buffer(void);
int __llvm_profile_write_buffer(char *);
void __llvm_profile_reset_counters(void);
int __llvm_profile_check_compatibility(const char *, uint64_t);
int gg = 0;
void bar(char c) {
if (c == '1')
gg++;
else
gg--;
}
/* Returns 0 (size) when an error occurs. */
uint64_t libEntry(char *Buffer, uint64_t MaxSize) {
uint64_t Size = __llvm_profile_get_size_for_buffer();
if (Size > MaxSize)
return 0;
__llvm_profile_reset_counters();
bar('1');
if (__llvm_profile_write_buffer(Buffer))
return 0;
/* Now check compatibility. Should return 0. */
if (__llvm_profile_check_compatibility(Buffer, Size))
return 0;
return Size;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dynamic-a.cpp 0000664 0001750 0001750 00000000563 12752442526 031511 0 ustar mwhudson mwhudson #include "instrprof-dynamic-header.h"
void a() { // COV: [[@LINE]]| 1|void a
if (true) { // COV: [[@LINE]]| 1| if
bar(1); // COV: [[@LINE]]| 1| bar
bar(1); // COV: [[@LINE]]| 1| bar
} // COV: [[@LINE]]| 1| }
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dlopen-main.c 0000664 0001750 0001750 00000002122 12336205421 031470 0 ustar mwhudson mwhudson
#include
#include
#ifdef DLOPEN_FUNC_DIR
#include
#else
void func(int K);
void func2(int K);
#endif
int main(int argc, char *argv[]) {
#ifdef DLOPEN_FUNC_DIR
dlerror();
void *f1_handle = dlopen(DLOPEN_FUNC_DIR"/func.shared", DLOPEN_FLAGS);
if (f1_handle == NULL) {
fprintf(stderr, "unable to open '" DLOPEN_FUNC_DIR "/func.shared': %s\n",
dlerror());
return EXIT_FAILURE;
}
void (*func)(int) = (void (*)(int))dlsym(f1_handle, "func");
if (func == NULL) {
fprintf(stderr, "unable to lookup symbol 'func': %s\n", dlerror());
return EXIT_FAILURE;
}
void *f2_handle = dlopen(DLOPEN_FUNC_DIR"/func2.shared", DLOPEN_FLAGS);
if (f2_handle == NULL) {
fprintf(stderr, "unable to open '" DLOPEN_FUNC_DIR "/func2.shared': %s\n",
dlerror());
return EXIT_FAILURE;
}
void (*func2)(int) = (void (*)(int))dlsym(f2_handle, "func2");
if (func2 == NULL) {
fprintf(stderr, "unable to lookup symbol 'func2': %s\n", dlerror());
return EXIT_FAILURE;
}
#endif
func(1);
func2(0);
return EXIT_SUCCESS;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/extern_template2.cpp 0000664 0001750 0001750 00000000165 12664441431 031077 0 ustar mwhudson mwhudson #define USE
#include "extern_template.h"
#undef USE
extern Test TO;
int bar() {
TO.doIt(5);
return TO.M;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dynamic-main.cpp 0000664 0001750 0001750 00000000235 12532165425 032205 0 ustar mwhudson mwhudson #include "instrprof-dynamic-header.h"
void foo(int K) { if (K) {} }
int main(int argc, char *argv[]) {
foo(5);
bar(1);
a();
b();
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-icall-promo.h 0000664 0001750 0001750 00000000106 12724056665 031527 0 ustar mwhudson mwhudson struct A {
virtual int foo() { return 1; };
virtual int bar();
};
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-file_ex.c 0000664 0001750 0001750 00000002364 12726305567 030727 0 ustar mwhudson mwhudson /* This is a test case where the parent process forks 10
* children which contend to write to the same file. With
* file locking support, the data from each child should not
* be lost.
*/
#include
#include
#include
#include
extern FILE *lprofOpenFileEx(const char *);
int main(int argc, char *argv[]) {
pid_t tid;
FILE *F;
const char *FN;
int child[10];
int c;
int i;
if (argc < 2) {
fprintf(stderr, "Requires one argument \n");
exit(1);
}
FN = argv[1];
truncate(FN, 0);
for (i = 0; i < 10; i++) {
c = fork();
// in child:
if (c == 0) {
FILE *F = lprofOpenFileEx(FN);
if (!F) {
fprintf(stderr, "Can not open file %s from child\n", FN);
exit(1);
}
fseek(F, 0, SEEK_END);
fprintf(F, "Dump from Child %d\n", i);
fclose(F);
exit(0);
} else {
child[i] = c;
}
}
// In parent
for (i = 0; i < 10; i++) {
int child_status;
if ((tid = waitpid(child[i], &child_status, 0)) == -1)
break;
}
F = lprofOpenFileEx(FN);
if (!F) {
fprintf(stderr, "Can not open file %s from parent\n", FN);
exit(1);
}
fseek(F, 0, SEEK_END);
fprintf(F, "Dump from parent %d\n", i);
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/extern_template.cpp 0000664 0001750 0001750 00000000300 12664441431 031004 0 ustar mwhudson mwhudson #define DEF
#include "extern_template.h"
#undef DEF
extern int bar();
extern int foo();
extern Test TO;
int main() {
foo();
int R = bar();
if (R != 10)
return 1;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-icall-promo_2.cc 0000664 0001750 0001750 00000000327 12724056665 032113 0 ustar mwhudson mwhudson #include "instrprof-icall-promo.h"
extern int ref(A *);
int A::bar() { return 2; }
extern A *ap;
int test() {
for (int i = 0; i < 10000; i++) ap->foo();
return ref(ap);
}
int main() {
test();
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-shared-lib.c 0000664 0001750 0001750 00000000132 12621462443 031304 0 ustar mwhudson mwhudson int g1 = 0;
int g2 = 1;
void foo(int n) {
if (n % 5 == 0)
g1++;
else
g2++;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-visibility-helper.cpp 0000664 0001750 0001750 00000000036 12675350047 033306 0 ustar mwhudson mwhudson namespace N1 {
void f4() {}
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/gcc-flag-compatibility.c 0000664 0001750 0001750 00000000130 12547526660 031567 0 ustar mwhudson mwhudson int X = 0;
int main() {
int i;
for (i = 0; i < 100; i++)
X += i;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-comdat-1.cpp 0000664 0001750 0001750 00000000305 12650252267 031244 0 ustar mwhudson mwhudson #include "instrprof-comdat.h"
int g;
extern int bar(int);
int main() {
FOO Foo;
int Res = Foo.DoIt(10);
if (Res > 10)
g = bar(10);
else
g = bar(1) + bar(2);
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/extern_template1.cpp 0000664 0001750 0001750 00000000157 12664441431 031077 0 ustar mwhudson mwhudson #define USE
#include "extern_template.h"
#undef USE
Test TO;
int foo() {
TO.doIt(20);
return TO.M;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/comdat_rename.h 0000664 0001750 0001750 00000000334 12762037262 030060 0 ustar mwhudson mwhudson struct FOO {
FOO() : a(0), b(0) {}
int callee();
__attribute__((noinline)) void caller(int n) {
int r = callee();
if (r == 0) {
a += n;
b += 1;
}
}
int a;
int volatile b;
};
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dynamic-b.cpp 0000664 0001750 0001750 00000000150 12532165425 031476 0 ustar mwhudson mwhudson #include "instrprof-dynamic-header.h"
void b() {
if (true) {
bar(1);
bar(1);
}
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-merge-match.c 0000664 0001750 0001750 00000002232 12666355326 031500 0 ustar mwhudson mwhudson #include
#include
#include
int __llvm_profile_runtime = 0;
uint64_t __llvm_profile_get_size_for_buffer(void);
int __llvm_profile_write_buffer(char *);
void __llvm_profile_reset_counters(void);
int __llvm_profile_check_compatibility(const char *, uint64_t);
int g = 0;
void foo(char c) {
if (c == '1')
g++;
else
g--;
}
extern uint64_t libEntry(char *Buffer, uint64_t MaxSize);
int main(int argc, const char *argv[]) {
const uint64_t MaxSize = 10000;
static char Buffer[MaxSize];
uint64_t Size = __llvm_profile_get_size_for_buffer();
if (Size > MaxSize)
return 1;
__llvm_profile_reset_counters();
foo('0');
if (__llvm_profile_write_buffer(Buffer))
return 1;
/* Now check compatibility. Should return 0. */
if (__llvm_profile_check_compatibility(Buffer, Size))
return 1;
/* Clear the buffer. */
memset(Buffer, 0, MaxSize);
/* Collect profile from shared library. */
Size = libEntry(Buffer, MaxSize);
if (!Size)
return 1;
/* Shared library's profile should not match main executable's. */
if (!__llvm_profile_check_compatibility(Buffer, Size))
return 1;
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-icall-promo_1.cc 0000664 0001750 0001750 00000000137 12724056665 032111 0 ustar mwhudson mwhudson #include "instrprof-icall-promo.h"
A a;
A* ap = &a;
int ref(A* ap) { return ap->A::foo(); }
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-dlopen-func.c 0000664 0001750 0001750 00000000037 12335535402 031506 0 ustar mwhudson mwhudson void func(int K) { if (K) {} }
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/comdat_rename_1.cc 0000664 0001750 0001750 00000002257 12747754476 030464 0 ustar mwhudson mwhudson #include "comdat_rename.h"
// callee's out-of-line instance profile data -- it comes
// from external calls to it from comdat_rename_2.cc.
// Its inline instance copy's profile data is different and
// is collected in 'caller''s context.
int FOO::callee() {
// CHECK-LABEL: define {{.*}}callee{{.*}}
// CHECK-NOT: br i1 {{.*}}
// CHECK: br {{.*}}label{{.*}}, label %[[BB1:.*]], !prof ![[PD1:[0-9]+]]
// CHECK: {{.*}}[[BB1]]:
if (b != 0)
return a / b;
if (a != 0)
return 10 / a;
return 0;
}
// This is the 'caller''s comdat copy (after renaming) in this module.
// The profile counters include a copy of counters from 'callee':
//
// CHECK-LABEL: define {{.*}}caller{{.*}}
// CHECK-NOT: br i1 {{.*}}
// CHECK: br {{.*}}label{{.*}}, label %[[BB2:.*]], !prof ![[PD2:[0-9]+]]
// CHECK: {{.*}}[[BB2]]:
// CHECK: br {{.*}}label{{.*}}, label %{{.*}}, !prof !{{.*}}
// CHECK: br {{.*}}label %[[BB3:.*]], label %{{.*}} !prof ![[PD3:[0-9]+]]
// CHECK: {{.*}}[[BB3]]:
//
// CHECK:![[PD1]] = !{!"branch_weights", i32 0, i32 1}
// CHECK:![[PD2]] = !{!"branch_weights", i32 1, i32 0}
// CHECK:![[PD3]] = !{!"branch_weights", i32 {{.*}}, i32 0}
void test(FOO *foo) { foo->caller(10); }
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-alloc.c 0000664 0001750 0001750 00000001523 12722075231 030366 0 ustar mwhudson mwhudson /* This test case tests that when static allocation for value
* profiler is on, no malloc/calloc calls will be invoked by
* profile runtime library. */
#include
__attribute__((noinline)) void foo() {}
__attribute__((noinline)) void foo2() {}
void (*FP)();
int MainEntered = 0;
int CallocCalled = 0;
int MallocCalled = 0;
extern void *__real_calloc(size_t s, size_t n);
extern void *__real_malloc(size_t s);
void *__wrap_calloc(size_t s, size_t n) {
if (MainEntered)
CallocCalled = 1;
return __real_calloc(s, n);
}
void *__wrap_malloc(size_t s) {
if (MainEntered)
MallocCalled = 1;
return __real_malloc(s);
}
void getFP(int i) {
if (i % 2)
FP = foo;
else
FP = foo2;
}
int main() {
int i;
MainEntered = 1;
for (i = 0; i < 100; i++) {
getFP(i);
FP();
}
return CallocCalled + MallocCalled;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-comdat.h 0000664 0001750 0001750 00000001556 12752442526 030566 0 ustar mwhudson mwhudson // Template instantiations are placed into comdat sections. Check that
// coverage data from different instantiations are mapped back to the correct
// source regions.
template class FOO {
public:
FOO() : t(0) {}
T DoIt(T ti);
private:
T t;
};
template T FOO::DoIt(T ti) { // HEADER: [[@LINE]]| 2|template
for (T I = 0; I < ti; I++) { // HEADER: [[@LINE]]| 22| for (T
t += I; // HEADER: [[@LINE]]| 20| t += I;
if (I > ti / 2) // HEADER: [[@LINE]]| 20| if (I > ti
t -= 1; // HEADER: [[@LINE]]| 8| t -= 1;
} // HEADER: [[@LINE]]| 10| }
// HEADER: [[@LINE]]| 1|
return t; // HEADER: [[@LINE]]| 1| return t;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-comdat-2.cpp 0000664 0001750 0001750 00000000246 12650252267 031251 0 ustar mwhudson mwhudson #include "instrprof-comdat.h"
int bar(int I) {
FOO Foo;
FOO Foo2;
if (I > 5)
return (int)Foo.DoIt(10);
else
return (int)Foo2.DoIt(I);
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/Inputs/instrprof-value-prof-evict.c 0000664 0001750 0001750 00000010641 12717430646 032476 0 ustar mwhudson mwhudson void callee_0() {}
void callee_1() {}
void callee_2() {}
void callee_3() {}
void *CalleeAddrs[] = {callee_0, callee_1, callee_2, callee_3};
extern void lprofSetMaxValsPerSite(unsigned);
// sequences of callee ids
// In the following sequences,
// there are two targets, the dominating target is
// target 0.
int CallSeqTwoTarget_1[] = {0, 0, 0, 0, 0, 1, 1};
int CallSeqTwoTarget_2[] = {1, 1, 0, 0, 0, 0, 0};
int CallSeqTwoTarget_3[] = {1, 0, 0, 1, 0, 0, 0};
int CallSeqTwoTarget_4[] = {0, 0, 0, 1, 0, 1, 0};
// In the following sequences, there are three targets
// The dominating target is 0 and has > 50% of total
// counts.
int CallSeqThreeTarget_1[] = {0, 0, 0, 0, 0, 0, 1, 2, 1};
int CallSeqThreeTarget_2[] = {1, 2, 1, 0, 0, 0, 0, 0, 0};
int CallSeqThreeTarget_3[] = {1, 0, 0, 2, 0, 0, 0, 1, 0};
int CallSeqThreeTarget_4[] = {0, 0, 0, 1, 0, 1, 0, 0, 2};
// Four target sequence --
// There are two cold targets which occupies the value counters
// early. There is also a very hot target and a medium hot target
// which are invoked in an interleaved fashion -- the length of each
// hot period in the sequence is shorter than the cold targets' count.
// 1. If only two values are tracked, the Hot and Medium hot targets
// should surive in the end
// 2. If only three values are tracked, the top three targets should
// surive in the end.
int CallSeqFourTarget_1[] = {1, 1, 1, 2, 2, 2, 2, 0, 0, 3, 0, 0, 3, 0, 0, 3,
0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3};
// Same as above, but the cold entries are invoked later.
int CallSeqFourTarget_2[] = {0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0, 0, 3, 0,
0, 3, 0, 0, 3, 0, 0, 3, 1, 1, 1, 2, 2, 2, 2};
// Same as above, but all the targets are interleaved.
int CallSeqFourTarget_3[] = {0, 3, 0, 0, 1, 3, 0, 0, 0, 2, 0, 0, 3, 3, 0, 3,
2, 2, 0, 3, 3, 1, 0, 0, 1, 0, 0, 3, 0, 2, 0};
typedef void (*FPT)(void);
// Testing value profiling eviction algorithm.
FPT getCalleeFunc(int I) { return CalleeAddrs[I]; }
int main() {
int I;
#define INDIRECT_CALLSITE(Sequence, NumValsTracked) \
lprofSetMaxValsPerSite(NumValsTracked); \
for (I = 0; I < sizeof(Sequence) / sizeof(*Sequence); I++) { \
FPT FP = getCalleeFunc(Sequence[I]); \
FP(); \
}
// check site, target patterns
// CHECK: 0, callee_0
INDIRECT_CALLSITE(CallSeqTwoTarget_1, 1);
// CHECK-NEXT: 1, callee_0
INDIRECT_CALLSITE(CallSeqTwoTarget_2, 1);
// CHECK-NEXT: 2, callee_0
INDIRECT_CALLSITE(CallSeqTwoTarget_3, 1);
// CHECK-NEXT: 3, callee_0
INDIRECT_CALLSITE(CallSeqTwoTarget_4, 1);
// CHECK-NEXT: 4, callee_0
INDIRECT_CALLSITE(CallSeqThreeTarget_1, 1);
// CHECK-NEXT: 5, callee_0
INDIRECT_CALLSITE(CallSeqThreeTarget_2, 1);
// CHECK-NEXT: 6, callee_0
INDIRECT_CALLSITE(CallSeqThreeTarget_3, 1);
// CHECK-NEXT: 7, callee_0
INDIRECT_CALLSITE(CallSeqThreeTarget_4, 1);
// CHECK-NEXT: 8, callee_0
// CHECK-NEXT: 8, callee_1
INDIRECT_CALLSITE(CallSeqThreeTarget_1, 2);
// CHECK-NEXT: 9, callee_0
// CHECK-NEXT: 9, callee_1
INDIRECT_CALLSITE(CallSeqThreeTarget_2, 2);
// CHECK-NEXT: 10, callee_0
// CHECK-NEXT: 10, callee_1
INDIRECT_CALLSITE(CallSeqThreeTarget_3, 2);
// CHECK-NEXT: 11, callee_0
// CHECK-NEXT: 11, callee_1
INDIRECT_CALLSITE(CallSeqThreeTarget_4, 2);
// CHECK-NEXT: 12, callee_0
INDIRECT_CALLSITE(CallSeqFourTarget_1, 1);
// CHECK-NEXT: 13, callee_0
INDIRECT_CALLSITE(CallSeqFourTarget_2, 1);
// CHECK-NEXT: 14, callee_0
INDIRECT_CALLSITE(CallSeqFourTarget_3, 1);
// CHECK-NEXT: 15, callee_0
// CHECK-NEXT: 15, callee_3
INDIRECT_CALLSITE(CallSeqFourTarget_1, 2);
// CHECK-NEXT: 16, callee_0
// CHECK-NEXT: 16, callee_3
INDIRECT_CALLSITE(CallSeqFourTarget_2, 2);
// CHECK-NEXT: 17, callee_0
// CHECK-NEXT: 17, callee_3
INDIRECT_CALLSITE(CallSeqFourTarget_3, 2);
// CHECK-NEXT: 18, callee_0
// CHECK-NEXT: 18, callee_3
// CHECK-NEXT: 18, callee_2
INDIRECT_CALLSITE(CallSeqFourTarget_1, 3);
// CHECK-NEXT: 19, callee_0
// CHECK-NEXT: 19, callee_3
// CHECK-NEXT: 19, callee_2
INDIRECT_CALLSITE(CallSeqFourTarget_2, 3);
// CHECK-NEXT: 20, callee_0
// CHECK-NEXT: 20, callee_3
// CHECK-NEXT: 20, callee_2
INDIRECT_CALLSITE(CallSeqFourTarget_3, 3);
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-shared.test 0000664 0001750 0001750 00000012077 12645074632 030033 0 ustar mwhudson mwhudson """
This test produces three shared libraries:
1. libt-instr.so is instrumented
2. libt-no-instr1.so is not instrumented
3. libt-no-instr2.so is built with profile rt linked in (via -u), but the object file is built
with instrumentation turned off.
After the libraries are built, the main program is then built with/without instrumentation and linked
against 3 libraries above.
The test is to verify that programs linked against these shared objects with and without instrumentation
enabled behave as expected.
"""
RUN: mkdir -p %t.d
RUN: %clang_profgen -o %t.d/libt-instr.so -fPIC -shared %S/Inputs/instrprof-shared-lib.c
RUN: %clang -o %t.d/libt-no-instr1.so -fPIC -shared %S/Inputs/instrprof-shared-lib.c
RUN: %clang -c -o %t.d/instrprof-shared-lib-no-instr2.o -fPIC %S/Inputs/instrprof-shared-lib.c
RUN: %clang_profgen -o %t.d/libt-no-instr2.so -fPIC -shared %t.d/instrprof-shared-lib-no-instr2.o
RUN: %clang_profgen -o %t-instr-instr -L%t.d -rpath %t.d -lt-instr %S/Inputs/instrprof-shared-main.c
RUN: %clang_profgen -o %t-instr-no-instr1 -L%t.d -rpath %t.d -lt-no-instr1 %S/Inputs/instrprof-shared-main.c
RUN: %clang_profgen -o %t-instr-no-instr2 -L%t.d -rpath %t.d -lt-no-instr2 %S/Inputs/instrprof-shared-main.c
RUN: %clang -o %t-no-instr1-instr -L%t.d -rpath %t.d -lt-instr %S/Inputs/instrprof-shared-main.c
RUN: %clang -o %t-no-instr1-no-instr1 -L%t.d -rpath %t.d -lt-no-instr1 %S/Inputs/instrprof-shared-main.c
RUN: %clang -o %t-no-instr1-no-instr2 -L%t.d -rpath %t.d -lt-no-instr2 %S/Inputs/instrprof-shared-main.c
RUN: %clang -c -o %t.d/instrprof-shared-main-no-instr2.o %S/Inputs/instrprof-shared-main.c
RUN: %clang -o %t-no-instr2-instr -L%t.d -rpath %t.d -lt-instr %t.d/instrprof-shared-main-no-instr2.o
RUN: %clang -o %t-no-instr2-no-instr1 -L%t.d -rpath %t.d -lt-no-instr1 %t.d/instrprof-shared-main-no-instr2.o
RUN: %clang -o %t-no-instr2-no-instr2 -L%t.d -rpath %t.d -lt-no-instr2 %t.d/instrprof-shared-main-no-instr2.o
RUN: env LLVM_PROFILE_FILE=%t-instr-instr.profraw %run %t-instr-instr
RUN: env LLVM_PROFILE_FILE=%t-instr-no-instr1.profraw %run %t-instr-no-instr1
RUN: env LLVM_PROFILE_FILE=%t-instr-no-instr2.profraw %run %t-instr-no-instr2
RUN: env LLVM_PROFILE_FILE=%t-no-instr1-instr.profraw %run %t-no-instr1-instr
RUN: env LLVM_PROFILE_FILE=%t-no-instr2-instr.profraw %run %t-no-instr2-instr
RUN: env LLVM_PROFILE_FILE=%t-no-instr1-no-instr1.profraw %run %t-no-instr1-no-instr1
RUN: env LLVM_PROFILE_FILE=%t-no-instr1-no-instr2.profraw %run %t-no-instr1-no-instr2
RUN: env LLVM_PROFILE_FILE=%t-no-instr2-no-instr1.profraw %run %t-no-instr2-no-instr1
RUN: env LLVM_PROFILE_FILE=%t-no-instr2-no-instr2.profraw %run %t-no-instr2-no-instr2
RUN: llvm-profdata merge -o %t-instr-instr.profdata %t-instr-instr.profraw
RUN: llvm-profdata merge -o %t-instr-no-instr1.profdata %t-instr-no-instr1.profraw
RUN: llvm-profdata merge -o %t-instr-no-instr2.profdata %t-instr-no-instr2.profraw
RUN: llvm-profdata merge -o %t-no-instr1-instr.profdata %t-no-instr1-instr.profraw
RUN: llvm-profdata merge -o %t-no-instr2-instr.profdata %t-no-instr2-instr.profraw
RUN: not llvm-profdata merge -o %t-no-instr1-no-instr1.profdata %t-no-instr1-no-instr1.profraw 2>&1 | FileCheck %s --check-prefix=MISSING-FILE
RUN: not llvm-profdata merge -o %t-no-instr2-no-instr1.profdata %t-no-instr2-no-instr1.profraw 2>&1 | FileCheck %s --check-prefix=MISSING-FILE
MISSING-FILE: profraw
RUN: llvm-profdata show -counts --function main %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-main-1
RUN: llvm-profdata show -counts --function main %t-instr-no-instr1.profdata | grep -v 'Total\|Maximum' > %t-main-2
RUN: llvm-profdata show -counts --function main %t-instr-no-instr2.profdata | grep -v 'Total\|Maximum' > %t-main-3
RUN: llvm-profdata show -counts --function foo %t-instr-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-1
RUN: llvm-profdata show -counts --function foo %t-no-instr1-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-2
RUN: llvm-profdata show -counts --function foo %t-no-instr2-instr.profdata | grep -v 'Total\|Maximum' > %t-foo-3
RUN: %clang_profuse=%t-instr-instr.profdata -o %t-main-instr-instr.ll -S -emit-llvm %S/Inputs/instrprof-shared-main.c
RUN: %clang_profuse=%t-instr-no-instr1.profdata -o %t-main-instr-no-instr1.ll -S -emit-llvm %S/Inputs/instrprof-shared-main.c
RUN: %clang_profuse=%t-instr-no-instr2.profdata -o %t-main-instr-no-instr2.ll -S -emit-llvm %S/Inputs/instrprof-shared-main.c
RUN: %clang_profuse=%t-instr-instr.profdata -o %t-lib-instr-instr.ll -S -emit-llvm %S/Inputs/instrprof-shared-lib.c
RUN: %clang_profuse=%t-no-instr1-instr.profdata -o %t-lib-no-instr1-instr.ll -S -emit-llvm %S/Inputs/instrprof-shared-lib.c
RUN: %clang_profuse=%t-no-instr2-instr.profdata -o %t-lib-no-instr2-instr.ll -S -emit-llvm %S/Inputs/instrprof-shared-lib.c
RUN: %clang_profuse=%t-instr-instr.profdata -o %t-lib-instr-instr.ll -S -emit-llvm %S/Inputs/instrprof-shared-lib.c
RUN: diff %t-main-instr-no-instr1.ll %t-main-instr-no-instr2.ll
RUN: diff %t-lib-no-instr1-instr.ll %t-lib-no-instr2-instr.ll
RUN: diff %t-main-1 %t-main-2
RUN: diff %t-main-1 %t-main-3
RUN: diff %t-foo-1 %t-foo-2
RUN: diff %t-foo-1 %t-foo-3
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/lit.cfg 0000664 0001750 0001750 00000007215 12777257100 025106 0 ustar mwhudson mwhudson # -*- Python -*-
import os
def get_required_attr(config, attr_name):
attr_value = getattr(config, attr_name, None)
if attr_value == None:
lit_config.fatal(
"No attribute %r in test configuration! You may need to run "
"tests from your build directory or add this attribute "
"to lit.site.cfg " % attr_name)
return attr_value
# Setup config name.
config.name = 'Profile-' + config.target_arch
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Setup executable root.
if hasattr(config, 'profile_lit_binary_dir') and \
config.profile_lit_binary_dir is not None:
config.test_exec_root = os.path.join(config.profile_lit_binary_dir, config.name)
# If the above check didn't work, we're probably in the source tree. Use some
# magic to re-execute from the build tree.
if config.test_exec_root is None:
# The magic relies on knowing compilerrt_site_basedir.
compilerrt_basedir = lit_config.params.get('compilerrt_site_basedir', None)
if compilerrt_basedir:
site_cfg = os.path.join(compilerrt_basedir, 'profile', 'lit.site.cfg')
if os.path.exists(site_cfg):
lit_config.load_config(config, site_cfg)
raise SystemExit
if config.host_os in ['Linux']:
extra_linkflags = ["-ldl"]
else:
extra_linkflags = []
# Test suffixes.
config.suffixes = ['.c', '.cc', '.cpp', '.m', '.mm', '.ll', '.test']
# What to exclude.
config.excludes = ['Inputs']
# Clang flags.
target_cflags=[get_required_attr(config, "target_cflags")]
clang_cflags = target_cflags + extra_linkflags
clang_cxxflags = config.cxx_mode_flags + clang_cflags
def build_invocation(compile_flags, with_lto = False):
lto_flags = []
lto_prefix = []
if with_lto and config.lto_supported:
lto_flags += config.lto_flags
lto_prefix += config.lto_launch
return " " + " ".join(lto_prefix + [config.clang] + lto_flags + compile_flags) + " "
# Add clang substitutions.
config.substitutions.append( ("%clang ", build_invocation(clang_cflags)) )
config.substitutions.append( ("%clangxx ", build_invocation(clang_cxxflags)) )
config.substitutions.append( ("%clang_profgen ", build_invocation(clang_cflags) + " -fprofile-instr-generate ") )
config.substitutions.append( ("%clang_profgen=", build_invocation(clang_cflags) + " -fprofile-instr-generate=") )
config.substitutions.append( ("%clang_pgogen ", build_invocation(clang_cflags) + " -fprofile-generate ") )
config.substitutions.append( ("%clang_pgogen=", build_invocation(clang_cflags) + " -fprofile-generate=") )
config.substitutions.append( ("%clangxx_profgen ", build_invocation(clang_cxxflags) + " -fprofile-instr-generate ") )
config.substitutions.append( ("%clangxx_profgen=", build_invocation(clang_cxxflags) + " -fprofile-instr-generate=") )
config.substitutions.append( ("%clangxx_pgogen ", build_invocation(clang_cxxflags) + " -fprofile-generate ") )
config.substitutions.append( ("%clangxx_pgogen=", build_invocation(clang_cxxflags) + " -fprofile-generate=") )
config.substitutions.append( ("%clang_profgen_gcc=", build_invocation(clang_cflags) + " -fprofile-generate=") )
config.substitutions.append( ("%clang_profuse_gcc=", build_invocation(clang_cflags) + " -fprofile-use=") )
config.substitutions.append( ("%clang_profuse=", build_invocation(clang_cflags) + " -fprofile-instr-use=") )
config.substitutions.append( ("%clangxx_profuse=", build_invocation(clang_cxxflags) + " -fprofile-instr-use=") )
config.substitutions.append( ("%clang_lto_profgen=", build_invocation(clang_cflags, True) + " -fprofile-instr-generate=") )
if config.host_os not in ['Darwin', 'FreeBSD', 'Linux']:
config.unsupported = True
if config.target_arch in ['armv7l']:
config.unsupported = True
././@LongLink 0000644 0000000 0000000 00000000150 00000000000 011577 L ustar root root golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-set-filename-then-reset-default.c golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-set-filename-then-reset-defaul0000664 0001750 0001750 00000001172 12520251623 033451 0 ustar mwhudson mwhudson // RUN: rm -rf %t.d
// RUN: mkdir -p %t.d
// RUN: cd %t.d
// RUN: %clang_profgen -O3 %s -o %t.out
// RUN: %run %t.out %t.d/bad.profraw
// RUN: llvm-profdata merge -o %t.d/default.profdata %t.d/default.profraw
// RUN: %clang_profuse=%t.d/default.profdata -o - -S -emit-llvm %s | FileCheck %s
void __llvm_profile_set_filename(const char *);
int main(int argc, const char *argv[]) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
__llvm_profile_set_filename(argv[1]);
__llvm_profile_set_filename(0);
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-override-filename-then-reset-default.c golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-override-filename-then-reset-d0000664 0001750 0001750 00000001173 12744254166 033476 0 ustar mwhudson mwhudson // RUN: rm -rf %t.d
// RUN: mkdir -p %t.d
// RUN: cd %t.d
// RUN: %clang_profgen -O3 %s -o %t.out
// RUN: %run %t.out %t.d/bad.profraw
// RUN: llvm-profdata merge -o %t.d/default.profdata %t.d/default.profraw
// RUN: %clang_profuse=%t.d/default.profdata -o - -S -emit-llvm %s | FileCheck %s
void __llvm_profile_set_filename(const char *);
int main(int argc, const char *argv[]) {
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
__llvm_profile_set_filename(argv[1]);
__llvm_profile_set_filename(0);
return 0;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-write-file.c 0000664 0001750 0001750 00000002434 12443651733 030072 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t1.profraw %run %t %t2.profraw
// RUN: llvm-profdata merge -o %t1.profdata %t1.profraw
// RUN: %clang_profuse=%t1.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=CHECK1 --check-prefix=CHECK
// RUN: llvm-profdata merge -o %t2.profdata %t2.profraw
// RUN: %clang_profuse=%t2.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=CHECK2 --check-prefix=CHECK
int __llvm_profile_write_file(void);
void __llvm_profile_set_filename(const char *);
int foo(int);
int main(int argc, const char *argv[]) {
// CHECK-LABEL: define {{.*}} @main(
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
if (argc < 2)
return 1;
// Write out the profile.
__llvm_profile_write_file();
// Change the profile.
int Ret = foo(0);
// It'll write out again at exit; change the filename so we get two files.
__llvm_profile_set_filename(argv[1]);
return Ret;
}
int foo(int X) {
// CHECK-LABEL: define {{.*}} @foo(
// CHECK1: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
// CHECK2: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
return X <= 0 ? -X : X;
}
// CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
// CHECK2: ![[PD2]] = !{!"branch_weights", i32 2, i32 1}
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-error.c 0000664 0001750 0001750 00000000357 12717516576 027167 0 ustar mwhudson mwhudson // RUN: %clang_profgen -o %t -O3 %s
// RUN: env LLVM_PROFILE_FILE=%t/ %run %t 1 2>&1 | FileCheck %s
int main(int argc, const char *argv[]) {
if (argc < 2)
return 1;
return 0;
}
// CHECK: LLVM Profile Error: Failed to write file
golang-1.8-race-detector-runtime_0.0+svn285455/test/profile/instrprof-set-filename-shared.test 0000664 0001750 0001750 00000000661 13001263224 032356 0 ustar mwhudson mwhudson # Test that __llvm_profile_set_filename is honored by shared libary too.
RUN: mkdir -p %t.d
RUN: %clang_profgen=%t.shared.profraw -fPIC -shared -o %t.d/t.shared %S/Inputs/instrprof-dlopen-func.c
RUN: %clang_profgen -DCALL_SHARED -o %t.m -O3 -rpath %t.d %t.d/t.shared %S/instrprof-set-filename.c
RUN: %run %t.m %t.main.profraw
RUN: llvm-profdata show %t.main.profraw | FileCheck --check-prefix=SHARED %s
# SHARED: Total functions: 2
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/ 0000775 0001750 0001750 00000000000 13040224625 023123 5 ustar mwhudson mwhudson golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/race_top_suppression.cc 0000664 0001750 0001750 00000001072 12623403316 027702 0 ustar mwhudson mwhudson // RUN: echo "race_top:TopFunction" > %t.supp
// RUN: %clangxx_tsan -O1 %s -o %t
// RUN: %env_tsan_opts=suppressions='%t.supp' %run %t 2>&1 | FileCheck %s
// RUN: rm %t.supp
#include "test.h"
int Global;
void TopFunction(int *p) {
*p = 1;
}
void *Thread(void *x) {
barrier_wait(&barrier);
TopFunction(&Global);
return 0;
}
int main() {
barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, 0, Thread, 0);
Global--;
barrier_wait(&barrier);
pthread_join(t, 0);
fprintf(stderr, "DONE\n");
}
// CHECK-NOT: WARNING: ThreadSanitizer: data race
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/ignore_malloc.cc 0000664 0001750 0001750 00000001511 12517531510 026244 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include "test.h"
extern "C" {
void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);
}
int *g;
void *Thread(void *a) {
int *p = 0;
while ((p = __atomic_load_n(&g, __ATOMIC_RELAXED)) == 0)
usleep(100); // spin-wait
*p = 42;
return 0;
}
int main() {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
AnnotateIgnoreWritesBegin(__FILE__, __LINE__);
int *p = new int(0);
AnnotateIgnoreWritesEnd(__FILE__, __LINE__);
__atomic_store_n(&g, p, __ATOMIC_RELAXED);
pthread_join(t, 0);
delete p;
fprintf(stderr, "OK\n");
return 0;
}
// CHECK-NOT: WARNING: ThreadSanitizer: data race
// CHECK: OK
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/thread_end_with_ignore.cc 0000664 0001750 0001750 00000001100 12342110363 030112 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include
#include
extern "C" void AnnotateIgnoreReadsBegin(const char *f, int l);
void *Thread(void *x) {
AnnotateIgnoreReadsBegin("", 0);
return 0;
}
int main() {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
pthread_join(t, 0);
}
// CHECK: ThreadSanitizer: thread T1 finished with ignores enabled, created at:
// CHECK: #0 pthread_create
// CHECK: #1 main
// CHECK: Ignore was enabled at:
// CHECK: #0 AnnotateIgnoreReadsBegin
// CHECK: #1 Thread
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/malloc_overflow.cc 0000664 0001750 0001750 00000001231 12704157670 026634 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t
// RUN: %env_tsan_opts=allocator_may_return_null=1 %run %t 2>&1 | FileCheck %s
#include
#include
int main() {
void *p = malloc((size_t)-1);
if (p != 0)
fprintf(stderr, "FAIL malloc(-1) = %p\n", p);
p = malloc((size_t)-1 / 2);
if (p != 0)
fprintf(stderr, "FAIL malloc(-1/2) = %p\n", p);
p = calloc((size_t)-1, (size_t)-1);
if (p != 0)
fprintf(stderr, "FAIL calloc(-1, -1) = %p\n", p);
p = calloc((size_t)-1 / 2, (size_t)-1 / 2);
if (p != 0)
fprintf(stderr, "FAIL calloc(-1/2, -1/2) = %p\n", p);
fprintf(stderr, "OK\n");
}
// CHECK-NOT: FAIL
// CHECK-NOT: failed to allocate
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mutex_bad_read_lock.cc 0000664 0001750 0001750 00000001205 12342110363 027400 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
extern "C" void AnnotateRWLockAcquired(const char *f, int l, void *m, long rw);
int main() {
int m = 0;
AnnotateRWLockAcquired(__FILE__, __LINE__, &m, 1);
AnnotateRWLockAcquired(__FILE__, __LINE__, &m, 0);
return 0;
}
// CHECK: WARNING: ThreadSanitizer: read lock of a write locked mutex
// CHECK: #0 AnnotateRWLockAcquired
// CHECK: #1 main
// CHECK: Location is stack of main thread.
// CHECK: Mutex {{.*}}) created at:
// CHECK: #0 AnnotateRWLockAcquired
// CHECK: #1 main
// CHECK: SUMMARY: ThreadSanitizer: read lock of a write locked mutex
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/bench_acquire_only.cc 0000664 0001750 0001750 00000000643 12623335072 027273 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan %s -o %t
// RUN: %run %t 2>&1 | FileCheck %s
// bench.h needs pthread barriers which are not available on OS X
// UNSUPPORTED: darwin
#include "bench.h"
int x;
void thread(int tid) {
for (int i = 0; i < bench_niter; i++)
__atomic_load_n(&x, __ATOMIC_ACQUIRE);
}
void bench() {
__atomic_store_n(&x, 0, __ATOMIC_RELEASE);
start_thread_group(bench_nthread, thread);
}
// CHECK: DONE
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/signal_cond.cc 0000664 0001750 0001750 00000002271 12767252100 025720 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include "test.h"
#include
#include
#include
#include
// Test that signals can be delivered to blocked pthread_cond_wait.
// https://github.com/google/sanitizers/issues/498
int g_thread_run = 1;
pthread_mutex_t mutex;
pthread_cond_t cond;
void sig_handler(int sig) {
(void)sig;
write(2, "SIGNAL\n", sizeof("SIGNAL\n") - 1);
barrier_wait(&barrier);
}
void* my_thread(void* arg) {
pthread_mutex_lock(&mutex);
while (g_thread_run)
pthread_cond_wait(&cond, &mutex);
pthread_mutex_unlock(&mutex);
return 0;
}
int main() {
barrier_init(&barrier, 2);
pthread_mutex_init(&mutex, 0);
pthread_cond_init(&cond, 0);
signal(SIGUSR1, &sig_handler);
pthread_t thr;
pthread_create(&thr, 0, &my_thread, 0);
// wait for thread to get inside pthread_cond_wait
// (can't use barrier_wait for that)
sleep(1);
pthread_kill(thr, SIGUSR1);
barrier_wait(&barrier);
pthread_mutex_lock(&mutex);
g_thread_run = 0;
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
pthread_join(thr, 0);
fprintf(stderr, "DONE\n");
return 0;
}
// CHECK: SIGNAL
// CHECK: DONE
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mutexset6.cc 0000664 0001750 0001750 00000003107 12626270563 025412 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include "test.h"
int Global;
pthread_mutex_t mtx1;
pthread_mutex_t mtx2;
pthread_rwlock_t mtx3;
void *Thread1(void *x) {
barrier_wait(&barrier);
pthread_mutex_lock(&mtx1);
Global++;
pthread_mutex_unlock(&mtx1);
return NULL;
}
void *Thread2(void *x) {
pthread_mutex_lock(&mtx1);
pthread_mutex_unlock(&mtx1);
pthread_mutex_lock(&mtx2);
pthread_rwlock_rdlock(&mtx3);
Global--;
pthread_mutex_unlock(&mtx2);
pthread_rwlock_unlock(&mtx3);
barrier_wait(&barrier);
return NULL;
}
int main() {
barrier_init(&barrier, 2);
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK: Write of size 4 at {{.*}} by thread T1
// CHECK: (mutexes: write [[M1:M[0-9]+]]):
// CHECK: Previous write of size 4 at {{.*}} by thread T2
// CHECK: (mutexes: write [[M2:M[0-9]+]], read [[M3:M[0-9]+]]):
// CHECK: Mutex [[M1]] (0x{{.*}}) created at:
// CHECK: #1 main {{.*}}mutexset6.cc:[[@LINE+5]]
// CHECK: Mutex [[M2]] (0x{{.*}}) created at:
// CHECK: #1 main {{.*}}mutexset6.cc:[[@LINE+4]]
// CHECK: Mutex [[M3]] (0x{{.*}}) created at:
// CHECK: #1 main {{.*}}mutexset6.cc:[[@LINE+3]]
pthread_mutex_init(&mtx1, 0);
pthread_mutex_init(&mtx2, 0);
pthread_rwlock_init(&mtx3, 0);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
pthread_mutex_destroy(&mtx1);
pthread_mutex_destroy(&mtx2);
pthread_rwlock_destroy(&mtx3);
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/benign_race.cc 0000664 0001750 0001750 00000002036 12704157670 025702 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include "test.h"
int Global;
int WTFGlobal;
extern "C" {
void AnnotateBenignRaceSized(const char *f, int l,
void *mem, unsigned int size, const char *desc);
void WTFAnnotateBenignRaceSized(const char *f, int l,
void *mem, unsigned int size,
const char *desc);
}
void *Thread(void *x) {
Global = 42;
WTFGlobal = 142;
barrier_wait(&barrier);
return 0;
}
int main() {
barrier_init(&barrier, 2);
AnnotateBenignRaceSized(__FILE__, __LINE__,
&Global, sizeof(Global), "Race on Global");
WTFAnnotateBenignRaceSized(__FILE__, __LINE__,
&WTFGlobal, sizeof(WTFGlobal),
"Race on WTFGlobal");
pthread_t t;
pthread_create(&t, 0, Thread, 0);
barrier_wait(&barrier);
Global = 43;
WTFGlobal = 143;
pthread_join(t, 0);
fprintf(stderr, "OK\n");
}
// CHECK-NOT: WARNING: ThreadSanitizer: data race
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/atomic_norace.cc 0000664 0001750 0001750 00000003002 12457727212 026243 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include "test.h"
const int kTestCount = 4;
typedef long long T;
T atomics[kTestCount * 2];
void Test(int test, T *p, bool main_thread) {
volatile T sink;
if (test == 0) {
if (main_thread)
__atomic_fetch_add(p, 1, __ATOMIC_RELAXED);
else
__atomic_fetch_add(p, 1, __ATOMIC_RELAXED);
} else if (test == 1) {
if (main_thread)
__atomic_exchange_n(p, 1, __ATOMIC_ACQ_REL);
else
__atomic_exchange_n(p, 1, __ATOMIC_ACQ_REL);
} else if (test == 2) {
if (main_thread)
sink = __atomic_load_n(p, __ATOMIC_SEQ_CST);
else
__atomic_store_n(p, 1, __ATOMIC_SEQ_CST);
} else if (test == 3) {
if (main_thread)
sink = __atomic_load_n(p, __ATOMIC_SEQ_CST);
else
sink = *p;
}
}
void *Thread(void *p) {
for (int i = 0; i < kTestCount; i++) {
Test(i, &atomics[i], false);
}
barrier_wait(&barrier);
barrier_wait(&barrier);
for (int i = 0; i < kTestCount; i++) {
fprintf(stderr, "Test %d reverse\n", i);
Test(i, &atomics[kTestCount + i], false);
}
return 0;
}
int main() {
barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, 0, Thread, 0);
barrier_wait(&barrier);
for (int i = 0; i < kTestCount; i++) {
fprintf(stderr, "Test %d\n", i);
Test(i, &atomics[i], true);
}
for (int i = 0; i < kTestCount; i++) {
Test(i, &atomics[kTestCount + i], true);
}
barrier_wait(&barrier);
pthread_join(t, 0);
}
// CHECK-NOT: ThreadSanitizer: data race
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/halt_on_error.cc 0000664 0001750 0001750 00000001000 12623403316 026260 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=halt_on_error=1 %deflake %run %t | FileCheck %s
#include "test.h"
int X;
void *Thread(void *x) {
barrier_wait(&barrier);
X = 42;
return 0;
}
int main() {
barrier_init(&barrier, 2);
fprintf(stderr, "BEFORE\n");
pthread_t t;
pthread_create(&t, 0, Thread, 0);
X = 43;
barrier_wait(&barrier);
pthread_join(t, 0);
fprintf(stderr, "AFTER\n");
return 0;
}
// CHECK: BEFORE
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NOT: AFTER
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mutex_lock_destroyed.cc 0000664 0001750 0001750 00000001251 12672277050 027677 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan %s -o %t
// RUN: %deflake %run %t | FileCheck %s
// RUN: %deflake %run %t 1 | FileCheck %s
#include
#include
#include
int main(int argc, char *argv[]) {
pthread_mutex_t *m = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(m, 0);
pthread_mutex_lock(m);
pthread_mutex_unlock(m);
pthread_mutex_destroy(m);
if (argc > 1 && argv[1][0] == '1')
free(m);
pthread_mutex_lock(m);
// CHECK: WARNING: ThreadSanitizer: use of an invalid mutex (e.g. uninitialized or destroyed)
// CHECK: #0 pthread_mutex_lock
// CHECK: #1 main {{.*}}mutex_lock_destroyed.cc:[[@LINE-3]]
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mutex_bad_unlock.cc 0000664 0001750 0001750 00000001161 12342110363 026751 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
extern "C" void AnnotateRWLockReleased(const char *f, int l, void *m, long rw);
int main() {
int m = 0;
AnnotateRWLockReleased(__FILE__, __LINE__, &m, 1);
return 0;
}
// CHECK: WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread)
// CHECK: #0 AnnotateRWLockReleased
// CHECK: #1 main
// CHECK: Location is stack of main thread.
// CHECK: Mutex {{.*}} created at:
// CHECK: #0 AnnotateRWLockReleased
// CHECK: #1 main
// CHECK: SUMMARY: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread)
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/thread_leak2.c 0000664 0001750 0001750 00000000505 12704157670 025627 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include
#include
void *Thread(void *x) {
return 0;
}
int main() {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
pthread_detach(t);
fprintf(stderr, "PASS\n");
return 0;
}
// CHECK-NOT: WARNING: ThreadSanitizer: thread leak
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mutex_cycle_long.c 0000664 0001750 0001750 00000002173 12720016321 026626 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan %s -o %t
// RUN: not %run %t 5 2>&1 | FileCheck %s
// RUN: not %run %t 10 2>&1 | FileCheck %s
// RUN: not %run %t 15 2>&1 | FileCheck %s
// RUN: not %run %t 20 2>&1 | FileCheck %s
// RUN: %run %t 30 2>&1 | FileCheck %s --check-prefix=CHECK-TOO-LONG-CYCLE
#include
#include
#include
int main(int argc, char *argv[]) {
int num_mutexes = 5;
if (argc > 1) num_mutexes = atoi(argv[1]);
pthread_mutex_t m[num_mutexes];
for (int i = 0; i < num_mutexes; ++i)
pthread_mutex_init(&m[i], NULL);
for (int i = 0; i < num_mutexes - 1; ++i) {
pthread_mutex_lock(&m[i]);
pthread_mutex_lock(&m[i + 1]);
pthread_mutex_unlock(&m[i]);
pthread_mutex_unlock(&m[i + 1]);
}
pthread_mutex_lock(&m[num_mutexes - 1]);
pthread_mutex_lock(&m[0]);
pthread_mutex_unlock(&m[num_mutexes - 1]);
pthread_mutex_unlock(&m[0]);
for (int i = 0; i < num_mutexes; ++i)
pthread_mutex_destroy(&m[i]);
fprintf(stderr, "PASS\n");
}
// CHECK: ThreadSanitizer: lock-order-inversion (potential deadlock)
// CHECK-TOO-LONG-CYCLE: WARNING: too long mutex cycle found
// CHECK: PASS
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/java_lock_rec_race.cc 0000664 0001750 0001750 00000002501 12704157670 027217 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
#include "java.h"
jptr varaddr;
jptr lockaddr;
void *Thread(void *p) {
__tsan_java_mutex_lock(lockaddr);
__tsan_java_mutex_lock(lockaddr);
__tsan_java_mutex_lock(lockaddr);
int rec = __tsan_java_mutex_unlock_rec(lockaddr);
if (rec != 3) {
fprintf(stderr, "FAILED 0 rec=%d\n", rec);
exit(1);
}
*(int*)varaddr = 42;
barrier_wait(&barrier);
barrier_wait(&barrier);
__tsan_java_mutex_lock_rec(lockaddr, rec);
__tsan_java_mutex_unlock(lockaddr);
__tsan_java_mutex_unlock(lockaddr);
__tsan_java_mutex_unlock(lockaddr);
return 0;
}
int main() {
barrier_init(&barrier, 2);
int const kHeapSize = 1024 * 1024;
jptr jheap = (jptr)malloc(kHeapSize + 8) + 8;
__tsan_java_init(jheap, kHeapSize);
const int kBlockSize = 16;
__tsan_java_alloc(jheap, kBlockSize);
varaddr = jheap;
*(int*)varaddr = 0;
lockaddr = jheap + 8;
pthread_t th;
pthread_create(&th, 0, Thread, 0);
barrier_wait(&barrier);
__tsan_java_mutex_lock(lockaddr);
*(int*)varaddr = 43;
__tsan_java_mutex_unlock(lockaddr);
barrier_wait(&barrier);
pthread_join(th, 0);
__tsan_java_free(jheap, kBlockSize);
fprintf(stderr, "DONE\n");
return __tsan_java_fini();
}
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NOT: FAILED
// CHECK: DONE
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/suppress_same_stacks.cc 0000664 0001750 0001750 00000001036 12342110363 027670 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include
volatile int N; // Prevent loop unrolling.
int **data;
void *Thread1(void *x) {
for (int i = 0; i < N; i++)
data[i][0] = 42;
return 0;
}
int main() {
N = 4;
data = new int*[N];
for (int i = 0; i < N; i++)
data[i] = new int;
pthread_t t;
pthread_create(&t, 0, Thread1, 0);
Thread1(0);
pthread_join(t, 0);
for (int i = 0; i < N; i++)
delete data[i];
delete[] data;
}
// CHECK: ThreadSanitizer: reported 1 warnings
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/signal_malloc.cc 0000664 0001750 0001750 00000001342 12457727212 026251 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include "test.h"
#include
#include
static void handler(int, siginfo_t*, void*) {
// CHECK: WARNING: ThreadSanitizer: signal-unsafe call inside of a signal
// CHECK: #0 malloc
// CHECK: #{{(1|2)}} handler(int, {{(__)?}}siginfo{{(_t)?}}*, void*) {{.*}}signal_malloc.cc:[[@LINE+2]]
// CHECK: SUMMARY: ThreadSanitizer: signal-unsafe call inside of a signal{{.*}}handler
volatile char *p = (char*)malloc(1);
p[0] = 0;
free((void*)p);
}
int main() {
struct sigaction act = {};
act.sa_sigaction = &handler;
sigaction(SIGPROF, &act, 0);
kill(getpid(), SIGPROF);
sleep(1); // let the signal handler run
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/signal_reset.cc 0000664 0001750 0001750 00000002714 12617405322 026121 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
// UNSUPPORTED: darwin
#include
#include
#include
#include
#include
#include
#include
#include
volatile int X;
int stop;
static void handler(int sig) {
(void)sig;
if (X != 0)
printf("bad");
}
static void* busy(void *p) {
while (__atomic_load_n(&stop, __ATOMIC_RELAXED) == 0) {
}
return 0;
}
static void* reset(void *p) {
struct sigaction act = {};
for (int i = 0; i < 1000000; i++) {
act.sa_handler = &handler;
if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
act.sa_handler = SIG_IGN;
if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
}
return 0;
}
int main() {
struct sigaction act = {};
act.sa_handler = SIG_IGN;
if (sigaction(SIGPROF, &act, 0)) {
perror("sigaction");
exit(1);
}
itimerval t;
t.it_value.tv_sec = 0;
t.it_value.tv_usec = 10;
t.it_interval = t.it_value;
if (setitimer(ITIMER_PROF, &t, 0)) {
perror("setitimer");
exit(1);
}
pthread_t th[2];
pthread_create(&th[0], 0, busy, 0);
pthread_create(&th[1], 0, reset, 0);
pthread_join(th[1], 0);
__atomic_store_n(&stop, 1, __ATOMIC_RELAXED);
pthread_join(th[0], 0);
fprintf(stderr, "DONE\n");
return 0;
}
// CHECK-NOT: WARNING: ThreadSanitizer:
// CHECK: DONE
// CHECK-NOT: WARNING: ThreadSanitizer:
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/sunrpc.cc 0000664 0001750 0001750 00000001023 12704157670 024753 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include
#include
#include
#include
void *thr(void *p) {
XDR xdrs;
char buf[100];
xdrmem_create(&xdrs, buf, sizeof(buf), XDR_ENCODE);
xdr_destroy(&xdrs);
return 0;
}
int main(int argc, char *argv[]) {
pthread_t th[2];
pthread_create(&th[0], 0, thr, 0);
pthread_create(&th[1], 0, thr, 0);
pthread_join(th[0], 0);
pthread_join(th[1], 0);
fprintf(stderr, "DONE\n");
// CHECK: DONE
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mutexset7.cc 0000664 0001750 0001750 00000001746 12457727212 025422 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include "test.h"
int Global;
__thread int huge[1024*1024];
void *Thread1(void *x) {
barrier_wait(&barrier);
Global++;
return NULL;
}
void *Thread2(void *x) {
pthread_mutex_t *mtx = new pthread_mutex_t;
pthread_mutex_init(mtx, 0);
pthread_mutex_lock(mtx);
Global--;
pthread_mutex_unlock(mtx);
pthread_mutex_destroy(mtx);
delete mtx;
barrier_wait(&barrier);
return NULL;
}
int main() {
barrier_init(&barrier, 2);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
}
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK: Write of size 4 at {{.*}} by thread T1:
// CHECK: Previous write of size 4 at {{.*}} by thread T2
// CHECK: (mutexes: write [[M1:M[0-9]+]]):
// CHECK: Mutex [[M1]] is already destroyed
// CHECK-NOT: Mutex {{.*}} created at
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/simple_stack2.cc 0000664 0001750 0001750 00000003000 12461071552 026170 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %T/simple_stack2.cc.exe && %deflake %run %T/simple_stack2.cc.exe | FileCheck %s
#include "test.h"
int Global;
void __attribute__((noinline)) foo1() {
Global = 42;
}
void __attribute__((noinline)) bar1() {
volatile int tmp = 42;
int tmp2 = tmp;
(void)tmp2;
foo1();
}
void __attribute__((noinline)) foo2() {
volatile int tmp = Global;
int tmp2 = tmp;
(void)tmp2;
}
void __attribute__((noinline)) bar2() {
volatile int tmp = 42;
int tmp2 = tmp;
(void)tmp2;
foo2();
}
void *Thread1(void *x) {
barrier_wait(&barrier);
bar1();
return NULL;
}
int main() {
barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, NULL, Thread1, NULL);
bar2();
barrier_wait(&barrier);
pthread_join(t, NULL);
}
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NEXT: Write of size 4 at {{.*}} by thread T1:
// CHECK-NEXT: #0 foo1{{.*}} {{.*}}simple_stack2.cc:7{{(:10)?}} (simple_stack2.cc.exe+{{.*}})
// CHECK-NEXT: #1 bar1{{.*}} {{.*}}simple_stack2.cc:14{{(:3)?}} (simple_stack2.cc.exe+{{.*}})
// CHECK-NEXT: #2 Thread1{{.*}} {{.*}}simple_stack2.cc:32{{(:3)?}} (simple_stack2.cc.exe+{{.*}})
// CHECK: Previous read of size 4 at {{.*}} by main thread:
// CHECK-NEXT: #0 foo2{{.*}} {{.*}}simple_stack2.cc:18{{(:22)?}} (simple_stack2.cc.exe+{{.*}})
// CHECK-NEXT: #1 bar2{{.*}} {{.*}}simple_stack2.cc:27{{(:3)?}} (simple_stack2.cc.exe+{{.*}})
// CHECK-NEXT: #2 main{{.*}} {{.*}}simple_stack2.cc:40{{(:3)?}} (simple_stack2.cc.exe+{{.*}})
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/ignore_lib_lib.h 0000664 0001750 0001750 00000000752 12223271415 026240 0 ustar mwhudson mwhudson #include
#include
#include
#include
#include
void *volatile mem;
volatile int len;
void *Thread(void *p) {
while ((p = __atomic_load_n(&mem, __ATOMIC_ACQUIRE)) == 0)
usleep(100);
memset(p, 0, len);
return 0;
}
extern "C" void libfunc() {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
len = 10;
__atomic_store_n(&mem, malloc(len), __ATOMIC_RELEASE);
pthread_join(t, 0);
free(mem);
fprintf(stderr, "OK\n");
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/atomic_free2.cc 0000664 0001750 0001750 00000000671 12457727212 026010 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include "test.h"
void *Thread(void *a) {
barrier_wait(&barrier);
__atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST);
return 0;
}
int main() {
barrier_init(&barrier, 2);
int *a = new int(0);
pthread_t t;
pthread_create(&t, 0, Thread, a);
delete a;
barrier_wait(&barrier);
pthread_join(t, 0);
}
// CHECK: WARNING: ThreadSanitizer: heap-use-after-free
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/sigsuspend.cc 0000664 0001750 0001750 00000002122 12417433313 025616 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
// Always enable asserts.
#ifdef NDEBUG
#undef NDEBUG
#endif
#include
#include
#include
#include
#include
static bool signal_handler_ran = false;
void do_nothing_signal_handler(int signum) {
write(1, "HANDLER\n", 8);
signal_handler_ran = true;
}
int main() {
const int kSignalToTest = SIGSYS;
assert(SIG_ERR != signal(kSignalToTest, do_nothing_signal_handler));
sigset_t empty_set;
assert(0 == sigemptyset(&empty_set));
sigset_t one_signal = empty_set;
assert(0 == sigaddset(&one_signal, kSignalToTest));
sigset_t old_set;
assert(0 == sigprocmask(SIG_BLOCK, &one_signal, &old_set));
raise(kSignalToTest);
assert(!signal_handler_ran);
sigset_t all_but_one;
assert(0 == sigfillset(&all_but_one));
assert(0 == sigdelset(&all_but_one, kSignalToTest));
sigsuspend(&all_but_one);
assert(signal_handler_ran);
// Restore the original set.
assert(0 == sigprocmask(SIG_SETMASK, &old_set, NULL));
printf("DONE\n");
}
// CHECK: HANDLER
// CHECK: DONE
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/fd_close_norace2.cc 0000664 0001750 0001750 00000001075 12704157670 026637 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
#include
#include
#include
int pipes[2];
void *Thread(void *x) {
// wait for shutown signal
while (read(pipes[0], &x, 1) != 1) {
}
close(pipes[0]);
close(pipes[1]);
return 0;
}
int main() {
if (pipe(pipes))
return 1;
pthread_t t;
pthread_create(&t, 0, Thread, 0);
// send shutdown signal
while (write(pipes[1], &t, 1) != 1) {
}
pthread_join(t, 0);
fprintf(stderr, "OK\n");
}
// CHECK-NOT: WARNING: ThreadSanitizer: data race
// CHECK: OK
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/blacklist.cc 0000664 0001750 0001750 00000001213 12704157670 025412 0 ustar mwhudson mwhudson // Test blacklist functionality for TSan.
// RUN: echo "fun:*Blacklisted_Thread2*" > %t.blacklist
// RUN: %clangxx_tsan -O1 %s -fsanitize-blacklist=%t.blacklist -o %t && %run %t 2>&1 | FileCheck %s
#include
#include
int Global;
void *Thread1(void *x) {
Global++;
return NULL;
}
void *Blacklisted_Thread2(void *x) {
Global--;
return NULL;
}
int main() {
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Blacklisted_Thread2, NULL);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
fprintf(stderr, "PASS\n");
return 0;
}
// CHECK-NOT: ThreadSanitizer: data race
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/ignored-interceptors-mmap.cc 0000664 0001750 0001750 00000003214 12716715067 030546 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O0 %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NORMAL
// RUN: %env_tsan_opts=ignore_interceptors_accesses=1 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORE
#include
#include
#include "test.h"
extern "C" {
void AnnotateIgnoreReadsBegin(const char *f, int l);
void AnnotateIgnoreReadsEnd(const char *f, int l);
void AnnotateIgnoreWritesBegin(const char *f, int l);
void AnnotateIgnoreWritesEnd(const char *f, int l);
}
void *global_p;
int mmap_and_ignore_reads_and_writes() {
const size_t kSize = sysconf(_SC_PAGESIZE);
void *p = mmap(0, kSize, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANON, -1, 0);
if (p == MAP_FAILED)
return printf("mmap failed with %d\n", errno);
munmap(p, kSize);
void *new_p = mmap(p, kSize, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANON, -1, 0);
if (p == MAP_FAILED || p != new_p)
return printf("second mmap failed with %d\n", errno);
AnnotateIgnoreWritesBegin(__FILE__, __LINE__);
global_p = p;
AnnotateIgnoreWritesEnd(__FILE__, __LINE__);
barrier_wait(&barrier);
return 0;
}
void *Thread(void *a) {
barrier_wait(&barrier);
((int*)global_p)[1] = 10;
printf("Read the zero value from mmapped memory %d\n", ((int*)global_p)[1]);
return 0;
}
int main() {
barrier_init(&barrier, 2);
pthread_t t;
pthread_create(&t, 0, Thread, 0);
if (mmap_and_ignore_reads_and_writes())
return 1;
pthread_join(t, 0);
printf("OK\n");
return 0;
}
// CHECK-NORMAL: WARNING: ThreadSanitizer: data race
// CHECK-NORMAL: OK
// CHECK-IGNORE_NOT: WARNING: ThreadSanitizer: data race
// CHECK-IGNORE: OK
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/fd_dup_race.cc 0000664 0001750 0001750 00000001400 12704157670 025673 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
#include "test.h"
#include
#include
#include
// dup2(oldfd, newfd) races with close(newfd).
int fd;
void *Thread(void *x) {
barrier_wait(&barrier);
if (close(fd) == -1)
exit(printf("close failed\n"));
return 0;
}
int main() {
barrier_init(&barrier, 2);
fd = open("/dev/random", O_RDONLY);
int fd2 = open("/dev/random", O_RDONLY);
if (fd == -1 || fd2 == -1)
exit(printf("open failed\n"));
pthread_t th;
pthread_create(&th, 0, Thread, 0);
if (dup2(fd2, fd) == -1)
exit(printf("dup2 failed\n"));
barrier_wait(&barrier);
pthread_join(th, 0);
fprintf(stderr, "DONE\n");
}
// CHECK: WARNING: ThreadSanitizer: data race
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/restore_stack.cc 0000664 0001750 0001750 00000002521 12457727212 026315 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
#include "test.h"
int Global;
volatile int x;
const int kSize = 64 << 10;
volatile long data[kSize];
void __attribute__((noinline)) foo() {
for (int i = 0; i < kSize; i++)
data[i]++;
}
void *Thread(void *a) {
__atomic_store_n(&x, 1, __ATOMIC_RELEASE);
foo();
data[0]++;
if (a != 0)
barrier_wait(&barrier);
return 0;
}
int main() {
barrier_init(&barrier, 2);
for (int i = 0; i < 50; i++) {
pthread_t t;
pthread_create(&t, 0, Thread, 0);
pthread_join(t, 0);
}
pthread_t t;
pthread_create(&t, 0, Thread, (void*)1);
barrier_wait(&barrier);
for (int i = 0; i < kSize; i++)
data[i]++;
pthread_join(t, 0);
fprintf(stderr, "DONE\n");
return 0;
}
// Previously this test produced bogus stack traces like:
// Previous write of size 8 at 0x0000006a8ff8 by thread T17:
// #0 foo() restore_stack.cc:13:5 (restore_stack.cc.exe+0x00000040622c)
// #1 Thread(void*) restore_stack.cc:18:3 (restore_stack.cc.exe+0x000000406283)
// #2 __tsan_thread_start_func rtl/tsan_interceptors.cc:886 (restore_stack.cc.exe+0x00000040a749)
// #3 Thread(void*) restore_stack.cc:18:3 (restore_stack.cc.exe+0x000000406283)
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NOT: __tsan_thread_start_func
// CHECK-NOT: #3 Thread
// CHECK: DONE
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/race_on_mutex.c 0000664 0001750 0001750 00000002230 12672732200 026117 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include "test.h"
pthread_mutex_t Mtx;
int Global;
void *Thread2(void *x) {
barrier_wait(&barrier);
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK-NEXT: Atomic read of size 1 at {{.*}} by thread T2:
// CHECK-NEXT: #0 pthread_mutex_lock
// CHECK-NEXT: #1 Thread2{{.*}} {{.*}}race_on_mutex.c:[[@LINE+1]]{{(:3)?}} ({{.*}})
pthread_mutex_lock(&Mtx);
Global = 43;
pthread_mutex_unlock(&Mtx);
return NULL;
}
void *Thread1(void *x) {
// CHECK: Previous write of size {{[0-9]+}} at {{.*}} by thread T1:
// CHECK: #{{[0-9]+}} {{.*}}pthread_mutex_init {{.*}} ({{.*}})
// CHECK-NEXT: #{{[0-9]+}} Thread1{{.*}} {{.*}}race_on_mutex.c:[[@LINE+1]]{{(:3)?}} ({{.*}})
pthread_mutex_init(&Mtx, 0);
pthread_mutex_lock(&Mtx);
Global = 42;
pthread_mutex_unlock(&Mtx);
barrier_wait(&barrier);
return NULL;
}
int main() {
barrier_init(&barrier, 2);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
pthread_mutex_destroy(&Mtx);
return 0;
}
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/race_on_barrier2.c 0000664 0001750 0001750 00000001352 12623335072 026473 0 ustar mwhudson mwhudson // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
// pthread barriers are not available on OS X
// UNSUPPORTED: darwin
#include
#include
#include
#include
pthread_barrier_t B;
int Global;
void *Thread1(void *x) {
if (pthread_barrier_wait(&B) == PTHREAD_BARRIER_SERIAL_THREAD)
pthread_barrier_destroy(&B);
return NULL;
}
void *Thread2(void *x) {
if (pthread_barrier_wait(&B) == PTHREAD_BARRIER_SERIAL_THREAD)
pthread_barrier_destroy(&B);
return NULL;
}
int main() {
pthread_barrier_init(&B, 0, 2);
pthread_t t;
pthread_create(&t, NULL, Thread1, NULL);
Thread2(0);
pthread_join(t, NULL);
return 0;
}
// CHECK: WARNING: ThreadSanitizer: data race
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/mop_with_offset.cc 0000664 0001750 0001750 00000001540 12627123307 026633 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
#include "test.h"
void *Thread1(void *x) {
int *p = (int*)x;
p[0] = 1;
barrier_wait(&barrier);
return NULL;
}
void *Thread2(void *x) {
barrier_wait(&barrier);
char *p = (char*)x;
p[2] = 1;
return NULL;
}
int main() {
barrier_init(&barrier, 2);
int *data = new int(42);
print_address("ptr1=", 1, data);
print_address("ptr2=", 1, (char*)data + 2);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, data);
pthread_create(&t[1], NULL, Thread2, data);
pthread_join(t[0], NULL);
pthread_join(t[1], NULL);
delete data;
}
// CHECK: ptr1=[[PTR1:0x[0-9,a-f]+]]
// CHECK: ptr2=[[PTR2:0x[0-9,a-f]+]]
// CHECK: WARNING: ThreadSanitizer: data race
// CHECK: Write of size 1 at [[PTR2]] by thread T2:
// CHECK: Previous write of size 4 at [[PTR1]] by thread T1:
golang-1.8-race-detector-runtime_0.0+svn285455/test/tsan/map32bit.cc 0000664 0001750 0001750 00000002115 12761301620 025052 0 ustar mwhudson mwhudson // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t 2>&1 | FileCheck %s
#include "test.h"
#include
#include
#include