[clang] 0626ced - [clang][NFC] Replace ARM_STREAMING_ATTR in tests with SME streaming attribute
Author: Samuel Tebbs Date: 2023-12-05T13:35:23Z New Revision: 0626cedb17555ee003bec7588c7b3d51353793a2 URL: https://github.com/llvm/llvm-project/commit/0626cedb17555ee003bec7588c7b3d51353793a2 DIFF: https://github.com/llvm/llvm-project/commit/0626cedb17555ee003bec7588c7b3d51353793a2.diff LOG: [clang][NFC] Replace ARM_STREAMING_ATTR in tests with SME streaming attribute Some tests were testing SME builtins before the streaming attributes existed, and so either inserted them or not depending on a macro definition. The intention was for the macro to be defined once the attributes were added to clang, but it never was defined. This change removes the macro logic and adds the attribute now that they have been added to clang. Added: Modified: clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1_vnum.c clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1.c clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_st1_vnum.c Removed: diff --git a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c index 72d159b19118e..5622568c4cd76 100644 --- a/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c +++ b/clang/test/CodeGen/aarch64-sme-intrinsics/acle_sme_ld1.c @@ -1,17 +1,11 @@ // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 3 // REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C -// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX -// RUN: %clang_cc1 -DDISABLE_SME_ATTRIBUTES -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - %s | FileCheck %s -check-prefixes=CHECK,CHECK-C +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK,CHECK-CXX +// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -S -O1 -Werror -o /dev/null %s #include -#ifdef DISABLE_SME_ATTRIBUTES -#define ARM_STREAMING_ATTR -#else -#define ARM_STREAMING_ATTR __attribute__((arm_streaming)) -#endif - // CHECK-C-LABEL: define dso_local void @test_svld1_hor_za8( // CHECK-C-SAME: i32 noundef [[SLICE_BASE:%.*]], [[PG:%.*]], ptr noundef [[PTR:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { // CHECK-C-NEXT: entry: @@ -28,7 +22,7 @@ // CHECK-CXX-NEXT:tail call void @llvm.aarch64.sme.ld1b.horiz( [[PG]], ptr [[PTR]], i32 0, i32 [[ADD]]) // CHECK-CXX-NEXT:ret void // -ARM_STREAMING_ATTR void test_svld1_hor_za8(uint32_t slice_base, svbool_t pg, const void *ptr) { +void test_svld1_hor_za8(uint32_t slice_base, svbool_t pg, const void *ptr) __arm_streaming { svld1_hor_za8(0, slice_base, pg, ptr); svld1_hor_za8(0, slice_base + 15, pg, ptr); } @@ -51,7 +45,7 @@ ARM_STREAMING_ATTR void test_svld1_hor_za8(uint32_t slice_base, svbool_t pg, con // CHECK-CXX-NEXT:tail call void @llvm.aarch64.sme.ld1h.horiz( [[TMP0]], ptr [[PTR]], i32 1, i32 [[ADD]]) // CHECK-CXX-NEXT:ret void // -ARM_STREAMING_ATTR void test_svld1_hor_za16(uint32_t slice_base, svbool_t pg, const void *ptr) { +void test_svld1_hor_za16(uint32_t slice_base, svbool_t pg, const void *ptr) __arm_streaming { svld1_hor_za16(0, slice_base, pg, ptr); svld1_hor_za16(1, slice_base + 7, pg, ptr); } @@ -74,7 +68,7 @@ ARM_STREAMING_ATTR void test_svld1_hor_za16(uint32_t slice_base, svbool_t pg, co // CHECK-CXX-NEXT:tail call void @llvm.aarch64.sme.ld1w.horiz( [[TMP0]], ptr [[PTR]], i32 3, i32 [[ADD]]) // CHECK-CXX-NEXT:ret void // -ARM_STREAMING_ATTR void test_svld1_hor_za32(uint32_t slice_base, svbool_t pg, const void *ptr) { +void test_svld1_hor_za32(uint32_t slice_base, svbool_t pg, const void *ptr) __arm_streaming { svld1_hor_za32(0, slice_base, pg, ptr); svld1_hor_za32(3, slice_base + 3, pg, ptr); } @@ -97,7 +91,7 @@ ARM_STREAMING_ATTR void test_svld1_hor_za32(uint32_t slice_base, svbool_t pg, co // CHECK-CXX-NEXT:tail call void @llvm.aarch64.sme.ld1d.horiz( [[TMP0]], ptr [[PTR]], i32 7, i32 [[ADD]]) // CHECK-CXX-NEXT:ret void // -ARM_STREAMING_ATTR void test_svld1_hor_za64(uint32_t slice_base, svbool_t pg, const void *ptr) { +void test_svld1_hor_za64(uint32_t slice_base, svbool_t pg, const void *ptr) __arm_streaming { svld1_hor_za64(0, slice_base, pg, ptr); svld1_hor_za6
[clang] 02c218c - [Clang][NFC] Refactor out code from CheckSVEBuiltinFunctionCall into ParseSVEImmChecks
Author: Samuel Tebbs Date: 2023-12-06T15:12:40Z New Revision: 02c218c6fbbf4a3eec600618b4e8f3b44754b686 URL: https://github.com/llvm/llvm-project/commit/02c218c6fbbf4a3eec600618b4e8f3b44754b686 DIFF: https://github.com/llvm/llvm-project/commit/02c218c6fbbf4a3eec600618b4e8f3b44754b686.diff LOG: [Clang][NFC] Refactor out code from CheckSVEBuiltinFunctionCall into ParseSVEImmChecks This moves code from CheckSVEBuiltinFunctionCall into ParseSVEImmChecks in preparation for #74064 Added: Modified: clang/include/clang/Sema/Sema.h clang/lib/Sema/SemaChecking.cpp Removed: diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index e745c01ae0ae0..26f4e38a46e83 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -13841,6 +13841,8 @@ class Sema final { CallExpr *TheCall); bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall); + bool ParseSVEImmChecks(CallExpr *TheCall, + SmallVector, 3> &ImmChecks); bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, CallExpr *TheCall); bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg, diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 07ced5ffc3407..fc6ee6b2c5ab4 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3000,58 +3000,15 @@ static QualType getNeonEltType(NeonTypeFlags Flags, ASTContext &Context, enum ArmStreamingType { ArmNonStreaming, ArmStreaming, ArmStreamingCompatible }; -static ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD) { - if (FD->hasAttr()) -return ArmStreaming; - if (const auto *T = FD->getType()->getAs()) { -if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask) - return ArmStreaming; -if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMCompatibleMask) - return ArmStreamingCompatible; - } - return ArmNonStreaming; -} - -static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall, - const FunctionDecl *FD, - ArmStreamingType BuiltinType) { - ArmStreamingType FnType = getArmStreamingFnType(FD); - - if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming) { -S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin) -<< TheCall->getSourceRange() << "streaming"; - } - - if (FnType == ArmStreamingCompatible && - BuiltinType != ArmStreamingCompatible) { -S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin) -<< TheCall->getSourceRange() << "streaming compatible"; -return; - } -} - -bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { - // Range check SVE intrinsics that take immediate values. - SmallVector, 3> ImmChecks; - - switch (BuiltinID) { - default: -return false; -#define GET_SVE_IMMEDIATE_CHECK -#include "clang/Basic/arm_sve_sema_rangechecks.inc" -#undef GET_SVE_IMMEDIATE_CHECK -#define GET_SME_IMMEDIATE_CHECK -#include "clang/Basic/arm_sme_sema_rangechecks.inc" -#undef GET_SME_IMMEDIATE_CHECK - } - +bool Sema::ParseSVEImmChecks( +CallExpr *TheCall, SmallVector, 3> &ImmChecks) { // Perform all the immediate checks for this builtin call. bool HasError = false; for (auto &I : ImmChecks) { int ArgNum, CheckTy, ElementSizeInBits; std::tie(ArgNum, CheckTy, ElementSizeInBits) = I; -typedef bool(*OptionSetCheckFnTy)(int64_t Value); +typedef bool (*OptionSetCheckFnTy)(int64_t Value); // Function that checks whether the operand (ArgNum) is an immediate // that is one of the predefined values. @@ -3183,6 +3140,54 @@ bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { return HasError; } +static ArmStreamingType getArmStreamingFnType(const FunctionDecl *FD) { + if (FD->hasAttr()) +return ArmStreaming; + if (const auto *T = FD->getType()->getAs()) { +if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask) + return ArmStreaming; +if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMCompatibleMask) + return ArmStreamingCompatible; + } + return ArmNonStreaming; +} + +static void checkArmStreamingBuiltin(Sema &S, CallExpr *TheCall, + const FunctionDecl *FD, + ArmStreamingType BuiltinType) { + ArmStreamingType FnType = getArmStreamingFnType(FD); + + if (FnType == ArmStreaming && BuiltinType == ArmNonStreaming) { +S.Diag(TheCall->getBeginLoc(), diag::warn_attribute_arm_sm_incompat_builtin) +<< TheCall-
[clang] cc8237d - [documentation] Fix some typos
Author: Ayushi Shukla Date: 2023-03-30T15:58:02+01:00 New Revision: cc8237d9d727b864fe65d2c9d620f3332f4235ca URL: https://github.com/llvm/llvm-project/commit/cc8237d9d727b864fe65d2c9d620f3332f4235ca DIFF: https://github.com/llvm/llvm-project/commit/cc8237d9d727b864fe65d2c9d620f3332f4235ca.diff LOG: [documentation] Fix some typos This patch fixes https://github.com/llvm/llvm-project/issues/56747 Patch-By: ayushi-8102 Differential Revision: https://reviews.llvm.org/D146892 Added: Modified: clang/docs/AutomaticReferenceCounting.rst clang/docs/ConstantInterpreter.rst clang/docs/CrossCompilation.rst clang/docs/DataFlowAnalysisIntro.md clang/docs/DebuggingCoroutines.rst clang/docs/analyzer/developer-docs/nullability.rst clang/include/clang/AST/CXXInheritance.h clang/include/clang/AST/CommentSema.h clang/include/clang/AST/Decl.h clang/include/clang/AST/DeclBase.h clang/include/clang/AST/DeclTemplate.h clang/include/clang/AST/DeclarationName.h clang/include/clang/AST/Expr.h clang/include/clang/Analysis/Analyses/CalledOnceCheck.h clang/include/clang/Analysis/Analyses/Consumed.h Removed: diff --git a/clang/docs/AutomaticReferenceCounting.rst b/clang/docs/AutomaticReferenceCounting.rst index 5e40fa837b1aa..640f3f7dec390 100644 --- a/clang/docs/AutomaticReferenceCounting.rst +++ b/clang/docs/AutomaticReferenceCounting.rst @@ -635,7 +635,7 @@ retain-agnostic, the conversion is treated as a ``__bridge`` cast. For loads from ``const`` global variables of :ref:`C retainable pointer type `, it is reasonable to assume that global system - constants were initialitzed with true constants (e.g. string literals), but + constants were initialized with true constants (e.g. string literals), but user constants might have been initialized with something dynamically allocated, using a global initializer. diff --git a/clang/docs/ConstantInterpreter.rst b/clang/docs/ConstantInterpreter.rst index eba637585b8f0..0c5b09c73ee30 100644 --- a/clang/docs/ConstantInterpreter.rst +++ b/clang/docs/ConstantInterpreter.rst @@ -81,7 +81,7 @@ Primitive Types * ``PT_VoidPtr`` - Void pointer type, can be used for rount-trip casts. Represented as + Void pointer type, can be used for round-trip casts. Represented as the union of all pointers which can be cast to void. Defined in ``"VoidPointer.h"``. diff --git a/clang/docs/CrossCompilation.rst b/clang/docs/CrossCompilation.rst index 3578eb3e4db01..48f0f72477544 100644 --- a/clang/docs/CrossCompilation.rst +++ b/clang/docs/CrossCompilation.rst @@ -97,7 +97,7 @@ choose ``unknown`` and the defaults will be used. If you choose a parameter that Clang doesn't know, like ``blerg``, it'll ignore and assume ``unknown``, which is not always desired, so be careful. -Finally, the env (enviornment) option is something that will pick default +Finally, the env (environment) option is something that will pick default CPU/FPU, define the specific behaviour of your code (PCS, extensions), and also choose the correct library calls, etc. diff --git a/clang/docs/DataFlowAnalysisIntro.md b/clang/docs/DataFlowAnalysisIntro.md index 8bfecd24906cb..67faae0cd9e72 100644 --- a/clang/docs/DataFlowAnalysisIntro.md +++ b/clang/docs/DataFlowAnalysisIntro.md @@ -219,7 +219,7 @@ the function: this fact as `⊤`. * When two control flow paths join, we compute the set union of incoming -values (limiting the number of elements to 3, representig larger sets as +values (limiting the number of elements to 3, representing larger sets as `⊤`). The sets of possible values are influenced by: @@ -332,7 +332,7 @@ void PrintAbs(int x) { We can't say what specific value gets printed, but we know that it is either `x` or `-x`. -Dataflow analysis is an istance of abstract interpretation, and does not dictate +Dataflow analysis is an instance of abstract interpretation, and does not dictate how exactly the lattice and transfer functions should be designed, beyond the necessary conditions for the analysis to converge. Nevertheless, we can use symbolic execution ideas to guide our design of the lattice and transfer @@ -634,7 +634,7 @@ void Uninit() { For this purpose we can use lattice in a form of a mapping from variable declarations to initialization states; each initialization state is represented -by the followingn lattice: +by the following lattice:  diff --git a/clang/docs/DebuggingCoroutines.rst b/clang/docs/DebuggingCoroutines.rst index ae5359117775b..591d2eadabe53 100644 --- a/clang/docs/DebuggingCoroutines.rst +++ b/clang/docs/DebuggingCoroutines.rst @@ -620,7 +620,7 @@ Then let's run: $ clang++ -std=c++20 -g debugging-example.cpp -o debugging-example $ gdb ./de