Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from llvm:master #25

Merged
merged 7 commits into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
155 changes: 17 additions & 138 deletions lldb/packages/Python/lldbsuite/test/dotest.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,6 @@ def parseOptionsAndInitTestdirs():
# target. However, when invoking dotest.py directly, a valid --filecheck
# option needs to be given.
configuration.filecheck = os.path.abspath(args.filecheck)
else:
outputPaths = get_llvm_bin_dirs()
for outputPath in outputPaths:
candidatePath = os.path.join(outputPath, 'FileCheck')
if is_exe(candidatePath):
configuration.filecheck = candidatePath
break

if not configuration.get_filecheck_path():
logging.warning('No valid FileCheck executable; some tests may fail...')
Expand Down Expand Up @@ -474,28 +467,6 @@ def parseOptionsAndInitTestdirs():
lldbtest_config.codesign_identity = args.codesign_identity


def getXcodeOutputPaths(lldbRootDirectory):
result = []

# These are for xcode build directories.
xcode3_build_dir = ['build']
xcode4_build_dir = ['build', 'lldb', 'Build', 'Products']

configurations = [
['Debug'],
['DebugClang'],
['Release'],
['BuildAndIntegration']]
xcode_build_dirs = [xcode3_build_dir, xcode4_build_dir]
for configuration in configurations:
for xcode_build_dir in xcode_build_dirs:
outputPath = os.path.join(
lldbRootDirectory, *(xcode_build_dir + configuration))
result.append(outputPath)

return result


def setupTestResults():
"""Sets up test results-related objects based on arg settings."""
# Setup the results formatter configuration.
Expand All @@ -522,65 +493,6 @@ def setupTestResults():
atexit.register(formatter_spec.cleanup_func)


def getOutputPaths(lldbRootDirectory):
"""
Returns typical build output paths for the lldb executable

lldbDirectory - path to the root of the lldb svn/git repo
"""
result = []

if sys.platform == 'darwin':
result.extend(getXcodeOutputPaths(lldbRootDirectory))

# cmake builds? look for build or build/host folder next to llvm directory
# lldb is located in llvm/tools/lldb so we need to go up three levels
llvmParentDir = os.path.abspath(
os.path.join(
lldbRootDirectory,
os.pardir,
os.pardir,
os.pardir))
result.append(os.path.join(llvmParentDir, 'build', 'bin'))
result.append(os.path.join(llvmParentDir, 'build', 'host', 'bin'))

# some cmake developers keep their build directory beside their lldb
# directory
lldbParentDir = os.path.abspath(os.path.join(lldbRootDirectory, os.pardir))
result.append(os.path.join(lldbParentDir, 'build', 'bin'))
result.append(os.path.join(lldbParentDir, 'build', 'host', 'bin'))

return result

def get_llvm_bin_dirs():
"""
Returns an array of paths that may have the llvm/clang/etc binaries
in them, relative to this current file.
Returns an empty array if none are found.
"""
result = []

lldb_root_path = os.path.join(
os.path.dirname(__file__), "..", "..", "..", "..")
paths_to_try = [
"llvm-build/Release+Asserts/x86_64/bin",
"llvm-build/Debug+Asserts/x86_64/bin",
"llvm-build/Release/x86_64/bin",
"llvm-build/Debug/x86_64/bin",
"llvm-build/Ninja-DebugAssert/llvm-macosx-x86_64/bin",
"llvm-build/Ninja-DebugAssert+asan/llvm-macosx-x86_64/bin",
"llvm-build/Ninja-ReleaseAssert/llvm-macosx-x86_64/bin",
"llvm-build/Ninja-ReleaseAssert+asan/llvm-macosx-x86_64/bin",
"llvm-build/Ninja-RelWithDebInfoAssert/llvm-macosx-x86_64/bin",
"llvm-build/Ninja-RelWithDebInfoAssert+asan/llvm-macosx-x86_64/bin",
]
for p in paths_to_try:
path = os.path.join(lldb_root_path, p)
if os.path.exists(path):
result.append(path)

return result

def setupSysPath():
"""
Add LLDB.framework/Resources/Python to the search paths for modules.
Expand Down Expand Up @@ -638,14 +550,6 @@ def setupSysPath():
if "LLDB_EXEC" in os.environ:
lldbtest_config.lldbExec = os.environ["LLDB_EXEC"]

if not lldbtest_config.lldbExec:
outputPaths = getOutputPaths(lldbRootDirectory)
for outputPath in outputPaths:
candidatePath = os.path.join(outputPath, 'lldb')
if is_exe(candidatePath):
lldbtest_config.lldbExec = candidatePath
break

if not lldbtest_config.lldbExec:
# Last, check the path
lldbtest_config.lldbExec = which('lldb')
Expand Down Expand Up @@ -731,39 +635,23 @@ def setupSysPath():
lldbPythonDir, '..', '..')

if not lldbPythonDir:
if platform.system() == "Darwin":
python_resource_dir = ['LLDB.framework', 'Resources', 'Python']
outputPaths = getXcodeOutputPaths(lldbRootDirectory)
for outputPath in outputPaths:
candidatePath = os.path.join(
outputPath, *python_resource_dir)
if os.path.isfile(
os.path.join(
candidatePath,
init_in_python_dir)):
lldbPythonDir = candidatePath
break

if not lldbPythonDir:
print("lldb.py is not found, some tests may fail.")
else:
print(
"Unable to load lldb extension module. Possible reasons for this include:")
print(" 1) LLDB was built with LLDB_DISABLE_PYTHON=1")
print(
" 2) PYTHONPATH and PYTHONHOME are not set correctly. PYTHONHOME should refer to")
print(
" the version of Python that LLDB built and linked against, and PYTHONPATH")
print(
" should contain the Lib directory for the same python distro, as well as the")
print(" location of LLDB\'s site-packages folder.")
print(
" 3) A different version of Python than that which was built against is exported in")
print(" the system\'s PATH environment variable, causing conflicts.")
print(
" 4) The executable '%s' could not be found. Please check " %
lldbtest_config.lldbExec)
print(" that it exists and is executable.")
print(
"Unable to load lldb extension module. Possible reasons for this include:")
print(" 1) LLDB was built with LLDB_DISABLE_PYTHON=1")
print(
" 2) PYTHONPATH and PYTHONHOME are not set correctly. PYTHONHOME should refer to")
print(
" the version of Python that LLDB built and linked against, and PYTHONPATH")
print(
" should contain the Lib directory for the same python distro, as well as the")
print(" location of LLDB\'s site-packages folder.")
print(
" 3) A different version of Python than that which was built against is exported in")
print(" the system\'s PATH environment variable, causing conflicts.")
print(
" 4) The executable '%s' could not be found. Please check " %
lldbtest_config.lldbExec)
print(" that it exists and is executable.")

if lldbPythonDir:
lldbPythonDir = os.path.normpath(lldbPythonDir)
Expand Down Expand Up @@ -842,7 +730,6 @@ def visit_file(dir, name):
unittest2.defaultTestLoader.loadTestsFromName(base))


# TODO: This should be replaced with a call to find_test_files_in_dir_tree.
def visit(prefix, dir, names):
"""Visitor function for os.path.walk(path, visit, arg)."""

Expand Down Expand Up @@ -1274,14 +1161,6 @@ def run_suite():
configString = "arch=%s compiler=%s" % (configuration.arch,
configuration.compiler)

# Translate ' ' to '-' for pathname component.
if six.PY2:
import string
tbl = string.maketrans(' ', '-')
else:
tbl = str.maketrans(' ', '-')
configPostfix = configString.translate(tbl)

# Output the configuration.
if configuration.verbose:
sys.stderr.write("\nConfiguration: " + configString + "\n")
Expand Down
5 changes: 5 additions & 0 deletions llvm/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ Changes to the X86 Target

During this release ...

* Less than 128 bit vector types, v2i32, v4i16, v2i16, v8i8, v4i8, and v2i8, are
now stored in the lower bits of an xmm register and the upper bits are
undefined. Previously the elements were spread apart with undefined bits in
between them.

Changes to the AMDGPU Target
-----------------------------

Expand Down
5 changes: 0 additions & 5 deletions llvm/include/llvm/IR/ValueMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class ValueMap {
MapT Map;
Optional<MDMapT> MDMap;
ExtraData Data;
bool MayMapMetadata = true;

public:
using key_type = KeyT;
Expand All @@ -120,10 +119,6 @@ class ValueMap {
}
Optional<MDMapT> &getMDMap() { return MDMap; }

bool mayMapMetadata() const { return MayMapMetadata; }
void enableMapMetadata() { MayMapMetadata = true; }
void disableMapMetadata() { MayMapMetadata = false; }

/// Get the mapped metadata, if it's in the map.
Optional<Metadata *> getMappedMD(const Metadata *MD) const {
if (!MDMap)
Expand Down
14 changes: 13 additions & 1 deletion llvm/include/llvm/Transforms/IPO/Attributor.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,15 @@ struct InformationCache {
/// NOTE: The mechanics of adding a new "concrete" abstract attribute are
/// described in the file comment.
struct Attributor {
Attributor(InformationCache &InfoCache) : InfoCache(InfoCache) {}
/// Constructor
///
/// \param InformationCache Cache to hold various information accessible for
/// the abstract attributes.
/// \param DepRecomputeInterval Number of iterations until the dependences
/// between abstract attributes are recomputed.
Attributor(InformationCache &InfoCache, unsigned DepRecomputeInterval)
: InfoCache(InfoCache), DepRecomputeInterval(DepRecomputeInterval) {}

~Attributor() { DeleteContainerPointers(AllAbstractAttributes); }

/// Run the analyses until a fixpoint is reached or enforced (timeout).
Expand Down Expand Up @@ -775,6 +783,10 @@ struct Attributor {
/// The information cache that holds pre-processed (LLVM-IR) information.
InformationCache &InfoCache;

/// Number of iterations until the dependences between abstract attributes are
/// recomputed.
const unsigned DepRecomputeInterval;

/// Functions, blocks, and instructions we delete after manifest is done.
///
///{
Expand Down
35 changes: 31 additions & 4 deletions llvm/lib/Transforms/IPO/Attributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ static cl::opt<bool> VerifyAttributor(
"manifestation of attributes -- may issue false-positive errors"),
cl::init(false));

static cl::opt<unsigned> DepRecInterval(
"attributor-dependence-recompute-interval", cl::Hidden,
cl::desc("Number of iterations until dependences are recomputed."),
cl::init(4));

/// Logic operators for the change status enum class.
///
///{
Expand Down Expand Up @@ -2548,12 +2553,25 @@ ChangeStatus Attributor::run() {
SetVector<AbstractAttribute *> Worklist;
Worklist.insert(AllAbstractAttributes.begin(), AllAbstractAttributes.end());

bool RecomputeDependences = false;

do {
// Remember the size to determine new attributes.
size_t NumAAs = AllAbstractAttributes.size();
LLVM_DEBUG(dbgs() << "\n\n[Attributor] #Iteration: " << IterationCounter
<< ", Worklist size: " << Worklist.size() << "\n");

// If dependences (=QueryMap) are recomputed we have to look at all abstract
// attributes again, regardless of what changed in the last iteration.
if (RecomputeDependences) {
LLVM_DEBUG(
dbgs() << "[Attributor] Run all AAs to recompute dependences\n");
QueryMap.clear();
ChangedAAs.clear();
Worklist.insert(AllAbstractAttributes.begin(),
AllAbstractAttributes.end());
}

// Add all abstract attributes that are potentially dependent on one that
// changed to the work list.
for (AbstractAttribute *ChangedAA : ChangedAAs) {
Expand All @@ -2575,6 +2593,10 @@ ChangeStatus Attributor::run() {
if (AA->update(*this) == ChangeStatus::CHANGED)
ChangedAAs.push_back(AA);

// Check if we recompute the dependences in the next iteration.
RecomputeDependences = (DepRecomputeInterval > 0 &&
IterationCounter % DepRecomputeInterval == 0);

// Add attributes to the changed set if they have been created in the last
// iteration.
ChangedAAs.append(AllAbstractAttributes.begin() + NumAAs,
Expand All @@ -2589,13 +2611,18 @@ ChangeStatus Attributor::run() {

size_t NumFinalAAs = AllAbstractAttributes.size();

if (VerifyMaxFixpointIterations && IterationCounter != MaxFixpointIterations) {
errs() << "\n[Attributor] Fixpoint iteration done after: "
<< IterationCounter << "/" << MaxFixpointIterations
<< " iterations\n";
llvm_unreachable("The fixpoint was not reached with exactly the number of "
"specified iterations!");
}

LLVM_DEBUG(dbgs() << "\n[Attributor] Fixpoint iteration done after: "
<< IterationCounter << "/" << MaxFixpointIterations
<< " iterations\n");

if (VerifyMaxFixpointIterations && IterationCounter != MaxFixpointIterations)
llvm_unreachable("The fixpoint was not reached with exactly the number of "
"specified iterations!");

bool FinishedAtFixpoint = Worklist.empty();

Expand Down Expand Up @@ -2930,7 +2957,7 @@ static bool runAttributorOnModule(Module &M) {
// Create an Attributor and initially empty information cache that is filled
// while we identify default attribute opportunities.
InformationCache InfoCache(M.getDataLayout());
Attributor A(InfoCache);
Attributor A(InfoCache, DepRecInterval);

for (Function &F : M) {
// TODO: Not all attributes require an exact definition. Find a way to
Expand Down
17 changes: 0 additions & 17 deletions llvm/lib/Transforms/Utils/ValueMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -774,20 +774,6 @@ Metadata *MDNodeMapper::mapTopLevelUniquedNode(const MDNode &FirstN) {
return *getMappedOp(&FirstN);
}

namespace {

struct MapMetadataDisabler {
ValueToValueMapTy &VM;

MapMetadataDisabler(ValueToValueMapTy &VM) : VM(VM) {
VM.disableMapMetadata();
}

~MapMetadataDisabler() { VM.enableMapMetadata(); }
};

} // end anonymous namespace

Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
// If the value already exists in the map, use it.
if (Optional<Metadata *> NewMD = getVM().getMappedMD(MD))
Expand All @@ -802,9 +788,6 @@ Optional<Metadata *> Mapper::mapSimpleMetadata(const Metadata *MD) {
return const_cast<Metadata *>(MD);

if (auto *CMD = dyn_cast<ConstantAsMetadata>(MD)) {
// Disallow recursion into metadata mapping through mapValue.
MapMetadataDisabler MMD(getVM());

// Don't memoize ConstantAsMetadata. Instead of lasting until the
// LLVMContext is destroyed, they can be deleted when the GlobalValue they
// reference is destructed. These aren't super common, so the extra
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/FunctionAttrs/align.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=15 -S < %s | FileCheck %s --check-prefix=ATTRIBUTOR
; RUN: opt -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=14 -S < %s | FileCheck %s --check-prefix=ATTRIBUTOR

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/FunctionAttrs/nonnull.ll
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt -S -functionattrs -enable-nonnull-arg-prop %s | FileCheck %s --check-prefixes=BOTH,FNATTR
; RUN: opt -S -passes=function-attrs -enable-nonnull-arg-prop %s | FileCheck %s --check-prefixes=BOTH,FNATTR
; RUN: opt -attributor --attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=11 -S < %s | FileCheck %s --check-prefixes=BOTH,ATTRIBUTOR
; RUN: opt -attributor --attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=10 -S < %s | FileCheck %s --check-prefixes=BOTH,ATTRIBUTOR

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

Expand Down
2 changes: 1 addition & 1 deletion llvm/test/Transforms/FunctionAttrs/noreturn_sync.ll
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; RUN: opt -functionattrs -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=7 -S < %s | FileCheck %s
; RUN: opt -functionattrs -attributor -attributor-disable=false -attributor-max-iterations-verify -attributor-max-iterations=6 -S < %s | FileCheck %s
;
; This file is the same as noreturn_async.ll but with a personality which
; indicates that the exception handler *cannot* catch asynchronous exceptions.
Expand Down