diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index d9e5980b3f3ee..d57d3be2840cd 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -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...') @@ -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. @@ -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. @@ -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') @@ -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) @@ -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).""" @@ -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") diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 7b7972f31877d..c05804f2573fe 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -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 ----------------------------- diff --git a/llvm/include/llvm/IR/ValueMap.h b/llvm/include/llvm/IR/ValueMap.h index faa27039af14c..fb5440d5efe8c 100644 --- a/llvm/include/llvm/IR/ValueMap.h +++ b/llvm/include/llvm/IR/ValueMap.h @@ -93,7 +93,6 @@ class ValueMap { MapT Map; Optional MDMap; ExtraData Data; - bool MayMapMetadata = true; public: using key_type = KeyT; @@ -120,10 +119,6 @@ class ValueMap { } Optional &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 getMappedMD(const Metadata *MD) const { if (!MDMap) diff --git a/llvm/include/llvm/Transforms/IPO/Attributor.h b/llvm/include/llvm/Transforms/IPO/Attributor.h index f8917bcd6fb79..4b5d266d4d80f 100644 --- a/llvm/include/llvm/Transforms/IPO/Attributor.h +++ b/llvm/include/llvm/Transforms/IPO/Attributor.h @@ -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). @@ -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. /// ///{ diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp index d441012000e90..be609a2b238d6 100644 --- a/llvm/lib/Transforms/IPO/Attributor.cpp +++ b/llvm/lib/Transforms/IPO/Attributor.cpp @@ -123,6 +123,11 @@ static cl::opt VerifyAttributor( "manifestation of attributes -- may issue false-positive errors"), cl::init(false)); +static cl::opt 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. /// ///{ @@ -2548,12 +2553,25 @@ ChangeStatus Attributor::run() { SetVector 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) { @@ -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, @@ -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(); @@ -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 diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 6aca0e417bbf7..da68d3713b404 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -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 Mapper::mapSimpleMetadata(const Metadata *MD) { // If the value already exists in the map, use it. if (Optional NewMD = getVM().getMappedMD(MD)) @@ -802,9 +788,6 @@ Optional Mapper::mapSimpleMetadata(const Metadata *MD) { return const_cast(MD); if (auto *CMD = dyn_cast(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 diff --git a/llvm/test/Transforms/FunctionAttrs/align.ll b/llvm/test/Transforms/FunctionAttrs/align.ll index fd38791138687..fd35b6964e058 100644 --- a/llvm/test/Transforms/FunctionAttrs/align.ll +++ b/llvm/test/Transforms/FunctionAttrs/align.ll @@ -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" diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll b/llvm/test/Transforms/FunctionAttrs/nonnull.ll index e7fbb9194d30e..b311c6f55873b 100644 --- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll +++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll @@ -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" diff --git a/llvm/test/Transforms/FunctionAttrs/noreturn_sync.ll b/llvm/test/Transforms/FunctionAttrs/noreturn_sync.ll index 615a7c4718ede..4caf74cb96737 100644 --- a/llvm/test/Transforms/FunctionAttrs/noreturn_sync.ll +++ b/llvm/test/Transforms/FunctionAttrs/noreturn_sync.ll @@ -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.