diff options
37 files changed, 648 insertions, 464 deletions
diff --git a/clang-tools-extra/clang-doc/tool/CMakeLists.txt b/clang-tools-extra/clang-doc/tool/CMakeLists.txt index e93a572..19c17a8f 100644 --- a/clang-tools-extra/clang-doc/tool/CMakeLists.txt +++ b/clang-tools-extra/clang-doc/tool/CMakeLists.txt @@ -25,7 +25,7 @@ set(assets ) set(asset_dir "${CMAKE_CURRENT_SOURCE_DIR}/../assets") -set(resource_dir "${CMAKE_BINARY_DIR}/share/clang-doc") +set(resource_dir "${LLVM_SHARE_OUTPUT_INTDIR}/clang-doc") set(out_files) function(copy_files_to_dst src_dir dst_dir file) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 36cf615a..f6431a7 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -272,6 +272,7 @@ C++2c Feature Support - Implemented `P2809R3: Trivial infinite loops are not Undefined Behavior <https://wg21.link/P2809R3>`_. +- Implemented `P3144R2 Deleting a Pointer to an Incomplete Type Should be Ill-formed <https://wg21.link/P3144R2>`_. Resolutions to C++ Defect Reports ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -438,6 +439,9 @@ New Compiler Flags Matches MSVC behaviour by defining ``__STDC__`` to ``1`` when MSVC compatibility mode is used. It has no effect for C++ code. +- ``-Wc++2c-compat`` group was added to help migrating existing codebases + to C++26. + Deprecated Compiler Flags ------------------------- diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 9431eea..1b25cf3 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -420,6 +420,8 @@ def CXX20CompatPedantic : DiagGroup<"c++20-compat-pedantic", def : DiagGroup<"c++2a-compat", [CXX20Compat]>; def : DiagGroup<"c++2a-compat-pedantic", [CXX20CompatPedantic]>; +def CXX26Compat : DiagGroup<"c++2c-compat", [DeleteIncomplete]>; + def ExitTimeDestructors : DiagGroup<"exit-time-destructors">; def FlexibleArrayExtensions : DiagGroup<"flexible-array-extensions">; def FourByteMultiChar : DiagGroup<"four-char-constants">; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 3df64b2e..44fd51e 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -7989,8 +7989,11 @@ def ext_delete_void_ptr_operand : ExtWarn< def err_ambiguous_delete_operand : Error< "ambiguous conversion of delete expression of type %0 to a pointer">; def warn_delete_incomplete : Warning< - "deleting pointer to incomplete type %0 may cause undefined behavior">, + "deleting pointer to incomplete type %0 is incompatible with C++2c" + " and may cause undefined behavior">, InGroup<DeleteIncomplete>; +def err_delete_incomplete : Error< + "cannot delete pointer to incomplete type %0">; def err_delete_incomplete_class_type : Error< "deleting incomplete class type %0; no conversions to pointer type">; def err_delete_explicit_conversion : Error< diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 43cf3a0..58ca6f2 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5501,10 +5501,6 @@ def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, MarshallingInfoFlag<CodeGenOpts<"InstrumentForProfiling">>; def pipe : Flag<["-", "--"], "pipe">, HelpText<"Use pipes between commands, when possible">; -// Facebook T92898286 -def post_link_optimize : Flag<["--"], "post-link-optimize">, - HelpText<"Apply post-link optimizations using BOLT">; -// End Facebook T92898286 def prebind__all__twolevel__modules : Flag<["-"], "prebind_all_twolevel_modules">; def prebind : Flag<["-"], "prebind">; def preload : Flag<["-"], "preload">; diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index f7611af..b141e5f 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -672,41 +672,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, } } - // Facebook T92898286 - if (Args.hasArg(options::OPT_post_link_optimize)) - CmdArgs.push_back("-q"); - // End Facebook T92898286 - Args.AddAllArgs(CmdArgs, options::OPT_T); const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::AtFileCurCP(), Exec, CmdArgs, Inputs, Output)); - // Facebook T92898286 - if (!Args.hasArg(options::OPT_post_link_optimize) || !Output.isFilename()) - return; - - const char *MvExec = Args.MakeArgString(ToolChain.GetProgramPath("mv")); - ArgStringList MoveCmdArgs; - MoveCmdArgs.push_back(Output.getFilename()); - const char *PreBoltBin = - Args.MakeArgString(Twine(Output.getFilename()) + ".pre-bolt"); - MoveCmdArgs.push_back(PreBoltBin); - C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(), - MvExec, MoveCmdArgs, std::nullopt)); - - ArgStringList BoltCmdArgs; - const char *BoltExec = - Args.MakeArgString(ToolChain.GetProgramPath("llvm-bolt")); - BoltCmdArgs.push_back(PreBoltBin); - BoltCmdArgs.push_back("-reorder-blocks=reverse"); - BoltCmdArgs.push_back("-update-debug-sections"); - BoltCmdArgs.push_back("-o"); - BoltCmdArgs.push_back(Output.getFilename()); - C.addCommand(std::make_unique<Command>(JA, *this, ResponseFileSupport::None(), - BoltExec, BoltCmdArgs, std::nullopt)); - // End Facebook T92898286 } void tools::gnutools::Assembler::ConstructJob(Compilation &C, diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 69074f9..fcf2189 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3719,8 +3719,11 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, // The C++ standard bans deleting a pointer to a non-object type, which // effectively bans deletion of "void*". However, most compilers support // this, so we treat it as a warning unless we're in a SFINAE context. - Diag(StartLoc, diag::ext_delete_void_ptr_operand) - << Type << Ex.get()->getSourceRange(); + // But we still prohibit this since C++26. + Diag(StartLoc, LangOpts.CPlusPlus26 ? diag::err_delete_incomplete + : diag::ext_delete_void_ptr_operand) + << (LangOpts.CPlusPlus26 ? Pointee : Type) + << Ex.get()->getSourceRange(); } else if (Pointee->isFunctionType() || Pointee->isVoidType() || Pointee->isSizelessType()) { return ExprError(Diag(StartLoc, diag::err_delete_operand) @@ -3729,7 +3732,10 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, // FIXME: This can result in errors if the definition was imported from a // module but is hidden. if (!RequireCompleteType(StartLoc, Pointee, - diag::warn_delete_incomplete, Ex.get())) { + LangOpts.CPlusPlus26 + ? diag::err_delete_incomplete + : diag::warn_delete_incomplete, + Ex.get())) { if (const RecordType *RT = PointeeElem->getAs<RecordType>()) PointeeRD = cast<CXXRecordDecl>(RT->getDecl()); } diff --git a/clang/test/CXX/drs/cwg5xx.cpp b/clang/test/CXX/drs/cwg5xx.cpp index 9d890f9..6a0bb7a 100644 --- a/clang/test/CXX/drs/cwg5xx.cpp +++ b/clang/test/CXX/drs/cwg5xx.cpp @@ -1,9 +1,10 @@ -// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-11,cxx98-14,cxx98-17,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx98-11,cxx98-14,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx98-14,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++17 %s -verify=expected,since-cxx17,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++20 %s -verify=expected,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors -// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++98 %s -verify=expected,cxx98-23,cxx98-11,cxx98-14,cxx98-17,cxx98 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++11 %s -verify=expected,cxx98-23,cxx98-11,cxx98-14,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++14 %s -verify=expected,cxx98-23,cxx98-14,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++17 %s -verify=expected,cxx98-23,since-cxx17,cxx98-17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++20 %s -verify=expected,cxx98-23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++23 %s -verify=expected,cxx98-23,since-cxx23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors +// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx26,since-cxx23,since-cxx20,since-cxx17,since-cxx11 -fexceptions -fcxx-exceptions -pedantic-errors #if __cplusplus == 199711L #define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) @@ -901,7 +902,8 @@ namespace cwg573 { // cwg573: no void *d = reinterpret_cast<void*>(c); // cxx98-error@-1 {{cast between pointer-to-function and pointer-to-object is an extension}} void f() { delete a; } - // expected-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // cxx98-23-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}} int n = d - a; // expected-error@-1 {{arithmetic on pointers to void}} // FIXME: This is ill-formed. @@ -1238,11 +1240,13 @@ namespace cwg599 { // cwg599: partial struct V { operator int*(); operator Fn*(); }; void f(void *p, void (*q)(), S s, T t, U u, V v) { delete p; - // expected-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // cxx98-23-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}} delete q; // expected-error@-1 {{cannot delete expression of type 'void (*)()'}} delete s; - // expected-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // cxx98-23-error@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}} delete t; // expected-error@-1 {{cannot delete expression of type 'T'}} // FIXME: This is valid, but is rejected due to a non-conforming GNU diff --git a/clang/test/OpenMP/deferred-diags.cpp b/clang/test/OpenMP/deferred-diags.cpp index a12f803..e31b99b 100644 --- a/clang/test/OpenMP/deferred-diags.cpp +++ b/clang/test/OpenMP/deferred-diags.cpp @@ -41,7 +41,7 @@ namespace TestDeleteIncompleteClassDefinition { struct a; struct b { b() { - delete c; // expected-warning {{deleting pointer to incomplete type 'a' may cause undefined behavior}} + delete c; // expected-warning {{deleting pointer to incomplete type 'a' is incompatible with C++2c and may cause undefined behavior}} } a *c; }; diff --git a/clang/test/SemaCXX/new-delete.cpp b/clang/test/SemaCXX/new-delete.cpp index 1a99c6a..ec6ad43 100644 --- a/clang/test/SemaCXX/new-delete.cpp +++ b/clang/test/SemaCXX/new-delete.cpp @@ -1,8 +1,10 @@ -// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++98 -// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++11 -// RUN: %clang_cc1 -fsyntax-only -verify=expected,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++14 -// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++17 -// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx17,cxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++20 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98-23,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++98 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98-23,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++11 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98-23,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++14 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98-23,cxx17,precxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++17 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98-23,cxx17,cxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++20 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98-23,cxx17,cxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++23 +// RUN: %clang_cc1 -fsyntax-only -verify=expected,since-cxx26,cxx17,cxx20 %s -triple=i686-pc-linux-gnu -Wno-new-returns-null -std=c++2c // FIXME Location is (frontend) // cxx17-note@*:* {{candidate function not viable: requires 2 arguments, but 3 were provided}} @@ -172,8 +174,12 @@ void bad_deletes() { delete 0; // expected-error {{cannot delete expression of type 'int'}} delete [0] (int*)0; // expected-error {{expected variable name or 'this' in lambda capture list}} - delete (void*)0; // expected-warning {{cannot delete expression with pointer-to-'void' type 'void *'}} - delete (T*)0; // expected-warning {{deleting pointer to incomplete type}} + delete (void*)0; + // cxx98-23-warning@-1 {{cannot delete expression with pointer-to-'void' type 'void *'}} + // since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'void'}} + delete (T*)0; + // cxx98-23-warning@-1 {{deleting pointer to incomplete type}} + // since-cxx26-error@-2 {{cannot delete pointer to incomplete type 'T'}} ::S::delete (int*)0; // expected-error {{expected unqualified-id}} } @@ -513,8 +519,10 @@ namespace DeleteIncompleteClass { namespace DeleteIncompleteClassPointerError { struct A; // expected-note {{forward declaration}} - void f(A *x) { 1+delete x; } // expected-warning {{deleting pointer to incomplete type}} \ - // expected-error {{invalid operands to binary expression}} + void f(A *x) { 1+delete x; } + // expected-error@-1 {{invalid operands to binary expression}} + // cxx98-23-warning@-2 {{deleting pointer to incomplete type}} + // since-cxx26-error@-3 {{cannot delete pointer to incomplete type 'A'}} } namespace PR10504 { diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html index f12ce38..0c013e6 100755 --- a/clang/www/cxx_status.html +++ b/clang/www/cxx_status.html @@ -213,7 +213,7 @@ C++23, informally referred to as C++26.</p> <tr> <td>Deleting a Pointer to an Incomplete Type Should be Ill-formed</td> <td><a href="https://wg21.link/P3144">P3144R2</a></td> - <td class="none" align="center">No</td> + <td class="Unreleased" align="center">Clang 19</td> </tr> <tr> <td>Ordering of constraints involving fold expressions</td> diff --git a/compiler-rt/lib/builtins/cpu_model/AArch64CPUFeatures.inc b/compiler-rt/lib/builtins/cpu_model/AArch64CPUFeatures.inc new file mode 100644 index 0000000..e78bb88 --- /dev/null +++ b/compiler-rt/lib/builtins/cpu_model/AArch64CPUFeatures.inc @@ -0,0 +1,91 @@ +//===- AArch64CPUFeatures.inc - AArch64 CPU Features enum -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the CPUFeatures enum for AArch64 to facilitate better +// testing of this code between LLVM and compiler-rt, primarily that the files +// are an exact match. +// +// This file has two identical copies. The primary copy lives in LLVM and +// the other one sits in compiler-rt/lib/builtins/cpu_model directory. To make +// changes in this file, first modify the primary copy and copy it over to +// compiler-rt. compiler-rt tests will fail if the two files are not synced up. +// +//===----------------------------------------------------------------------===// + +#ifndef AARCH64_CPU_FEATURS_INC_H +#define AARCH64_CPU_FEATURS_INC_H + +// Function Multi Versioning CPU features. +enum CPUFeatures { + FEAT_RNG, + FEAT_FLAGM, + FEAT_FLAGM2, + FEAT_FP16FML, + FEAT_DOTPROD, + FEAT_SM4, + FEAT_RDM, + FEAT_LSE, + FEAT_FP, + FEAT_SIMD, + FEAT_CRC, + FEAT_SHA1, + FEAT_SHA2, + FEAT_SHA3, + FEAT_AES, + FEAT_PMULL, + FEAT_FP16, + FEAT_DIT, + FEAT_DPB, + FEAT_DPB2, + FEAT_JSCVT, + FEAT_FCMA, + FEAT_RCPC, + FEAT_RCPC2, + FEAT_FRINTTS, + FEAT_DGH, + FEAT_I8MM, + FEAT_BF16, + FEAT_EBF16, + FEAT_RPRES, + FEAT_SVE, + FEAT_SVE_BF16, + FEAT_SVE_EBF16, + FEAT_SVE_I8MM, + FEAT_SVE_F32MM, + FEAT_SVE_F64MM, + FEAT_SVE2, + FEAT_SVE_AES, + FEAT_SVE_PMULL128, + FEAT_SVE_BITPERM, + FEAT_SVE_SHA3, + FEAT_SVE_SM4, + FEAT_SME, + FEAT_MEMTAG, + FEAT_MEMTAG2, + FEAT_MEMTAG3, + FEAT_SB, + FEAT_PREDRES, + FEAT_SSBS, + FEAT_SSBS2, + FEAT_BTI, + FEAT_LS64, + FEAT_LS64_V, + FEAT_LS64_ACCDATA, + FEAT_WFXT, + FEAT_SME_F64, + FEAT_SME_I64, + FEAT_SME2, + FEAT_RCPC3, + FEAT_MOPS, + FEAT_MAX, + FEAT_EXT = 62, // Reserved to indicate presence of additional features field + // in __aarch64_cpu_features + FEAT_INIT // Used as flag of features initialization completion +}; + +#endif diff --git a/compiler-rt/lib/builtins/cpu_model/aarch64.h b/compiler-rt/lib/builtins/cpu_model/aarch64.h index 15d5300..f6cbf75 100644 --- a/compiler-rt/lib/builtins/cpu_model/aarch64.h +++ b/compiler-rt/lib/builtins/cpu_model/aarch64.h @@ -14,74 +14,7 @@ #if !defined(DISABLE_AARCH64_FMV) -// CPUFeatures must correspond to the same AArch64 features in -// AArch64TargetParser.h -enum CPUFeatures { - FEAT_RNG, - FEAT_FLAGM, - FEAT_FLAGM2, - FEAT_FP16FML, - FEAT_DOTPROD, - FEAT_SM4, - FEAT_RDM, - FEAT_LSE, - FEAT_FP, - FEAT_SIMD, - FEAT_CRC, - FEAT_SHA1, - FEAT_SHA2, - FEAT_SHA3, - FEAT_AES, - FEAT_PMULL, - FEAT_FP16, - FEAT_DIT, - FEAT_DPB, - FEAT_DPB2, - FEAT_JSCVT, - FEAT_FCMA, - FEAT_RCPC, - FEAT_RCPC2, - FEAT_FRINTTS, - FEAT_DGH, - FEAT_I8MM, - FEAT_BF16, - FEAT_EBF16, - FEAT_RPRES, - FEAT_SVE, - FEAT_SVE_BF16, - FEAT_SVE_EBF16, - FEAT_SVE_I8MM, - FEAT_SVE_F32MM, - FEAT_SVE_F64MM, - FEAT_SVE2, - FEAT_SVE_AES, - FEAT_SVE_PMULL128, - FEAT_SVE_BITPERM, - FEAT_SVE_SHA3, - FEAT_SVE_SM4, - FEAT_SME, - FEAT_MEMTAG, - FEAT_MEMTAG2, - FEAT_MEMTAG3, - FEAT_SB, - FEAT_PREDRES, - FEAT_SSBS, - FEAT_SSBS2, - FEAT_BTI, - FEAT_LS64, - FEAT_LS64_V, - FEAT_LS64_ACCDATA, - FEAT_WFXT, - FEAT_SME_F64, - FEAT_SME_I64, - FEAT_SME2, - FEAT_RCPC3, - FEAT_MOPS, - FEAT_MAX, - FEAT_EXT = 62, // Reserved to indicate presence of additional features field - // in __aarch64_cpu_features - FEAT_INIT // Used as flag of features initialization completion -}; +#include "AArch64CPUFeatures.inc" void __init_cpu_features(void); diff --git a/compiler-rt/test/builtins/TestCases/check-same-common-code.test b/compiler-rt/test/builtins/TestCases/check-same-common-code.test new file mode 100644 index 0000000..67fe900 --- /dev/null +++ b/compiler-rt/test/builtins/TestCases/check-same-common-code.test @@ -0,0 +1,5 @@ +; +; NOTE: if this test fails, please make sure the relevant copies are identical +; copies of each other. +; +; RUN: diff %crt_src/lib/builtins/cpu_model/AArch64CPUFeatures.inc %llvm_src/include/llvm/TargetParser/AArch64CPUFeatures.inc diff --git a/compiler-rt/test/builtins/lit.cfg.py b/compiler-rt/test/builtins/lit.cfg.py index 9bf7d82..9300488 100644 --- a/compiler-rt/test/builtins/lit.cfg.py +++ b/compiler-rt/test/builtins/lit.cfg.py @@ -9,7 +9,7 @@ config.name = "Builtins" config.test_source_root = os.path.dirname(__file__) # Test suffixes. -config.suffixes = [".c", ".cpp", ".m", ".mm"] +config.suffixes = [".c", ".cpp", ".m", ".mm", ".test"] extra_flags = ["-Wall"] if config.compiler_id == "GNU": # detect incorrect declarations of libgcc functions diff --git a/compiler-rt/test/profile/check-same-common-code.test b/compiler-rt/test/profile/check-same-common-code.test new file mode 100644 index 0000000..81b9836 --- /dev/null +++ b/compiler-rt/test/profile/check-same-common-code.test @@ -0,0 +1,7 @@ +; +; NOTE: if this test fails, please make sure the files are identical +; copies of each other. +; +; RUN: diff %crt_src/include/profile/MIBEntryDef.inc %llvm_src/include/llvm/ProfileData/MIBEntryDef.inc +; RUN: diff %crt_src/include/profile/MemProfData.inc %llvm_src/include/llvm/ProfileData/MemProfData.inc +; RUN: diff %crt_src/include/profile/InstrProfData.inc %llvm_src/include/llvm/ProfileData/InstrProfData.inc diff --git a/cross-project-tests/lit.cfg.py b/cross-project-tests/lit.cfg.py index 6196345..774c4ea 100644 --- a/cross-project-tests/lit.cfg.py +++ b/cross-project-tests/lit.cfg.py @@ -84,13 +84,7 @@ if is_msvc: # use_clang() and use_lld() respectively, so set them to "", if needed. if not hasattr(config, "clang_src_dir"): config.clang_src_dir = "" -# Facebook T92898286 -should_test_bolt = get_required_attr(config, "llvm_test_bolt") -if should_test_bolt: - llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects), additional_flags=["--post-link-optimize"]) -else: - llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects)) -# End Facebook T92898286 +llvm_config.use_clang(required=("clang" in config.llvm_enabled_projects)) if not hasattr(config, "lld_src_dir"): config.lld_src_dir = "" @@ -299,9 +293,3 @@ llvm_config.feature_config([("--build-mode", {"Debug|RelWithDebInfo": "debug-inf # Allow 'REQUIRES: XXX-registered-target' in tests. for arch in config.targets_to_build: config.available_features.add(arch.lower() + "-registered-target") - -# Facebook T92898286 -# Ensure the user's PYTHONPATH is included. -if "PYTHONPATH" in os.environ: - config.environment["PYTHONPATH"] = os.environ["PYTHONPATH"] -# End Facebook T92898286 diff --git a/cross-project-tests/lit.site.cfg.py.in b/cross-project-tests/lit.site.cfg.py.in index 2d53cd3..39458df 100644 --- a/cross-project-tests/lit.site.cfg.py.in +++ b/cross-project-tests/lit.site.cfg.py.in @@ -21,10 +21,6 @@ config.mlir_src_root = "@MLIR_SOURCE_DIR@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -# Facebook T92898286 -config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@") -# End Facebook T92898286 - import lit.llvm lit.llvm.initialize(lit_config, config) diff --git a/libcxx/include/complex b/libcxx/include/complex index 69a9fcc..22271ac 100644 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -261,6 +261,7 @@ template<class T> complex<T> tanh (const complex<T>&); #include <__fwd/tuple.h> #include <__tuple/tuple_element.h> #include <__tuple/tuple_size.h> +#include <__type_traits/conditional.h> #include <__utility/move.h> #include <cmath> #include <version> diff --git a/lldb/include/lldb/Target/Language.h b/lldb/include/lldb/Target/Language.h index 2d6e5a4..83bf763 100644 --- a/lldb/include/lldb/Target/Language.h +++ b/lldb/include/lldb/Target/Language.h @@ -363,9 +363,13 @@ public: return false; } - /// Returns true if this Language supports exception breakpoints via a - /// corresponding LanguageRuntime plugin. - virtual bool SupportsExceptionBreakpoints() const { return false; } + /// Returns true if this Language supports exception breakpoints on throw via + /// a corresponding LanguageRuntime plugin. + virtual bool SupportsExceptionBreakpointsOnThrow() const { return false; } + + /// Returns true if this Language supports exception breakpoints on catch via + /// a corresponding LanguageRuntime plugin. + virtual bool SupportsExceptionBreakpointsOnCatch() const { return false; } protected: // Classes that inherit from Language can see and modify these diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp index a5fe927..773f8ed 100644 --- a/lldb/source/Commands/CommandObjectBreakpoint.cpp +++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp @@ -317,7 +317,8 @@ public: break; default: if (Language *languagePlugin = Language::FindPlugin(language)) { - if (languagePlugin->SupportsExceptionBreakpoints()) { + if (languagePlugin->SupportsExceptionBreakpointsOnThrow() || + languagePlugin->SupportsExceptionBreakpointsOnCatch()) { m_exception_language = language; break; } diff --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h index a61d0f1..d9c0cd3c 100644 --- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h +++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.h @@ -194,7 +194,7 @@ public: llvm::StringRef GetInstanceVariableName() override { return "self"; } - bool SupportsExceptionBreakpoints() const override { return true; } + bool SupportsExceptionBreakpointsOnThrow() const override { return true; } // PluginInterface protocol llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } diff --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py index dfeb765..96520c7 100644 --- a/lldb/test/API/lit.cfg.py +++ b/lldb/test/API/lit.cfg.py @@ -265,11 +265,6 @@ if is_configured("lldb_libs_dir"): if is_configured("lldb_framework_dir"): dotest_cmd += ["--framework", config.lldb_framework_dir] -# Facebook T92898286 -if is_configured("llvm_test_bolt"): - dotest_cmd += ["-E", '"--post-link-optimize"'] -# End Facebook T92898286 - if ( "lldb-repro-capture" in config.available_features or "lldb-repro-replay" in config.available_features diff --git a/lldb/test/API/lit.site.cfg.py.in b/lldb/test/API/lit.site.cfg.py.in index 602f457..8b2d09a 100644 --- a/lldb/test/API/lit.site.cfg.py.in +++ b/lldb/test/API/lit.site.cfg.py.in @@ -1,9 +1,5 @@ @LIT_SITE_CFG_IN_HEADER@ -#Facebook T92898286 -import lit.util -#End Facebook T92898286 - config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") @@ -43,10 +39,6 @@ config.libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@" config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-api") config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-api") -# Facebook T92898286 -config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@") -# End Facebook T92898286 - # Plugins lldb_build_intel_pt = '@LLDB_BUILD_INTEL_PT@' if lldb_build_intel_pt == '1': diff --git a/lldb/test/Shell/helper/toolchain.py b/lldb/test/Shell/helper/toolchain.py index 7b7be06..255955f 100644 --- a/lldb/test/Shell/helper/toolchain.py +++ b/lldb/test/Shell/helper/toolchain.py @@ -165,11 +165,6 @@ def use_support_substitutions(config): if config.cmake_sysroot: host_flags += ["--sysroot={}".format(config.cmake_sysroot)] - # Facebook T92898286 - if config.llvm_test_bolt: - host_flags += ["--post-link-optimize"] - # End Facebook T92898286 - host_flags = " ".join(host_flags) config.substitutions.append(("%clang_host", "%clang " + host_flags)) config.substitutions.append(("%clangxx_host", "%clangxx " + host_flags)) diff --git a/lldb/test/Shell/lit.site.cfg.py.in b/lldb/test/Shell/lit.site.cfg.py.in index fe83237..b69e7bc 100644 --- a/lldb/test/Shell/lit.site.cfg.py.in +++ b/lldb/test/Shell/lit.site.cfg.py.in @@ -1,10 +1,5 @@ @LIT_SITE_CFG_IN_HEADER@ -#Facebook T92898286 -import lit.util -#End Facebook T92898286 - - config.llvm_src_root = "@LLVM_SOURCE_DIR@" config.llvm_obj_root = "@LLVM_BINARY_DIR@" config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@") @@ -36,10 +31,6 @@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" config.lldb_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_LLDB@", "lldb-shell") config.clang_module_cache = os.path.join("@LLDB_TEST_MODULE_CACHE_CLANG@", "lldb-shell") -# Facebook T92898286 -config.llvm_test_bolt = lit.util.pythonize_bool("@LLVM_TEST_BOLT@") -# End Facebook T92898286 - import lit.llvm lit.llvm.initialize(lit_config, config) diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index a08b477..cbbf84e 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -446,6 +446,7 @@ mark_as_advanced(LLVM_EXAMPLES_INSTALL_DIR) # They are used as destination of target generators. set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}) +set(LLVM_SHARE_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/share) if(WIN32 OR CYGWIN) # DLL platform -- put DLLs into bin. set(LLVM_SHLIB_OUTPUT_INTDIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) @@ -709,10 +710,6 @@ set(LLVM_LIB_FUZZING_ENGINE "" CACHE PATH option(LLVM_USE_SPLIT_DWARF "Use -gsplit-dwarf when compiling llvm and --gdb-index when linking." OFF) -# Facebook T92898286 -option(LLVM_TEST_BOLT "Enable BOLT testing in non-BOLT tests that use clang" OFF) -# End Facebook T92898286 - # Define an option controlling whether we should build for 32-bit on 64-bit # platforms, where supported. if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT (WIN32 OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")) diff --git a/llvm/include/llvm/TargetParser/AArch64CPUFeatures.inc b/llvm/include/llvm/TargetParser/AArch64CPUFeatures.inc new file mode 100644 index 0000000..e78bb88 --- /dev/null +++ b/llvm/include/llvm/TargetParser/AArch64CPUFeatures.inc @@ -0,0 +1,91 @@ +//===- AArch64CPUFeatures.inc - AArch64 CPU Features enum -------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the CPUFeatures enum for AArch64 to facilitate better +// testing of this code between LLVM and compiler-rt, primarily that the files +// are an exact match. +// +// This file has two identical copies. The primary copy lives in LLVM and +// the other one sits in compiler-rt/lib/builtins/cpu_model directory. To make +// changes in this file, first modify the primary copy and copy it over to +// compiler-rt. compiler-rt tests will fail if the two files are not synced up. +// +//===----------------------------------------------------------------------===// + +#ifndef AARCH64_CPU_FEATURS_INC_H +#define AARCH64_CPU_FEATURS_INC_H + +// Function Multi Versioning CPU features. +enum CPUFeatures { + FEAT_RNG, + FEAT_FLAGM, + FEAT_FLAGM2, + FEAT_FP16FML, + FEAT_DOTPROD, + FEAT_SM4, + FEAT_RDM, + FEAT_LSE, + FEAT_FP, + FEAT_SIMD, + FEAT_CRC, + FEAT_SHA1, + FEAT_SHA2, + FEAT_SHA3, + FEAT_AES, + FEAT_PMULL, + FEAT_FP16, + FEAT_DIT, + FEAT_DPB, + FEAT_DPB2, + FEAT_JSCVT, + FEAT_FCMA, + FEAT_RCPC, + FEAT_RCPC2, + FEAT_FRINTTS, + FEAT_DGH, + FEAT_I8MM, + FEAT_BF16, + FEAT_EBF16, + FEAT_RPRES, + FEAT_SVE, + FEAT_SVE_BF16, + FEAT_SVE_EBF16, + FEAT_SVE_I8MM, + FEAT_SVE_F32MM, + FEAT_SVE_F64MM, + FEAT_SVE2, + FEAT_SVE_AES, + FEAT_SVE_PMULL128, + FEAT_SVE_BITPERM, + FEAT_SVE_SHA3, + FEAT_SVE_SM4, + FEAT_SME, + FEAT_MEMTAG, + FEAT_MEMTAG2, + FEAT_MEMTAG3, + FEAT_SB, + FEAT_PREDRES, + FEAT_SSBS, + FEAT_SSBS2, + FEAT_BTI, + FEAT_LS64, + FEAT_LS64_V, + FEAT_LS64_ACCDATA, + FEAT_WFXT, + FEAT_SME_F64, + FEAT_SME_I64, + FEAT_SME2, + FEAT_RCPC3, + FEAT_MOPS, + FEAT_MAX, + FEAT_EXT = 62, // Reserved to indicate presence of additional features field + // in __aarch64_cpu_features + FEAT_INIT // Used as flag of features initialization completion +}; + +#endif diff --git a/llvm/include/llvm/TargetParser/AArch64TargetParser.h b/llvm/include/llvm/TargetParser/AArch64TargetParser.h index f47d9f1..1309174 100644 --- a/llvm/include/llvm/TargetParser/AArch64TargetParser.h +++ b/llvm/include/llvm/TargetParser/AArch64TargetParser.h @@ -34,74 +34,7 @@ namespace AArch64 { struct ArchInfo; struct CpuInfo; -// Function Multi Versioning CPU features. They must be kept in sync with -// compiler-rt enum CPUFeatures in lib/builtins/cpu_model/aarch64.c with -// FEAT_MAX as sentinel. -enum CPUFeatures { - FEAT_RNG, - FEAT_FLAGM, - FEAT_FLAGM2, - FEAT_FP16FML, - FEAT_DOTPROD, - FEAT_SM4, - FEAT_RDM, - FEAT_LSE, - FEAT_FP, - FEAT_SIMD, - FEAT_CRC, - FEAT_SHA1, - FEAT_SHA2, - FEAT_SHA3, - FEAT_AES, - FEAT_PMULL, - FEAT_FP16, - FEAT_DIT, - FEAT_DPB, - FEAT_DPB2, - FEAT_JSCVT, - FEAT_FCMA, - FEAT_RCPC, - FEAT_RCPC2, - FEAT_FRINTTS, - FEAT_DGH, - FEAT_I8MM, - FEAT_BF16, - FEAT_EBF16, - FEAT_RPRES, - FEAT_SVE, - FEAT_SVE_BF16, - FEAT_SVE_EBF16, - FEAT_SVE_I8MM, - FEAT_SVE_F32MM, - FEAT_SVE_F64MM, - FEAT_SVE2, - FEAT_SVE_AES, - FEAT_SVE_PMULL128, - FEAT_SVE_BITPERM, - FEAT_SVE_SHA3, - FEAT_SVE_SM4, - FEAT_SME, - FEAT_MEMTAG, - FEAT_MEMTAG2, - FEAT_MEMTAG3, - FEAT_SB, - FEAT_PREDRES, - FEAT_SSBS, - FEAT_SSBS2, - FEAT_BTI, - FEAT_LS64, - FEAT_LS64_V, - FEAT_LS64_ACCDATA, - FEAT_WFXT, - FEAT_SME_F64, - FEAT_SME_I64, - FEAT_SME2, - FEAT_RCPC3, - FEAT_MOPS, - FEAT_MAX, - FEAT_EXT = 62, - FEAT_INIT -}; +#include "llvm/TargetParser/AArch64CPUFeatures.inc" static_assert(FEAT_MAX < 62, "Number of features in CPUFeatures are limited to 62 entries"); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 27c297a..943d2dd 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -4615,12 +4615,33 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts, Tmp = std::min<uint64_t>(Tmp + *ShAmt, VTBits); return Tmp; case ISD::SHL: - if (std::optional<uint64_t> ShAmt = - getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1)) { + if (std::optional<ConstantRange> ShAmtRange = + getValidShiftAmountRange(Op, DemandedElts, Depth + 1)) { + uint64_t MaxShAmt = ShAmtRange->getUnsignedMax().getZExtValue(); + uint64_t MinShAmt = ShAmtRange->getUnsignedMin().getZExtValue(); + // Try to look through ZERO/SIGN/ANY_EXTEND. If all extended bits are + // shifted out, then we can compute the number of sign bits for the + // operand being extended. A future improvement could be to pass along the + // "shifted left by" information in the recursive calls to + // ComputeKnownSignBits. Allowing us to handle this more generically. + if (ISD::isExtOpcode(Op.getOperand(0).getOpcode())) { + SDValue Ext = Op.getOperand(0); + EVT ExtVT = Ext.getValueType(); + SDValue Extendee = Ext.getOperand(0); + EVT ExtendeeVT = Extendee.getValueType(); + uint64_t SizeDifference = + ExtVT.getScalarSizeInBits() - ExtendeeVT.getScalarSizeInBits(); + if (SizeDifference <= MinShAmt) { + Tmp = SizeDifference + + ComputeNumSignBits(Extendee, DemandedElts, Depth + 1); + if (MaxShAmt < Tmp) + return Tmp - MaxShAmt; + } + } // shl destroys sign bits, ensure it doesn't shift out all sign bits. Tmp = ComputeNumSignBits(Op.getOperand(0), DemandedElts, Depth + 1); - if (*ShAmt < Tmp) - return Tmp - *ShAmt; + if (MaxShAmt < Tmp) + return Tmp - MaxShAmt; } break; case ISD::AND: diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 1387922..707edb0 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2500,134 +2500,122 @@ bool AsmParser::expandMacro(raw_svector_ostream &OS, MCAsmMacro &Macro, ArrayRef<MCAsmMacroArgument> A, bool EnableAtPseudoVariable) { unsigned NParameters = Parameters.size(); - bool HasVararg = NParameters ? Parameters.back().Vararg : false; + auto expandArg = [&](unsigned Index) { + bool HasVararg = NParameters ? Parameters.back().Vararg : false; + bool VarargParameter = HasVararg && Index == (NParameters - 1); + for (const AsmToken &Token : A[Index]) + // For altmacro mode, you can write '%expr'. + // The prefix '%' evaluates the expression 'expr' + // and uses the result as a string (e.g. replace %(1+2) with the + // string "3"). + // Here, we identify the integer token which is the result of the + // absolute expression evaluation and replace it with its string + // representation. + if (AltMacroMode && Token.getString().front() == '%' && + Token.is(AsmToken::Integer)) + // Emit an integer value to the buffer. + OS << Token.getIntVal(); + // Only Token that was validated as a string and begins with '<' + // is considered altMacroString!!! + else if (AltMacroMode && Token.getString().front() == '<' && + Token.is(AsmToken::String)) { + OS << angleBracketString(Token.getStringContents()); + } + // We expect no quotes around the string's contents when + // parsing for varargs. + else if (Token.isNot(AsmToken::String) || VarargParameter) + OS << Token.getString(); + else + OS << Token.getStringContents(); + }; // A macro without parameters is handled differently on Darwin: // gas accepts no arguments and does no substitutions StringRef Body = Macro.Body; - while (!Body.empty()) { - // Scan for the next substitution. - std::size_t End = Body.size(), Pos = 0; - for (; Pos != End; ++Pos) { - // Check for a substitution or escape. - if (IsDarwin && !NParameters) { - // This macro has no parameters, look for $0, $1, etc. - if (Body[Pos] != '$' || Pos + 1 == End) - continue; + size_t I = 0, End = Body.size(); + while (I != End) { + if (Body[I] == '\\' && I + 1 != End) { + // Check for \@ and \+ pseudo variables. + if (EnableAtPseudoVariable && Body[I + 1] == '@') { + OS << NumOfMacroInstantiations; + I += 2; + continue; + } + if (Body[I + 1] == '+') { + OS << Macro.Count; + I += 2; + continue; + } + if (Body[I + 1] == '(' && Body[I + 2] == ')') { + I += 3; + continue; + } - char Next = Body[Pos + 1]; - if (Next == '$' || Next == 'n' || - isdigit(static_cast<unsigned char>(Next))) - break; - } else { - // This macro has parameters, look for \foo, \bar, etc. - if (Body[Pos] == '\\' && Pos + 1 != End) + size_t Pos = ++I; + while (I != End && isIdentifierChar(Body[I])) + ++I; + StringRef Argument(Body.data() + Pos, I - Pos); + if (AltMacroMode && I != End && Body[I] == '&') + ++I; + unsigned Index = 0; + for (; Index < NParameters; ++Index) + if (Parameters[Index].Name == Argument) break; - } + if (Index == NParameters) + OS << '\\' << Argument; + else + expandArg(Index); + continue; } - // Add the prefix. - OS << Body.slice(0, Pos); - - // Check if we reached the end. - if (Pos == End) - break; - - if (IsDarwin && !NParameters) { - switch (Body[Pos + 1]) { + if (Body[I] == '$' && I + 1 != End && IsDarwin && !NParameters) { + // This macro has no parameters, look for $0, $1, etc. + switch (Body[I + 1]) { // $$ => $ case '$': OS << '$'; - break; - + I += 2; + continue; // $n => number of arguments case 'n': OS << A.size(); - break; - - // $[0-9] => argument + I += 2; + continue; default: { - // Missing arguments are ignored. - unsigned Index = Body[Pos + 1] - '0'; - if (Index >= A.size()) + if (!isDigit(Body[I + 1])) break; - - // Otherwise substitute with the token values, with spaces eliminated. - for (const AsmToken &Token : A[Index]) - OS << Token.getString(); - break; + // $[0-9] => argument + // Missing arguments are ignored. + unsigned Index = Body[I + 1] - '0'; + if (Index < A.size()) + for (const AsmToken &Token : A[Index]) + OS << Token.getString(); + I += 2; + continue; } } - Pos += 2; - } else { - // Check for \@ and \+ pseudo variables. - unsigned I = Pos + 1; - if (I + 1 != End) { - if (EnableAtPseudoVariable && Body[I] == '@') { - ++I; - } else if (Body[I] == '+') { - ++I; - } else { - while (isIdentifierChar(Body[I]) && I + 1 != End) - ++I; - } - } + } - const char *Begin = Body.data() + Pos + 1; - StringRef Argument(Begin, I - (Pos + 1)); + if (AltMacroMode && isIdentifierChar(Body[I])) { + size_t Len = 1; + while (I + Len != End && isIdentifierChar(Body[I + Len])) + ++Len; + StringRef Argument(Body.data() + I, Len); unsigned Index = 0; - - if (Argument == "@") { - OS << NumOfMacroInstantiations; - Pos += 2; - } else if (Argument == "+") { - OS << Macro.Count; - Pos += 2; - } else { - for (; Index < NParameters; ++Index) - if (Parameters[Index].Name == Argument) - break; - - if (Index == NParameters) { - if (Body[Pos + 1] == '(' && Body[Pos + 2] == ')') - Pos += 3; - else { - OS << '\\' << Argument; - Pos = I; - } - } else { - bool VarargParameter = HasVararg && Index == (NParameters - 1); - for (const AsmToken &Token : A[Index]) - // For altmacro mode, you can write '%expr'. - // The prefix '%' evaluates the expression 'expr' - // and uses the result as a string (e.g. replace %(1+2) with the - // string "3"). - // Here, we identify the integer token which is the result of the - // absolute expression evaluation and replace it with its string - // representation. - if (AltMacroMode && Token.getString().front() == '%' && - Token.is(AsmToken::Integer)) - // Emit an integer value to the buffer. - OS << Token.getIntVal(); - // Only Token that was validated as a string and begins with '<' - // is considered altMacroString!!! - else if (AltMacroMode && Token.getString().front() == '<' && - Token.is(AsmToken::String)) { - OS << angleBracketString(Token.getStringContents()); - } - // We expect no quotes around the string's contents when - // parsing for varargs. - else if (Token.isNot(AsmToken::String) || VarargParameter) - OS << Token.getString(); - else - OS << Token.getStringContents(); - - Pos += 1 + Argument.size(); - } + for (; Index != NParameters; ++Index) + if (Parameters[Index].Name == Argument) + break; + if (Index != NParameters) { + expandArg(Index); + I += Len; + if (I != End && Body[I] == '&') + ++I; + continue; } } - // Update the scan point. - Body = Body.substr(Pos); + + OS << Body[I]; + ++I; } ++Macro.Count; diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 56fb8a1..1423deb 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -10258,6 +10258,7 @@ PreservedAnalyses LoopVectorizePass::run(Function &F, PA.preserve<LoopAnalysis>(); PA.preserve<DominatorTreeAnalysis>(); PA.preserve<ScalarEvolutionAnalysis>(); + PA.preserve<LoopAccessAnalysis>(); if (Result.MadeCFGChange) { // Making CFG changes likely means a loop got vectorized. Indicate that diff --git a/llvm/test/CodeGen/X86/known-signbits-shl.ll b/llvm/test/CodeGen/X86/known-signbits-shl.ll new file mode 100644 index 0000000..473fecc --- /dev/null +++ b/llvm/test/CodeGen/X86/known-signbits-shl.ll @@ -0,0 +1,158 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s --check-prefix=X64 + +; Verify that we can look through a ZERO_EXTEND/ANY_EXTEND when doing +; ComputeNumSignBits for SHL. +; We use the (sshlsat x, c) -> (shl x, c) fold as verification. +; That fold should happen if c is less than the number of sign bits in x + +define void @computeNumSignBits_shl_zext_1(i8 %x, ptr %p) nounwind { +; X64-LABEL: computeNumSignBits_shl_zext_1: +; X64: # %bb.0: +; X64-NEXT: sarb $5, %dil +; X64-NEXT: movzbl %dil, %eax +; X64-NEXT: movl %eax, %ecx +; X64-NEXT: shll $11, %ecx +; X64-NEXT: movw %cx, (%rsi) +; X64-NEXT: movl %eax, %ecx +; X64-NEXT: shll $12, %ecx +; X64-NEXT: movw %cx, (%rsi) +; X64-NEXT: shll $13, %eax +; X64-NEXT: movw %ax, (%rsi) +; X64-NEXT: retq + %ashr = ashr i8 %x, 5 + %zext = zext i8 %ashr to i16 + %nsb4 = shl i16 %zext, 10 + ; Expecting (sshlsat x, c) -> (shl x, c) fold. + %tmp1 = call i16 @llvm.sshl.sat.i16(i16 %nsb4, i16 1) + store volatile i16 %tmp1, ptr %p + ; Expecting (sshlsat x, c) -> (shl x, c) fold. + %tmp2 = call i16 @llvm.sshl.sat.i16(i16 %nsb4, i16 2) + store volatile i16 %tmp2, ptr %p + ; Expecting (sshlsat x, c) -> (shl x, c) fold. + %tmp3 = call i16 @llvm.sshl.sat.i16(i16 %nsb4, i16 3) + store volatile i16 %tmp3, ptr %p + ret void +} + +define void @computeNumSignBits_shl_zext_2(i8 %x, ptr %p) nounwind { +; X64-LABEL: computeNumSignBits_shl_zext_2: +; X64: # %bb.0: +; X64-NEXT: sarb $5, %dil +; X64-NEXT: movzbl %dil, %eax +; X64-NEXT: movl %eax, %ecx +; X64-NEXT: shll $10, %ecx +; X64-NEXT: xorl %edx, %edx +; X64-NEXT: testw %cx, %cx +; X64-NEXT: sets %dl +; X64-NEXT: addl $32767, %edx # imm = 0x7FFF +; X64-NEXT: shll $14, %eax +; X64-NEXT: movswl %ax, %edi +; X64-NEXT: shrl $4, %edi +; X64-NEXT: cmpw %di, %cx +; X64-NEXT: cmovnel %edx, %eax +; X64-NEXT: movw %ax, (%rsi) +; X64-NEXT: retq + %ashr = ashr i8 %x, 5 + %zext = zext i8 %ashr to i16 + %nsb4 = shl i16 %zext, 10 + ; 4 sign bits. Not expecting (sshlsat x, c) -> (shl x, c) fold. + %tmp4 = call i16 @llvm.sshl.sat.i16(i16 %nsb4, i16 4) + store volatile i16 %tmp4, ptr %p + ret void +} + +define void @computeNumSignBits_shl_zext_vec_1(<2 x i8> %x, ptr %p) nounwind { +; X64-LABEL: computeNumSignBits_shl_zext_vec_1: +; X64: # %bb.0: +; X64-NEXT: psrlw $5, %xmm0 +; X64-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 +; X64-NEXT: movdqa {{.*#+}} xmm1 = [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4] +; X64-NEXT: pxor %xmm1, %xmm0 +; X64-NEXT: psubb %xmm1, %xmm0 +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7] +; X64-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 # [2048,8192,u,u,u,u,u,u] +; X64-NEXT: movd %xmm0, (%rdi) +; X64-NEXT: retq + %ashr = ashr <2 x i8> %x, <i8 5, i8 5> + %zext = zext <2 x i8> %ashr to <2 x i16> + %nsb4_2 = shl <2 x i16> %zext, <i16 10, i16 12> + ; Expecting (sshlsat x, c) -> (shl x, c) fold. + %tmp1 = call <2 x i16> @llvm.sshl.sat.v2i16(<2 x i16> %nsb4_2, <2 x i16> <i16 1, i16 1>) + store volatile <2 x i16> %tmp1, ptr %p + ret void +} + +define void @computeNumSignBits_shl_zext_vec_2(<2 x i8> %x, ptr %p) nounwind { +; X64-LABEL: computeNumSignBits_shl_zext_vec_2: +; X64: # %bb.0: +; X64-NEXT: psrlw $5, %xmm0 +; X64-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 +; X64-NEXT: movdqa {{.*#+}} xmm1 = [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4] +; X64-NEXT: pxor %xmm1, %xmm0 +; X64-NEXT: psubb %xmm1, %xmm0 +; X64-NEXT: pxor %xmm1, %xmm1 +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7] +; X64-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 # [1024,4096,u,u,u,u,u,u] +; X64-NEXT: movdqa {{.*#+}} xmm2 = [32768,32768,32768,32768,32768,32768,32768,32768] +; X64-NEXT: pand %xmm0, %xmm2 +; X64-NEXT: pcmpgtw %xmm0, %xmm1 +; X64-NEXT: pandn {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1 +; X64-NEXT: por %xmm2, %xmm1 +; X64-NEXT: movdqa %xmm0, %xmm2 +; X64-NEXT: psllw $2, %xmm2 +; X64-NEXT: movdqa %xmm2, %xmm3 +; X64-NEXT: psraw $2, %xmm3 +; X64-NEXT: pcmpeqw %xmm0, %xmm3 +; X64-NEXT: movdqa %xmm3, %xmm0 +; X64-NEXT: pandn %xmm1, %xmm0 +; X64-NEXT: pand %xmm2, %xmm3 +; X64-NEXT: por %xmm0, %xmm3 +; X64-NEXT: movd %xmm3, (%rdi) +; X64-NEXT: retq + %ashr = ashr <2 x i8> %x, <i8 5, i8 5> + %zext = zext <2 x i8> %ashr to <2 x i16> + %nsb4_2 = shl <2 x i16> %zext, <i16 10, i16 12> + ; Not expecting (sshlsat x, c) -> (shl x, c) fold. + ; Because only 2 sign bits in element 1. + %tmp1 = call <2 x i16> @llvm.sshl.sat.v2i16(<2 x i16> %nsb4_2, <2 x i16> <i16 2, i16 2>) + store volatile <2 x i16> %tmp1, ptr %p + ret void +} + +define void @computeNumSignBits_shl_zext_vec_3(<2 x i8> %x, ptr %p) nounwind { +; X64-LABEL: computeNumSignBits_shl_zext_vec_3: +; X64: # %bb.0: +; X64-NEXT: psrlw $5, %xmm0 +; X64-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 +; X64-NEXT: movdqa {{.*#+}} xmm1 = [4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4] +; X64-NEXT: pxor %xmm1, %xmm0 +; X64-NEXT: psubb %xmm1, %xmm0 +; X64-NEXT: pxor %xmm1, %xmm1 +; X64-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7] +; X64-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0 # [16384,4096,u,u,u,u,u,u] +; X64-NEXT: movdqa {{.*#+}} xmm2 = [32768,32768,32768,32768,32768,32768,32768,32768] +; X64-NEXT: pand %xmm0, %xmm2 +; X64-NEXT: pcmpgtw %xmm0, %xmm1 +; X64-NEXT: pandn {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1 +; X64-NEXT: por %xmm2, %xmm1 +; X64-NEXT: movdqa %xmm0, %xmm2 +; X64-NEXT: paddw %xmm0, %xmm2 +; X64-NEXT: movdqa %xmm2, %xmm3 +; X64-NEXT: psraw $1, %xmm3 +; X64-NEXT: pcmpeqw %xmm0, %xmm3 +; X64-NEXT: movdqa %xmm3, %xmm0 +; X64-NEXT: pandn %xmm1, %xmm0 +; X64-NEXT: pand %xmm2, %xmm3 +; X64-NEXT: por %xmm0, %xmm3 +; X64-NEXT: movd %xmm3, (%rdi) +; X64-NEXT: retq + %ashr = ashr <2 x i8> %x, <i8 5, i8 5> + %zext = zext <2 x i8> %ashr to <2 x i16> + %nsb1_2 = shl <2 x i16> %zext, <i16 14, i16 12> + ; Not expecting (sshlsat x, c) -> (shl x, c) fold. + ; Because all sign bits shifted out for element 0 + %tmp1 = call <2 x i16> @llvm.sshl.sat.v2i16(<2 x i16> %nsb1_2, <2 x i16> <i16 1, i16 1>) + store volatile <2 x i16> %tmp1, ptr %p + ret void +} diff --git a/llvm/test/MC/AArch64/ilp32-diagnostics.s b/llvm/test/MC/AArch64/ilp32-diagnostics.s index 4ca15f1..8a3bc13 100644 --- a/llvm/test/MC/AArch64/ilp32-diagnostics.s +++ b/llvm/test/MC/AArch64/ilp32-diagnostics.s @@ -1,105 +1,83 @@ // RUN: not llvm-mc -triple aarch64-none-linux-gnu_ilp32 \ -// RUN: < %s 2> %t2 -filetype=obj >/dev/null -// RUN: FileCheck --check-prefix=CHECK-ERROR %s < %t2 - - .xword sym-. -// CHECK-ERROR: error: ILP32 8 byte PC relative data relocation not supported (LP64 eqv: PREL64) -// CHECK-ERROR: ^ - - .xword sym+16 -// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: ABS64) -// CHECK-ERROR: ^ - - .xword sym@AUTH(da,42) -// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64) -// CHECK-ERROR: ^ - - .xword sym@AUTH(da,42,addr) -// CHECK-ERROR: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64) -// CHECK-ERROR: ^ - - movz x7, #:abs_g3:some_label -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G3) -// CHECK-ERROR: movz x7, #:abs_g3:some_label -// CHECK-ERROR: ^ - - movz x3, #:abs_g2:some_label -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G2) -// CHECK-ERROR: movz x3, #:abs_g2:some_label -// CHECK-ERROR: ^ - - movz x19, #:abs_g2_s:some_label -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_SABS_G2) -// CHECK-ERROR: movz x19, #:abs_g2_s:some_label -// CHECK-ERROR: ^ - - movk x5, #:abs_g2_nc:some_label -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G2_NC) -// CHECK-ERROR: movk x5, #:abs_g2_nc:some_label -// CHECK-ERROR: ^ - - movz x19, #:abs_g1_s:some_label -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_SABS_G1) -// CHECK-ERROR: movz x19, #:abs_g1_s:some_label -// CHECK-ERROR: ^ - - movk x5, #:abs_g1_nc:some_label -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G1_NC) -// CHECK-ERROR: movk x5, #:abs_g1_nc:some_label -// CHECK-ERROR: ^ - - movz x3, #:dtprel_g2:var -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLD_MOVW_DTPREL_G2) -// CHECK-ERROR: movz x3, #:dtprel_g2:var -// CHECK-ERROR: ^ - - movk x9, #:dtprel_g1_nc:var -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLD_MOVW_DTPREL_G1_NC) -// CHECK-ERROR: movk x9, #:dtprel_g1_nc:var -// CHECK-ERROR: ^ - - movz x3, #:tprel_g2:var -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLE_MOVW_TPREL_G2) -// CHECK-ERROR: movz x3, #:tprel_g2:var -// CHECK-ERROR: ^ - - movk x9, #:tprel_g1_nc:var -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLE_MOVW_TPREL_G1_NC) -// CHECK-ERROR: movk x9, #:tprel_g1_nc:var -// CHECK-ERROR: ^ - - movz x15, #:gottprel_g1:var -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSIE_MOVW_GOTTPREL_G1) -// CHECK-ERROR: movz x15, #:gottprel_g1:var -// CHECK-ERROR: ^ - - movk x13, #:gottprel_g0_nc:var -// CHECK-ERROR: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSIE_MOVW_GOTTPREL_G0_NC) -// CHECK-ERROR: movk x13, #:gottprel_g0_nc:var -// CHECK-ERROR: ^ - - ldr x10, [x0, #:gottprel_lo12:var] -// CHECK-ERROR: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) -// CHECK-ERROR: ldr x10, [x0, #:gottprel_lo12:var] -// CHECK-ERROR: ^ - - ldr x24, [x23, #:got_lo12:sym] -// CHECK-ERROR: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: LD64_GOT_LO12_NC) -// CHECK-ERROR: ^ - - ldr x24, [x23, :gottprel_lo12:sym] -// CHECK-ERROR: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) -// CHECK-ERROR: ^ - - ldr x10, [x0, #:gottprel_lo12:var] -// CHECK-ERROR: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) -// CHECK-ERROR: ldr x10, [x0, #:gottprel_lo12:var] -// CHECK-ERROR: ^ - - ldr x24, [x23, #:got_lo12:sym] -// CHECK-ERROR: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: LD64_GOT_LO12_NC) -// CHECK-ERROR: ^ - - ldr x24, [x23, :gottprel_lo12:sym] -// CHECK-ERROR: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) -// CHECK-ERROR: ^ +// RUN: < %s 2> %t2 -filetype=obj >/dev/null +// RUN: FileCheck --check-prefix=ERROR %s --implicit-check-not=error: < %t2 + +.xword sym-. +// ERROR: [[#@LINE-1]]:8: error: ILP32 8 byte PC relative data relocation not supported (LP64 eqv: PREL64) + +.xword sym+16 +// ERROR: [[#@LINE-1]]:8: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: ABS64) + +.xword sym@AUTH(da,42) +// ERROR: [[#@LINE-1]]:8: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64) + +.xword sym@AUTH(da,42,addr) +// ERROR: [[#@LINE-1]]:8: error: ILP32 8 byte absolute data relocation not supported (LP64 eqv: AUTH_ABS64) + +movz x7, #:abs_g3:some_label +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G3) +// ERROR: movz x7, #:abs_g3:some_label + +movz x3, #:abs_g2:some_label +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G2) +// ERROR: movz x3, #:abs_g2:some_label + +movz x19, #:abs_g2_s:some_label +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_SABS_G2) +// ERROR: movz x19, #:abs_g2_s:some_label + +movk x5, #:abs_g2_nc:some_label +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G2_NC) +// ERROR: movk x5, #:abs_g2_nc:some_label + +movz x19, #:abs_g1_s:some_label +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_SABS_G1) +// ERROR: movz x19, #:abs_g1_s:some_label + +movk x5, #:abs_g1_nc:some_label +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: MOVW_UABS_G1_NC) +// ERROR: movk x5, #:abs_g1_nc:some_label + +movz x3, #:dtprel_g2:var +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLD_MOVW_DTPREL_G2) +// ERROR: movz x3, #:dtprel_g2:var + +movk x9, #:dtprel_g1_nc:var +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLD_MOVW_DTPREL_G1_NC) +// ERROR: movk x9, #:dtprel_g1_nc:var + +movz x3, #:tprel_g2:var +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLE_MOVW_TPREL_G2) +// ERROR: movz x3, #:tprel_g2:var + +movk x9, #:tprel_g1_nc:var +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSLE_MOVW_TPREL_G1_NC) +// ERROR: movk x9, #:tprel_g1_nc:var + +movz x15, #:gottprel_g1:var +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSIE_MOVW_GOTTPREL_G1) +// ERROR: movz x15, #:gottprel_g1:var + +movk x13, #:gottprel_g0_nc:var +// ERROR: [[#@LINE-1]]:1: error: ILP32 absolute MOV relocation not supported (LP64 eqv: TLSIE_MOVW_GOTTPREL_G0_NC) +// ERROR: movk x13, #:gottprel_g0_nc:var + +ldr x10, [x0, #:gottprel_lo12:var] +// ERROR: [[#@LINE-1]]:1: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) +// ERROR: ldr x10, [x0, #:gottprel_lo12:var] + +ldr x24, [x23, #:got_lo12:sym] +// ERROR: [[#@LINE-1]]:1: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: LD64_GOT_LO12_NC) + +ldr x24, [x23, :gottprel_lo12:sym] +// ERROR: [[#@LINE-1]]:1: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) + +ldr x10, [x0, #:gottprel_lo12:var] +// ERROR: [[#@LINE-1]]:1: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) +// ERROR: ldr x10, [x0, #:gottprel_lo12:var] + +ldr x24, [x23, #:got_lo12:sym] +// ERROR: [[#@LINE-1]]:1: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: LD64_GOT_LO12_NC) + +ldr x24, [x23, :gottprel_lo12:sym] +// ERROR: [[#@LINE-1]]:1: error: ILP32 64-bit load/store relocation not supported (LP64 eqv: TLSIE_LD64_GOTTPREL_LO12_NC) diff --git a/llvm/test/MC/AsmParser/altmacro-arg.s b/llvm/test/MC/AsmParser/altmacro-arg.s new file mode 100644 index 0000000..262c5ea --- /dev/null +++ b/llvm/test/MC/AsmParser/altmacro-arg.s @@ -0,0 +1,22 @@ +## Arguments can be expanded even if they are not preceded by \ +# RUN: llvm-mc -triple=x86_64 %s | FileCheck %s + +# CHECK: 1 1 1a +# CHECK-NEXT: 1 2 1a 2b +# CHECK-NEXT: \$b \$b +.altmacro +.irp ._a,1 + .print "\._a \._a& ._a&a" + .irp $b,2 + .print "\._a \$b ._a&a $b&b" + .endr + .print "\$b \$b&" +.endr + +# CHECK: 1 1& ._a&a +# CHECK-NEXT: \$b \$b& +.noaltmacro +.irp ._a,1 + .print "\._a \._a& ._a&a" + .print "\$b \$b&" +.endr diff --git a/llvm/test/MC/AsmParser/altmacro_expression.s b/llvm/test/MC/AsmParser/altmacro_expression.s index 58d8b48..cee0a687 100644 --- a/llvm/test/MC/AsmParser/altmacro_expression.s +++ b/llvm/test/MC/AsmParser/altmacro_expression.s @@ -3,10 +3,12 @@ # Checking that the '%' was evaluated as a string first # In a fail scenario: The asmprint will print: addl $%(1+4), %eax -# CHECK: addl $5, %eax +# CHECK: addl $5, %eax +# CHECK-NEXT: addl $5, %eax .altmacro .macro percent_expr arg addl $\arg, %eax + addl $\arg&, %eax .endm percent_expr %(1+4) diff --git a/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll b/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll index c78e005..48fa1986 100644 --- a/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll +++ b/llvm/test/Transforms/LoopVectorize/novect-lcssa-cfg-invalidation.ll @@ -12,7 +12,7 @@ define i32 @novect(ptr %p) { ; CHECK-NOT: Invalidating analysis: BranchProbabilityAnalysis on novect ; CHECK-NOT: Invalidating analysis: BlockFrequencyAnalysis on novect ; CHECK: Invalidating analysis: DemandedBitsAnalysis on novect -; CHECK: Invalidating analysis: LoopAccessAnalysis on novect +; CHECK-NOT: Invalidating analysis: LoopAccessAnalysis on novect ; CHECK: Running pass: JumpThreadingPass on novect ; CHECK: entry: |