[PATCH] D113352: [clang] Run LLVM Verifier in modes without CodeGen too
dblaikie added a comment. I guess CodeGenOpts::VerifyModule is on by default, but I'll admit that surprises me - for API-built modules, I figured it was expected they were valid by construction (ie: like an assertion - it's a bug in clang if the resulting module isn't valid - so we wouldn't want to validate that invariant on every user's compilation, etc) - so I'd expect we should have to opt-in to verifying on output. (verifying on /input/ would be always done - because the input is untrusted) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113352/new/ https://reviews.llvm.org/D113352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113361: [clang][Sparc] Disable SjLj lowering.
brad created this revision. brad added reviewers: dcederman, LemonBoy, jyknight. brad added a project: clang. Herald added subscribers: jrtc27, fedor.sergeev. brad requested review of this revision. Disable SjLj lowering. The builtin SjLj support has been removed. https://reviews.llvm.org/rG0c05bdea2bc6e9acc1fb8455c01527e1cfe0e02a PR 51489 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D113361 Files: clang/lib/Basic/Targets/Sparc.h clang/test/Sema/builtin-longjmp.c Index: clang/test/Sema/builtin-longjmp.c === --- clang/test/Sema/builtin-longjmp.c +++ clang/test/Sema/builtin-longjmp.c @@ -3,12 +3,12 @@ // RUN: %clang_cc1 -triple x86_64-windows -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm < %s| FileCheck %s -// RUN: %clang_cc1 -triple sparc-eabi-unknown -emit-llvm < %s | FileCheck %s // RUN: %clang_cc1 -triple ve-unknown-unknown -emit-llvm < %s | FileCheck %s // RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm-only -verify %s // RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm-only -verify %s // RUN: %clang_cc1 -triple mips64-unknown-unknown -emit-llvm-only -verify %s +// RUN: %clang_cc1 -triple sparc-eabi-unknown -emit-llvm-only -verify %s // Check that __builtin_longjmp and __builtin_setjmp are lowered into // IR intrinsics on those architectures that can handle them. Index: clang/lib/Basic/Targets/Sparc.h === --- clang/lib/Basic/Targets/Sparc.h +++ clang/lib/Basic/Targets/Sparc.h @@ -48,8 +48,6 @@ bool hasFeature(StringRef Feature) const override; - bool hasSjLjLowering() const override { return true; } - ArrayRef getTargetBuiltins() const override { // FIXME: Implement! return None; @@ -178,7 +176,6 @@ void getTargetDefines(const LangOptions , MacroBuilder ) const override; - bool hasSjLjLowering() const override { return true; } bool hasExtIntType() const override { return true; } }; Index: clang/test/Sema/builtin-longjmp.c === --- clang/test/Sema/builtin-longjmp.c +++ clang/test/Sema/builtin-longjmp.c @@ -3,12 +3,12 @@ // RUN: %clang_cc1 -triple x86_64-windows -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple powerpc-unknown-unknown -emit-llvm < %s| FileCheck %s // RUN: %clang_cc1 -triple powerpc64-unknown-unknown -emit-llvm < %s| FileCheck %s -// RUN: %clang_cc1 -triple sparc-eabi-unknown -emit-llvm < %s | FileCheck %s // RUN: %clang_cc1 -triple ve-unknown-unknown -emit-llvm < %s | FileCheck %s // RUN: %clang_cc1 -triple aarch64-unknown-unknown -emit-llvm-only -verify %s // RUN: %clang_cc1 -triple mips-unknown-unknown -emit-llvm-only -verify %s // RUN: %clang_cc1 -triple mips64-unknown-unknown -emit-llvm-only -verify %s +// RUN: %clang_cc1 -triple sparc-eabi-unknown -emit-llvm-only -verify %s // Check that __builtin_longjmp and __builtin_setjmp are lowered into // IR intrinsics on those architectures that can handle them. Index: clang/lib/Basic/Targets/Sparc.h === --- clang/lib/Basic/Targets/Sparc.h +++ clang/lib/Basic/Targets/Sparc.h @@ -48,8 +48,6 @@ bool hasFeature(StringRef Feature) const override; - bool hasSjLjLowering() const override { return true; } - ArrayRef getTargetBuiltins() const override { // FIXME: Implement! return None; @@ -178,7 +176,6 @@ void getTargetDefines(const LangOptions , MacroBuilder ) const override; - bool hasSjLjLowering() const override { return true; } bool hasExtIntType() const override { return true; } }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113359: [Libomptarget][WIP] Introduce VGPU Plugin
atmnpatel created this revision. atmnpatel added reviewers: jdoerfert, tianshilei1992, JonChesterfield. Herald added subscribers: ormris, dexonsmith, pengfei, hiraditya, mgorny. atmnpatel requested review of this revision. Herald added subscribers: llvm-commits, openmp-commits, cfe-commits, sstefan1. Herald added projects: clang, OpenMP, LLVM. This patch introduces a virtual GPU (x86) plugin. This allows for the emulation of the GPU environment on the host. This re-uses the same execution model, compilation paths, runtimes as a physical GPU. The number of threads, warps, and CTAs are set through the environment variables `VGPU_{NUM_THREADS,NUM_WARPS,WARPS_PER_CTA}` respectively. Known Bugs (hence WIP): - In the rebase from LLVM 12, larger applications started segfaulting. Small programs still work with this patch. - The virtual GPU should be able to execute kernels asynchronously using the streams - but there is an unknown lifetime issue around the `ffi_call` that prevents the removal of the await after the `scheduleAsync` call. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D113359 Files: clang/lib/Basic/Targets/X86.h clang/lib/CodeGen/CGOpenMPRuntimeVirtualGPU.cpp clang/lib/CodeGen/CGOpenMPRuntimeVirtualGPU.h clang/lib/CodeGen/CMakeLists.txt clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Frontend/CompilerInvocation.cpp llvm/include/llvm/ADT/Triple.h llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h llvm/include/llvm/Frontend/OpenMP/OMPKinds.def llvm/lib/Support/Triple.cpp llvm/lib/Transforms/IPO/OpenMPOpt.cpp llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn openmp/CMakeLists.txt openmp/libomptarget/DeviceRTL/CMakeLists.txt openmp/libomptarget/DeviceRTL/include/Interface.h openmp/libomptarget/DeviceRTL/src/Kernel.cpp openmp/libomptarget/DeviceRTL/src/Mapping.cpp openmp/libomptarget/DeviceRTL/src/Misc.cpp openmp/libomptarget/DeviceRTL/src/Synchronization.cpp openmp/libomptarget/DeviceRTL/src/Utils.cpp openmp/libomptarget/include/DeviceEnvironment.h openmp/libomptarget/plugins/CMakeLists.txt openmp/libomptarget/plugins/vgpu/CMakeLists.txt openmp/libomptarget/plugins/vgpu/src/DeviceEnvironment.cpp openmp/libomptarget/plugins/vgpu/src/DeviceEnvironmentImpl.h openmp/libomptarget/plugins/vgpu/src/rtl.cpp openmp/libomptarget/src/rtl.cpp Index: openmp/libomptarget/src/rtl.cpp === --- openmp/libomptarget/src/rtl.cpp +++ openmp/libomptarget/src/rtl.cpp @@ -34,6 +34,7 @@ /* SX-Aurora VE target */ "libomptarget.rtl.ve.so", /* AMDGPU target*/ "libomptarget.rtl.amdgpu.so", /* Remote target*/ "libomptarget.rtl.rpc.so", +/* Virtual GPU target */ "libomptarget.rtl.vgpu.so", }; PluginManager *PM; @@ -83,7 +84,7 @@ // is correct and if they are supporting any devices. for (auto *Name : RTLNames) { DP("Loading library '%s'...\n", Name); -void *dynlib_handle = dlopen(Name, RTLD_NOW); +void *dynlib_handle = dlopen(Name, RTLD_NOW | RTLD_GLOBAL); if (!dynlib_handle) { // Library does not exist or cannot be found. Index: openmp/libomptarget/plugins/vgpu/src/rtl.cpp === --- /dev/null +++ openmp/libomptarget/plugins/vgpu/src/rtl.cpp @@ -0,0 +1,623 @@ +//===--RTLs/vgpu/src/rtl.cpp - Target RTLs Implementation - 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 +// +//===--===// +// +// RTL for virtual (x86) GPU +// +//===--===// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Debug.h" +#include "DeviceEnvironment.h" +#include "DeviceEnvironmentImpl.h" +#include "omptarget.h" +#include "omptargetplugin.h" + +#ifndef TARGET_NAME +#define TARGET_NAME Generic ELF - 64bit +#endif +#define DEBUG_PREFIX "TARGET " GETNAME(TARGET_NAME) " RTL" + +#ifndef TARGET_ELF_ID +#define TARGET_ELF_ID 0 +#endif + +#include "elf_common.h" + +#define NUMBER_OF_DEVICES 1 +#define OFFLOADSECTIONNAME "omp_offloading_entries" + +#define DEBUG false + +/// Array of Dynamic libraries loaded for this target. +struct DynLibTy { + char *FileName; + void *Handle; +}; + +/// Keep entries table per device. +struct FuncOrGblEntryTy { + __tgt_target_table Table; +}; + +thread_local ThreadEnvironmentTy *ThreadEnvironment; + +/// Class containing all the device information. +class RTLDeviceInfoTy { + std::vector> FuncGblEntries; + +public: + std::list DynLibs; + + // Record
[clang] bbab17c - [Clang][Attr] fix a btf_type_attr CGDebugInfo codegen bug
Author: Yonghong Song Date: 2021-11-06T18:19:00-07:00 New Revision: bbab17c6c987d7a6612855c02a4e8988dac0dc17 URL: https://github.com/llvm/llvm-project/commit/bbab17c6c987d7a6612855c02a4e8988dac0dc17 DIFF: https://github.com/llvm/llvm-project/commit/bbab17c6c987d7a6612855c02a4e8988dac0dc17.diff LOG: [Clang][Attr] fix a btf_type_attr CGDebugInfo codegen bug Nathan Chancellor reported a crash due to commit 3466e00716e1 (Reland "[Attr] support btf_type_tag attribute"). The following test can reproduce the crash: $ cat efi.i typedef unsigned long efi_query_variable_info_t(int); typedef struct { struct { efi_query_variable_info_t __attribute__((regparm(0))) * query_variable_info; }; } efi_runtime_services_t; efi_runtime_services_t efi_0; $ clang -m32 -O2 -g -c -o /dev/null efi.i The reason is that FunctionTypeLoc.getParam(Idx) may return a nullptr which should be checked before dereferencing the result pointer. This patch fixed this issue. Added: Modified: clang/lib/CodeGen/CGDebugInfo.cpp Removed: diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 2b9532534e3aa..1ce56f98e1f09 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1446,9 +1446,10 @@ llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty, for (const QualType : FPT->param_types()) { TypeLoc ParamTL; if (Idx < FTL_NumParams) { -ParmVarDecl *Param = FTL.getParam(Idx); -if (const TypeSourceInfo *TSI = Param->getTypeSourceInfo()) - ParamTL = TSI->getTypeLoc(); +if (ParmVarDecl *Param = FTL.getParam(Idx)) { + if (const TypeSourceInfo *TSI = Param->getTypeSourceInfo()) +ParamTL = TSI->getTypeLoc(); +} } EltTys.push_back(getOrCreateType(ParamType, Unit, ParamTL)); Idx++; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D111199: [Clang][LLVM][Attr] support btf_type_tag attribute
On 11/6/21 4:36 PM, Nathan Chancellor via Phabricator wrote: nathanchance added a comment. I bisected a crash in the Linux kernel down to the reland commit (and it is not fixed as of https://github.com/llvm/llvm-project/commit/2249ecee8d9a6237f51485bd39f01ba031575987): $ git bisect log # bad: [bdaa181007a46d317a1665acb8234eddeee82815] [TwoAddressInstructionPass] Update existing physreg live intervals # good: [d4b1cf8f9c48a49ab808df15c4ab378276a07b82] [OpenMP] Build device runtimes for sm_86 git bisect start 'bdaa181007a46d317a1665acb8234eddeee82815' 'd4b1cf8f9c48a49ab808df15c4ab378276a07b82' # good: [f2703c3c3353031de8de8c465a59d31488b11fb3] [DAG] FoldConstantArithmetic - rename NumOps -> NumElts. NFC. git bisect good f2703c3c3353031de8de8c465a59d31488b11fb3 # good: [c68183b81e5257186c9403cf91f8b958af7459bc] [gn build] Use `=` for of -fdebug-compilation-dir git bisect good c68183b81e5257186c9403cf91f8b958af7459bc # bad: [2d8ec3c61d3c2d47b303187bb882ca23544f6fc5] [libcxx] [test] Narrow down XFAILs regarding a MSVC mode specific bug to "windows-dll && msvc" git bisect bad 2d8ec3c61d3c2d47b303187bb882ca23544f6fc5 # good: [97c899f3c5d9bbff2824b3252b21378bf96f3f3f] [mlir] Add callback to provide a pass pipeline to MlirOptMain git bisect good 97c899f3c5d9bbff2824b3252b21378bf96f3f3f # bad: [4070f305f9a0c488d7177754d77c0b367e8695bf] [mlir][DialectConversion] Legalize all live argument conversions git bisect bad 4070f305f9a0c488d7177754d77c0b367e8695bf # bad: [3466e00716e12e32fdb100e3fcfca5c2b3e8d784] Reland "[Attr] support btf_type_tag attribute" git bisect bad 3466e00716e12e32fdb100e3fcfca5c2b3e8d784 # good: [f64580f8d2ce5e1161857f9c89c2eee7a74c5ab8] [AArch64][GISel] Optimize 8 and 16 bit variants of uaddo. git bisect good f64580f8d2ce5e1161857f9c89c2eee7a74c5ab8 # first bad commit: [3466e00716e12e32fdb100e3fcfca5c2b3e8d784] Reland "[Attr] support btf_type_tag attribute" Thanks. I will look at this problem immediately. `cvise` spits out: $ cat efi.i typedef unsigned long efi_query_variable_info_t(int); typedef struct { struct { efi_query_variable_info_t __attribute__((regparm(0))) * query_variable_info; }; } efi_runtime_services_t; efi_runtime_services_t efi_0; $ clang -m32 -O2 -c -o /dev/null efi.i [...] ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D111199: [Clang][LLVM][Attr] support btf_type_tag attribute
nathanchance added a comment. I bisected a crash in the Linux kernel down to the reland commit (and it is not fixed as of https://github.com/llvm/llvm-project/commit/2249ecee8d9a6237f51485bd39f01ba031575987): $ git bisect log # bad: [bdaa181007a46d317a1665acb8234eddeee82815] [TwoAddressInstructionPass] Update existing physreg live intervals # good: [d4b1cf8f9c48a49ab808df15c4ab378276a07b82] [OpenMP] Build device runtimes for sm_86 git bisect start 'bdaa181007a46d317a1665acb8234eddeee82815' 'd4b1cf8f9c48a49ab808df15c4ab378276a07b82' # good: [f2703c3c3353031de8de8c465a59d31488b11fb3] [DAG] FoldConstantArithmetic - rename NumOps -> NumElts. NFC. git bisect good f2703c3c3353031de8de8c465a59d31488b11fb3 # good: [c68183b81e5257186c9403cf91f8b958af7459bc] [gn build] Use `=` for of -fdebug-compilation-dir git bisect good c68183b81e5257186c9403cf91f8b958af7459bc # bad: [2d8ec3c61d3c2d47b303187bb882ca23544f6fc5] [libcxx] [test] Narrow down XFAILs regarding a MSVC mode specific bug to "windows-dll && msvc" git bisect bad 2d8ec3c61d3c2d47b303187bb882ca23544f6fc5 # good: [97c899f3c5d9bbff2824b3252b21378bf96f3f3f] [mlir] Add callback to provide a pass pipeline to MlirOptMain git bisect good 97c899f3c5d9bbff2824b3252b21378bf96f3f3f # bad: [4070f305f9a0c488d7177754d77c0b367e8695bf] [mlir][DialectConversion] Legalize all live argument conversions git bisect bad 4070f305f9a0c488d7177754d77c0b367e8695bf # bad: [3466e00716e12e32fdb100e3fcfca5c2b3e8d784] Reland "[Attr] support btf_type_tag attribute" git bisect bad 3466e00716e12e32fdb100e3fcfca5c2b3e8d784 # good: [f64580f8d2ce5e1161857f9c89c2eee7a74c5ab8] [AArch64][GISel] Optimize 8 and 16 bit variants of uaddo. git bisect good f64580f8d2ce5e1161857f9c89c2eee7a74c5ab8 # first bad commit: [3466e00716e12e32fdb100e3fcfca5c2b3e8d784] Reland "[Attr] support btf_type_tag attribute" `cvise` spits out: $ cat efi.i typedef unsigned long efi_query_variable_info_t(int); typedef struct { struct { efi_query_variable_info_t __attribute__((regparm(0))) * query_variable_info; }; } efi_runtime_services_t; efi_runtime_services_t efi_0; $ clang -m32 -O2 -c -o /dev/null efi.i $ clang -m32 -O2 -g -c -o /dev/null efi.i PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: clang -m32 -O2 -g -c -o /dev/null efi.i 1. parser at end of file #0 0x02b31d13 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2b31d13) #1 0x02b2fb3e llvm::sys::RunSignalHandlers() (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2b2fb3e) #2 0x02ab8d13 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0 #3 0x02ab8e8e CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0 #4 0x7fa9dd533870 __restore_rt sigaction.c:0:0 #5 0x02eaa00e clang::CodeGen::CGDebugInfo::CreateType(clang::FunctionType const*, llvm::DIFile*, clang::TypeLoc) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2eaa00e) #6 0x02ea4598 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*, clang::TypeLoc) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2ea4598) #7 0x02ea7cc4 clang::CodeGen::CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag, clang::Type const*, clang::QualType, llvm::DIFile*, clang::TypeLoc) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2ea7cc4) #8 0x02eb6558 clang::CodeGen::CGDebugInfo::CreateTypeNode(clang::QualType, llvm::DIFile*, clang::TypeLoc) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2eb6558) #9 0x02ea4598 clang::CodeGen::CGDebugInfo::getOrCreateType(clang::QualType, llvm::DIFile*, clang::TypeLoc) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2ea4598) #10 0x02eaa610 clang::CodeGen::CGDebugInfo::createFieldType(llvm::StringRef, clang::QualType, clang::SourceLocation, clang::AccessSpecifier, unsigned long, unsigned int, llvm::DIFile*, llvm::DIScope*, clang::RecordDecl const*, llvm::MDTupleTypedArrayWrapper, clang::TypeLoc) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2eaa610) #11 0x02eab3c0 clang::CodeGen::CGDebugInfo::CollectRecordNormalField(clang::FieldDecl const*, unsigned long, llvm::DIFile*, llvm::SmallVectorImpl&, llvm::DIType*, clang::RecordDecl const*) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2eab3c0) #12 0x02eab90c clang::CodeGen::CGDebugInfo::CollectRecordFields(clang::RecordDecl const*, llvm::DIFile*, llvm::SmallVectorImpl&, llvm::DICompositeType*) (/home/nathan/cbl/src/llvm-project/build/stage1/bin/clang-14+0x2eab90c) #13 0x02eb111a
[PATCH] D113352: [clang] Run LLVM Verifier in modes without CodeGen too
ibookstein updated this revision to Diff 385298. ibookstein added a comment. clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113352/new/ https://reviews.llvm.org/D113352 Files: clang/lib/CodeGen/BackendUtil.cpp Index: clang/lib/CodeGen/BackendUtil.cpp === --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -487,6 +487,11 @@ } } +static bool actionRequiresCodeGen(BackendAction Action) { + return Action != Backend_EmitNothing && Action != Backend_EmitBC && + Action != Backend_EmitLL; +} + static bool initTargetOptions(DiagnosticsEngine , llvm::TargetOptions , const CodeGenOptions , @@ -977,9 +982,7 @@ setCommandLineOpts(CodeGenOpts); - bool UsesCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && - Action != Backend_EmitLL); + bool UsesCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(UsesCodeGen); if (UsesCodeGen && !TM) @@ -1006,6 +1009,10 @@ CreatePasses(PerModulePasses, PerFunctionPasses); + if (!UsesCodeGen && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +PerModulePasses.add(createVerifierPass()); + legacy::PassManager CodeGenPasses; CodeGenPasses.add( createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); @@ -1425,6 +1432,11 @@ MPM.addPass(ModuleMemProfilerPass()); } } + + if (!actionRequiresCodeGen(Action) && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +MPM.addPass(VerifierPass()); + switch (Action) { case Backend_EmitBC: if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { @@ -1514,8 +1526,7 @@ TimeRegion Region(CodeGenOpts.TimePasses ? : nullptr); setCommandLineOpts(CodeGenOpts); - bool RequiresCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && Action != Backend_EmitLL); + bool RequiresCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(RequiresCodeGen); if (RequiresCodeGen && !TM) Index: clang/lib/CodeGen/BackendUtil.cpp === --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -487,6 +487,11 @@ } } +static bool actionRequiresCodeGen(BackendAction Action) { + return Action != Backend_EmitNothing && Action != Backend_EmitBC && + Action != Backend_EmitLL; +} + static bool initTargetOptions(DiagnosticsEngine , llvm::TargetOptions , const CodeGenOptions , @@ -977,9 +982,7 @@ setCommandLineOpts(CodeGenOpts); - bool UsesCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && - Action != Backend_EmitLL); + bool UsesCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(UsesCodeGen); if (UsesCodeGen && !TM) @@ -1006,6 +1009,10 @@ CreatePasses(PerModulePasses, PerFunctionPasses); + if (!UsesCodeGen && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +PerModulePasses.add(createVerifierPass()); + legacy::PassManager CodeGenPasses; CodeGenPasses.add( createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); @@ -1425,6 +1432,11 @@ MPM.addPass(ModuleMemProfilerPass()); } } + + if (!actionRequiresCodeGen(Action) && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +MPM.addPass(VerifierPass()); + switch (Action) { case Backend_EmitBC: if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { @@ -1514,8 +1526,7 @@ TimeRegion Region(CodeGenOpts.TimePasses ? : nullptr); setCommandLineOpts(CodeGenOpts); - bool RequiresCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && Action != Backend_EmitLL); + bool RequiresCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(RequiresCodeGen); if (RequiresCodeGen && !TM) ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113352: [clang] Run LLVM Verifier in modes without CodeGen too
ibookstein created this revision. ibookstein added reviewers: dblaikie, rjmccall. Herald added a subscriber: ormris. ibookstein requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Previously, the Backend_Emit{Nothing,BC,LL} modes did not run the LLVM verifier since it is usually added via the TargetMachine::addPassesToEmitFile method according to the DisableVerify parameter. This is called from EmitAssemblyHelper::AddEmitPasses, which is only relevant for BackendAction-s that require CodeGen. Note: - In these particular situations the verifier is added to the optimization pipeline rather than the codegen pipeline so that it runs prior to the BC/LL emission pass. - This change applies to both the old and the new PMs. - Because the clang tests use -emit-llvm ubiquitously, this change will enable the verifier for them. Signed-off-by: Itay Bookstein Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D113352 Files: clang/lib/CodeGen/BackendUtil.cpp Index: clang/lib/CodeGen/BackendUtil.cpp === --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -487,6 +487,12 @@ } } +static bool actionRequiresCodeGen(BackendAction Action) { + return Action != Backend_EmitNothing && + Action != Backend_EmitBC && + Action != Backend_EmitLL; +} + static bool initTargetOptions(DiagnosticsEngine , llvm::TargetOptions , const CodeGenOptions , @@ -977,9 +983,7 @@ setCommandLineOpts(CodeGenOpts); - bool UsesCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && - Action != Backend_EmitLL); + bool UsesCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(UsesCodeGen); if (UsesCodeGen && !TM) @@ -1006,6 +1010,10 @@ CreatePasses(PerModulePasses, PerFunctionPasses); + if (!UsesCodeGen && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +PerModulePasses.add(createVerifierPass()); + legacy::PassManager CodeGenPasses; CodeGenPasses.add( createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); @@ -1425,6 +1433,11 @@ MPM.addPass(ModuleMemProfilerPass()); } } + + if (!actionRequiresCodeGen(Action) && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +MPM.addPass(VerifierPass()); + switch (Action) { case Backend_EmitBC: if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { @@ -1514,8 +1527,7 @@ TimeRegion Region(CodeGenOpts.TimePasses ? : nullptr); setCommandLineOpts(CodeGenOpts); - bool RequiresCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && Action != Backend_EmitLL); + bool RequiresCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(RequiresCodeGen); if (RequiresCodeGen && !TM) Index: clang/lib/CodeGen/BackendUtil.cpp === --- clang/lib/CodeGen/BackendUtil.cpp +++ clang/lib/CodeGen/BackendUtil.cpp @@ -487,6 +487,12 @@ } } +static bool actionRequiresCodeGen(BackendAction Action) { + return Action != Backend_EmitNothing && + Action != Backend_EmitBC && + Action != Backend_EmitLL; +} + static bool initTargetOptions(DiagnosticsEngine , llvm::TargetOptions , const CodeGenOptions , @@ -977,9 +983,7 @@ setCommandLineOpts(CodeGenOpts); - bool UsesCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && - Action != Backend_EmitLL); + bool UsesCodeGen = actionRequiresCodeGen(Action); CreateTargetMachine(UsesCodeGen); if (UsesCodeGen && !TM) @@ -1006,6 +1010,10 @@ CreatePasses(PerModulePasses, PerFunctionPasses); + if (!UsesCodeGen && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +PerModulePasses.add(createVerifierPass()); + legacy::PassManager CodeGenPasses; CodeGenPasses.add( createTargetTransformInfoWrapperPass(getTargetIRAnalysis())); @@ -1425,6 +1433,11 @@ MPM.addPass(ModuleMemProfilerPass()); } } + + if (!actionRequiresCodeGen(Action) && CodeGenOpts.VerifyModule) +// Add it here so that it runs prior to the BC/LL emission pass +MPM.addPass(VerifierPass()); + switch (Action) { case Backend_EmitBC: if (CodeGenOpts.PrepareForThinLTO && !CodeGenOpts.DisableLLVMPasses) { @@ -1514,8 +1527,7 @@ TimeRegion Region(CodeGenOpts.TimePasses ? : nullptr); setCommandLineOpts(CodeGenOpts); - bool RequiresCodeGen = (Action != Backend_EmitNothing && - Action != Backend_EmitBC && Action != Backend_EmitLL); + bool
[PATCH] D113249: [CUDA] Bump CUDA version to 11.5
carlosgalvezp updated this revision to Diff 385286. carlosgalvezp added a comment. Update release notes CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113249/new/ https://reviews.llvm.org/D113249 Files: clang/include/clang/Basic/BuiltinsNVPTX.def clang/include/clang/Basic/Cuda.h clang/lib/Basic/Cuda.cpp clang/lib/Basic/Targets/NVPTX.cpp clang/lib/Driver/ToolChains/Cuda.cpp llvm/docs/CompileCudaWithLLVM.rst llvm/lib/Target/NVPTX/NVPTX.td Index: llvm/lib/Target/NVPTX/NVPTX.td === --- llvm/lib/Target/NVPTX/NVPTX.td +++ llvm/lib/Target/NVPTX/NVPTX.td @@ -93,6 +93,8 @@ "Use PTX version 7.3">; def PTX74 : SubtargetFeature<"ptx74", "PTXVersion", "74", "Use PTX version 7.4">; +def PTX75 : SubtargetFeature<"ptx75", "PTXVersion", "75", + "Use PTX version 7.5">; //===--===// // NVPTX supported processors. Index: llvm/docs/CompileCudaWithLLVM.rst === --- llvm/docs/CompileCudaWithLLVM.rst +++ llvm/docs/CompileCudaWithLLVM.rst @@ -23,8 +23,8 @@ - CUDA is supported since llvm 3.9. Clang currently supports CUDA 7.0 through -10.1. If clang detects a newer CUDA version, it will issue a warning and will -attempt to use detected CUDA SDK it as if it were CUDA-10.1. +11.5. If clang detects a newer CUDA version, it will issue a warning and will +attempt to use detected CUDA SDK it as if it were CUDA 11.5. Before you build CUDA code, you'll need to have installed the CUDA SDK. See `NVIDIA's CUDA installation guide Index: clang/lib/Driver/ToolChains/Cuda.cpp === --- clang/lib/Driver/ToolChains/Cuda.cpp +++ clang/lib/Driver/ToolChains/Cuda.cpp @@ -65,6 +65,8 @@ return CudaVersion::CUDA_113; if (raw_version < 11050) return CudaVersion::CUDA_114; + if (raw_version < 11060) +return CudaVersion::CUDA_115; return CudaVersion::NEW; } @@ -707,6 +709,7 @@ case CudaVersion::CUDA_##CUDA_VER: \ PtxFeature = "+ptx" #PTX_VER; \ break; +CASE_CUDA_VERSION(115, 75); CASE_CUDA_VERSION(114, 74); CASE_CUDA_VERSION(113, 73); CASE_CUDA_VERSION(112, 72); Index: clang/lib/Basic/Targets/NVPTX.cpp === --- clang/lib/Basic/Targets/NVPTX.cpp +++ clang/lib/Basic/Targets/NVPTX.cpp @@ -44,6 +44,7 @@ if (!Feature.startswith("+ptx")) continue; PTXVersion = llvm::StringSwitch(Feature) + .Case("+ptx75", 75) .Case("+ptx74", 74) .Case("+ptx73", 73) .Case("+ptx72", 72) Index: clang/lib/Basic/Cuda.cpp === --- clang/lib/Basic/Cuda.cpp +++ clang/lib/Basic/Cuda.cpp @@ -40,6 +40,8 @@ return "11.3"; case CudaVersion::CUDA_114: return "11.4"; + case CudaVersion::CUDA_115: +return "11.5"; case CudaVersion::NEW: return ""; } @@ -62,6 +64,7 @@ .Case("11.2", CudaVersion::CUDA_112) .Case("11.3", CudaVersion::CUDA_113) .Case("11.4", CudaVersion::CUDA_114) + .Case("11.5", CudaVersion::CUDA_115) .Default(CudaVersion::UNKNOWN); } @@ -241,6 +244,8 @@ return CudaVersion::CUDA_113; case 114: return CudaVersion::CUDA_114; + case 115: +return CudaVersion::CUDA_115; default: return CudaVersion::UNKNOWN; } Index: clang/include/clang/Basic/Cuda.h === --- clang/include/clang/Basic/Cuda.h +++ clang/include/clang/Basic/Cuda.h @@ -33,9 +33,10 @@ CUDA_112, CUDA_113, CUDA_114, - FULLY_SUPPORTED = CUDA_114, + CUDA_115, + FULLY_SUPPORTED = CUDA_115, PARTIALLY_SUPPORTED = - CUDA_114, // Partially supported. Proceed with a warning. + CUDA_115, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); Index: clang/include/clang/Basic/BuiltinsNVPTX.def === --- clang/include/clang/Basic/BuiltinsNVPTX.def +++ clang/include/clang/Basic/BuiltinsNVPTX.def @@ -41,7 +41,9 @@ #pragma push_macro("PTX72") #pragma push_macro("PTX73") #pragma push_macro("PTX74") -#define PTX74 "ptx74" +#pragma push_macro("PTX75") +#define PTX75 "ptx75" +#define PTX74 "ptx74|" PTX75 #define PTX73 "ptx73|" PTX74 #define PTX72 "ptx72|" PTX73 #define PTX71 "ptx71|" PTX72 @@ -827,3 +829,4 @@ #pragma pop_macro("PTX72") #pragma pop_macro("PTX73") #pragma pop_macro("PTX74") +#pragma pop_macro("PTX75")
[PATCH] D113249: [CUDA] Bump CUDA version to 11.5
carlosgalvezp added a comment. > - The driver needs to enable ptx75 when it constructs cc1 command line in > clang/lib/Driver/ToolChains/Cuda.cpp @tra Haven't I already done it in line 712? Or where should I enable it? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113249/new/ https://reviews.llvm.org/D113249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113249: [CUDA] Bump CUDA version to 11.5
carlosgalvezp updated this revision to Diff 385284. carlosgalvezp added a comment. Updated BuilintsNVPTX.def CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113249/new/ https://reviews.llvm.org/D113249 Files: clang/include/clang/Basic/BuiltinsNVPTX.def clang/include/clang/Basic/Cuda.h clang/lib/Basic/Cuda.cpp clang/lib/Basic/Targets/NVPTX.cpp clang/lib/Driver/ToolChains/Cuda.cpp llvm/docs/CompileCudaWithLLVM.rst llvm/lib/Target/NVPTX/NVPTX.td Index: llvm/lib/Target/NVPTX/NVPTX.td === --- llvm/lib/Target/NVPTX/NVPTX.td +++ llvm/lib/Target/NVPTX/NVPTX.td @@ -93,6 +93,8 @@ "Use PTX version 7.3">; def PTX74 : SubtargetFeature<"ptx74", "PTXVersion", "74", "Use PTX version 7.4">; +def PTX75 : SubtargetFeature<"ptx75", "PTXVersion", "75", + "Use PTX version 7.5">; //===--===// // NVPTX supported processors. Index: llvm/docs/CompileCudaWithLLVM.rst === --- llvm/docs/CompileCudaWithLLVM.rst +++ llvm/docs/CompileCudaWithLLVM.rst @@ -23,8 +23,8 @@ - CUDA is supported since llvm 3.9. Clang currently supports CUDA 7.0 through -10.1. If clang detects a newer CUDA version, it will issue a warning and will -attempt to use detected CUDA SDK it as if it were CUDA-10.1. +11.5. If clang detects a newer CUDA version, it will issue a warning and will +attempt to use detected CUDA SDK it as if it were CUDA 11.5. Before you build CUDA code, you'll need to have installed the CUDA SDK. See `NVIDIA's CUDA installation guide Index: clang/lib/Driver/ToolChains/Cuda.cpp === --- clang/lib/Driver/ToolChains/Cuda.cpp +++ clang/lib/Driver/ToolChains/Cuda.cpp @@ -65,6 +65,8 @@ return CudaVersion::CUDA_113; if (raw_version < 11050) return CudaVersion::CUDA_114; + if (raw_version < 11060) +return CudaVersion::CUDA_115; return CudaVersion::NEW; } @@ -707,6 +709,7 @@ case CudaVersion::CUDA_##CUDA_VER: \ PtxFeature = "+ptx" #PTX_VER; \ break; +CASE_CUDA_VERSION(115, 75); CASE_CUDA_VERSION(114, 74); CASE_CUDA_VERSION(113, 73); CASE_CUDA_VERSION(112, 72); Index: clang/lib/Basic/Targets/NVPTX.cpp === --- clang/lib/Basic/Targets/NVPTX.cpp +++ clang/lib/Basic/Targets/NVPTX.cpp @@ -44,6 +44,7 @@ if (!Feature.startswith("+ptx")) continue; PTXVersion = llvm::StringSwitch(Feature) + .Case("+ptx75", 75) .Case("+ptx74", 74) .Case("+ptx73", 73) .Case("+ptx72", 72) Index: clang/lib/Basic/Cuda.cpp === --- clang/lib/Basic/Cuda.cpp +++ clang/lib/Basic/Cuda.cpp @@ -40,6 +40,8 @@ return "11.3"; case CudaVersion::CUDA_114: return "11.4"; + case CudaVersion::CUDA_115: +return "11.5"; case CudaVersion::NEW: return ""; } @@ -62,6 +64,7 @@ .Case("11.2", CudaVersion::CUDA_112) .Case("11.3", CudaVersion::CUDA_113) .Case("11.4", CudaVersion::CUDA_114) + .Case("11.5", CudaVersion::CUDA_115) .Default(CudaVersion::UNKNOWN); } @@ -241,6 +244,8 @@ return CudaVersion::CUDA_113; case 114: return CudaVersion::CUDA_114; + case 115: +return CudaVersion::CUDA_115; default: return CudaVersion::UNKNOWN; } Index: clang/include/clang/Basic/Cuda.h === --- clang/include/clang/Basic/Cuda.h +++ clang/include/clang/Basic/Cuda.h @@ -33,9 +33,10 @@ CUDA_112, CUDA_113, CUDA_114, - FULLY_SUPPORTED = CUDA_114, + CUDA_115, + FULLY_SUPPORTED = CUDA_115, PARTIALLY_SUPPORTED = - CUDA_114, // Partially supported. Proceed with a warning. + CUDA_115, // Partially supported. Proceed with a warning. NEW = 1, // Too new. Issue a warning, but allow using it. }; const char *CudaVersionToString(CudaVersion V); Index: clang/include/clang/Basic/BuiltinsNVPTX.def === --- clang/include/clang/Basic/BuiltinsNVPTX.def +++ clang/include/clang/Basic/BuiltinsNVPTX.def @@ -41,7 +41,9 @@ #pragma push_macro("PTX72") #pragma push_macro("PTX73") #pragma push_macro("PTX74") -#define PTX74 "ptx74" +#pragma push_macro("PTX75") +#define PTX75 "ptx75" +#define PTX74 "ptx74|" PTX75 #define PTX73 "ptx73|" PTX74 #define PTX72 "ptx72|" PTX73 #define PTX71 "ptx71|" PTX72 @@ -827,3 +829,4 @@ #pragma pop_macro("PTX72") #pragma pop_macro("PTX73") #pragma pop_macro("PTX74") +#pragma pop_macro("PTX75")
[PATCH] D111434: [PowerPC] PPC backend optimization on conditional trap intrustions
NeHuang updated this revision to Diff 385282. NeHuang marked 3 inline comments as done. NeHuang added a comment. Address review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D111434/new/ https://reviews.llvm.org/D111434 Files: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir Index: llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir === --- /dev/null +++ llvm/test/CodeGen/PowerPC/mi-peepholes-trap-opt.mir @@ -0,0 +1,448 @@ +# RUN: llc -mtriple powerpc64le-unknown-linux-gnu -mcpu=pwr8 -x mir < %s \ +# RUN: -verify-machineinstrs -start-before=ppc-mi-peepholes | FileCheck %s + +--- +name:conditional_trap_opt_reg_implicit_def +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = IMPLICIT_DEF +%1:gprc = IMPLICIT_DEF +%2:g8rc = IMPLICIT_DEF +%3:g8rc = IMPLICIT_DEF +TW 8, %0, %1 +TD 8, %2, %3 +TWI 24, %0, 0 +TDI 24, %2, 0 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_reg_implicit_def + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: twgt3, 3 + # CHECK-NEXT: tdgt3, 3 + # CHECK-NEXT: twnei 3, 0 + # CHECK-NEXT: tdnei 3, 0 + # CHECK-NEXT: blr +--- +name:conditional_trap_opt_TW_31 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI 3 +%1:gprc = LI 0 +TW 31, %1, %0 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TW_31 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TW_16 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI 5 +%1:gprc = LI 1 +TW 16, %1, %0 +TW 16, %0, %1 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TW_16 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TW_8 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI -1 +%1:gprc = LI 10 +TW 8, %1, %0 +TW 8, %0, %1 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TW_8 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TW_2 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI -1 +%1:gprc = LI 2 +TW 2, %1, %0 +TW 2, %0, %1 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TW_2 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TW_1 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI -3 +%1:gprc = LI 4 +TW 1, %1, %0 +TW 1, %0, %1 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TW_1 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TW_4 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI 5 +%1:gprc = LI 1 +TW 4, %1, %0 +TW 4, %1, %1 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TW_4 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TWI_31 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI 3 +TWI 31, %0, 0 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TWI_31 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TWI_16 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI 5 +%1:gprc = LI 1 +TWI 16, %1, 5 +TWI 16, %0, 1 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TWI_16 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TWI_8 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI -1 +%1:gprc = LI 10 +TWI 8, %1, -1 +TWI 8, %0, 10 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TWI_8 + # CHECK: # %bb.0: # %entry + # CHECK-NEXT: trap + # CHECK-NEXT: blr + +--- +name:conditional_trap_opt_TWI_2 +alignment: 16 +tracksRegLiveness: true +body: | + bb.0.entry: +%0:gprc = LI -1 +%1:gprc = LI 2 +TWI 2, %1, -1 +TWI 2, %0, 2 +BLR8 implicit $lr8, implicit $rm +... + # CHECK-LABEL: conditional_trap_opt_TWI_2 + # CHECK: # %bb.0: #
[PATCH] D80804: [AMDGPU] Introduce Clang builtins to be mapped to AMDGCN atomic inc/dec intrinsics
RKSimon added inline comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:14563 -if (isa(Order)) { - int ord = cast(Order)->getZExtValue(); +switch (BuiltinID) { +case AMDGPU::BI__builtin_amdgcn_atomic_inc32: @saiislam @arsenm Coverity is warning that the BI__builtin_amdgcn_fence (fallthrough case) is not handled meaning that BuiltinAtomicOp in uninitialized Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D80804/new/ https://reviews.llvm.org/D80804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D109215: [RISCV] Fix arch string parsing for multi-character extensions
asb accepted this revision. asb added a comment. This revision is now accepted and ready to land. This seems to match the emerging consensus in the various RISC-V GitHub issue threads and as you point out, is needed to support extensions in the 1.0 V spec. Looks good to me - thanks! Comment at: clang/test/Driver/riscv-arch.c:395 // RUN: -fsyntax-only 2>&1 | FileCheck -check-prefix=RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE %s -// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbp0p93', multi-character extensions must be separated by underscores +// RV32-EXPERIMENTAL-ZBB-ZBP-UNDERSCORE: error: invalid arch name 'rv32izbb1p0zbp0p93', unsupported version number 0.93 for extension 'zbb1p0zbp' This does highlight that the error reporting is picking the wrong thing to complain about it - it would be better to complain that 'zbb1p0zbp1 is an unrecognised extension. Though I don't think this is an issue introduced by your patch. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109215/new/ https://reviews.llvm.org/D109215 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D112613: [RISCV] Change TARGET_BUILTIN require to zve32x for vector instruction
eopXD marked an inline comment as done. eopXD added inline comments. Comment at: clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vaadd.c:3 // REQUIRES: riscv-registered-target -// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-zve32x -target-feature +experimental-zve64x -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s eopXD wrote: > craig.topper wrote: > > Why do we need to add zve32x and zve64x to the command line? Doesn't zve64x > > imply zve32x? > Just added D113336 to resolve this. I will rebase this patch and change test > cases. Rebased. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112613/new/ https://reviews.llvm.org/D112613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D112613: [RISCV] Change TARGET_BUILTIN require to zve32x for vector instruction
eopXD updated this revision to Diff 385278. eopXD added a comment. Update code. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112613/new/ https://reviews.llvm.org/D112613 Files: clang/utils/TableGen/RISCVVEmitter.cpp Index: clang/utils/TableGen/RISCVVEmitter.cpp === --- clang/utils/TableGen/RISCVVEmitter.cpp +++ clang/utils/TableGen/RISCVVEmitter.cpp @@ -1021,7 +1021,7 @@ OS << "#if defined(TARGET_BUILTIN) && !defined(RISCVV_BUILTIN)\n"; OS << "#define RISCVV_BUILTIN(ID, TYPE, ATTRS) TARGET_BUILTIN(ID, TYPE, " -"ATTRS, \"experimental-v\")\n"; +"ATTRS, \"experimental-zve32x\")\n"; OS << "#endif\n"; for (auto : Defs) { auto P = Index: clang/utils/TableGen/RISCVVEmitter.cpp === --- clang/utils/TableGen/RISCVVEmitter.cpp +++ clang/utils/TableGen/RISCVVEmitter.cpp @@ -1021,7 +1021,7 @@ OS << "#if defined(TARGET_BUILTIN) && !defined(RISCVV_BUILTIN)\n"; OS << "#define RISCVV_BUILTIN(ID, TYPE, ATTRS) TARGET_BUILTIN(ID, TYPE, " -"ATTRS, \"experimental-v\")\n"; +"ATTRS, \"experimental-zve32x\")\n"; OS << "#endif\n"; for (auto : Defs) { auto P = ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113336: [RISCV] Let clang_cc1 be able to imply features
eopXD updated this revision to Diff 385277. eopXD added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113336/new/ https://reviews.llvm.org/D113336 Files: clang/lib/Basic/Targets/RISCV.cpp llvm/include/llvm/Support/RISCVISAInfo.h llvm/lib/Support/RISCVISAInfo.cpp Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D112613: [RISCV] Change TARGET_BUILTIN require to zve32x for vector instruction
eopXD updated this revision to Diff 385276. eopXD added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112613/new/ https://reviews.llvm.org/D112613 Files: clang/lib/Basic/Targets/RISCV.cpp clang/utils/TableGen/RISCVVEmitter.cpp llvm/include/llvm/Support/RISCVISAInfo.h llvm/lib/Support/RISCVISAInfo.cpp Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/utils/TableGen/RISCVVEmitter.cpp === --- clang/utils/TableGen/RISCVVEmitter.cpp +++ clang/utils/TableGen/RISCVVEmitter.cpp @@ -1021,7 +1021,7 @@ OS << "#if defined(TARGET_BUILTIN) && !defined(RISCVV_BUILTIN)\n"; OS << "#define RISCVV_BUILTIN(ID, TYPE, ATTRS) TARGET_BUILTIN(ID, TYPE, " -"ATTRS, \"experimental-v\")\n"; +"ATTRS, \"experimental-zve32x\")\n"; OS << "#endif\n"; for (auto : Defs) { auto P = Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/utils/TableGen/RISCVVEmitter.cpp === --- clang/utils/TableGen/RISCVVEmitter.cpp +++ clang/utils/TableGen/RISCVVEmitter.cpp @@ -1021,7 +1021,7 @@ OS << "#if defined(TARGET_BUILTIN) && !defined(RISCVV_BUILTIN)\n"; OS << "#define RISCVV_BUILTIN(ID, TYPE, ATTRS) TARGET_BUILTIN(ID, TYPE, " -"ATTRS, \"experimental-v\")\n"; +"ATTRS, \"experimental-zve32x\")\n"; OS << "#endif\n"; for (auto : Defs) { auto P = Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if
[PATCH] D113336: [RISCV] Let clang_cc1 be able to imply features
eopXD updated this revision to Diff 385275. eopXD added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113336/new/ https://reviews.llvm.org/D113336 Files: clang/lib/Basic/Targets/RISCV.cpp llvm/include/llvm/Support/RISCVISAInfo.h llvm/lib/Support/RISCVISAInfo.cpp Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 63fff0f - Fix lit test failures in CodeGenCoroutines
Author: hyeongyu kim Date: 2021-11-06T19:58:34+09:00 New Revision: 63fff0f5bffe20fa2c84a45a41161afa0043cb34 URL: https://github.com/llvm/llvm-project/commit/63fff0f5bffe20fa2c84a45a41161afa0043cb34 DIFF: https://github.com/llvm/llvm-project/commit/63fff0f5bffe20fa2c84a45a41161afa0043cb34.diff LOG: Fix lit test failures in CodeGenCoroutines Added: Modified: clang/test/CodeGenCoroutines/coro-await.cpp clang/test/CodeGenCoroutines/coro-ret-void.cpp clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp Removed: diff --git a/clang/test/CodeGenCoroutines/coro-await.cpp b/clang/test/CodeGenCoroutines/coro-await.cpp index c16f9a034025..767b3bbaf212 100644 --- a/clang/test/CodeGenCoroutines/coro-await.cpp +++ b/clang/test/CodeGenCoroutines/coro-await.cpp @@ -1,8 +1,4 @@ -<<< HEAD -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \ -=== -// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 \ ->>> 8ca4b3ef19fe ([Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default (2)) +// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu -std=c++20 \ // RUN: -emit-llvm %s -o - -disable-llvm-passes -Wno-coroutine -Wno-unused | FileCheck %s namespace std { diff --git a/clang/test/CodeGenCoroutines/coro-ret-void.cpp b/clang/test/CodeGenCoroutines/coro-ret-void.cpp index 0738790fa845..ea4e28ac98f4 100644 --- a/clang/test/CodeGenCoroutines/coro-ret-void.cpp +++ b/clang/test/CodeGenCoroutines/coro-ret-void.cpp @@ -47,10 +47,5 @@ coro2 g() { } // CHECK-LABEL: define{{.*}} void @_Z1gv( -<<< HEAD // CHECK: call void @_ZNSt13suspend_never12await_resumeEv(%"struct.std::suspend_never"* -// CHECK: call void @_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* {{[^,]*}} %__promise, i32 42) -=== -// CHECK: call void @_ZNSt12experimental13coroutines_v113suspend_never12await_resumeEv(%"struct.std::experimental::coroutines_v1::suspend_never"* // CHECK: call void @_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* {{[^,]*}} %__promise, i32 noundef 42) ->>> 8ca4b3ef19fe ([Clang/Test]: Rename enable_noundef_analysis to disable-noundef-analysis and turn it off by default (2)) diff --git a/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp b/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp index 1b6f8ad2a161..5dd614595424 100644 --- a/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp +++ b/clang/test/CodeGenCoroutines/coro-symmetric-transfer-01-exp-namespace.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -O0 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s -// RUN: %clang -fcoroutines-ts -std=c++14 -O0 -emit-llvm -c %s -o %t -Xclang -disable-llvm-passes && %clang -c %t +// RUN: %clang_cc1 -disable-noundef-analysis -triple x86_64-unknown-linux-gnu -fcoroutines-ts -std=c++14 -O0 -emit-llvm %s -o - -disable-llvm-passes | FileCheck %s +// RUN: %clang -disable-noundef-analysis -fcoroutines-ts -std=c++14 -O0 -emit-llvm -c %s -o %t -Xclang -disable-llvm-passes && %clang -c %t #include "Inputs/coroutine-exp-namespace.h" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113336: [RISCV] Let clang_cc1 be able to imply features
eopXD updated this revision to Diff 385258. eopXD added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113336/new/ https://reviews.llvm.org/D113336 Files: clang/lib/Basic/Targets/RISCV.cpp llvm/include/llvm/Support/RISCVISAInfo.h llvm/lib/Support/RISCVISAInfo.cpp Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -846,3 +846,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113336: [RISCV] Let clang_cc1 be able to imply features
eopXD updated this revision to Diff 385256. eopXD added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113336/new/ https://reviews.llvm.org/D113336 Files: clang/lib/Basic/Targets/RISCV.cpp llvm/include/llvm/Support/RISCVISAInfo.h llvm/lib/Support/RISCVISAInfo.cpp Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -826,3 +826,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -826,3 +826,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -67,6 +67,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -217,7 +217,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113320: [clang-format] Address fixme
HazardyKnusperkeks updated this revision to Diff 385248. HazardyKnusperkeks marked an inline comment as done. HazardyKnusperkeks added a reviewer: owenpan. HazardyKnusperkeks added a comment. Dropped braces. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113320/new/ https://reviews.llvm.org/D113320 Files: clang/lib/Format/TokenAnnotator.h clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Format/UnwrappedLineParser.h Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3056,24 +3056,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; - } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I = Node.Children.begin(), - E = Node.Children.end(); - I != E; ++I) { - printDebugInfo(*I, "\nChild: "); -} + for (const auto : Line.Tokens) { +llvm::dbgs() << Node.Tok->Tok.getName() << "[" + << "T=" << static_cast(Node.Tok->getType()) + << ", OC=" << Node.Tok->OriginalColumn << "] "; } + for (const auto : Line.Tokens) +for (const auto : Node.Children) + printDebugInfo(ChildNode, "\nChild: "); + llvm::dbgs() << "\n"; } Index: clang/lib/Format/TokenAnnotator.h === --- clang/lib/Format/TokenAnnotator.h +++ clang/lib/Format/TokenAnnotator.h @@ -53,9 +53,7 @@ // left them in a different state. First->Previous = nullptr; FormatToken *Current = First; -for (std::list::const_iterator I = ++Line.Tokens.begin(), - E = Line.Tokens.end(); - I != E; ++I) { +for (auto I = ++Line.Tokens.begin(), E = Line.Tokens.end(); I != E; ++I) { const UnwrappedLineNode = *I; Current->Next = I->Tok; I->Tok->Previous = Current; Index: clang/lib/Format/UnwrappedLineParser.h === --- clang/lib/Format/UnwrappedLineParser.h +++ clang/lib/Format/UnwrappedLineParser.h @@ -19,8 +19,8 @@ #include "clang/Basic/IdentifierTable.h" #include "clang/Format/Format.h" #include "llvm/Support/Regex.h" -#include #include +#include namespace clang { namespace format { @@ -36,9 +36,8 @@ struct UnwrappedLine { UnwrappedLine(); - // FIXME: Don't use std::list here. /// The \c Tokens comprising this \c UnwrappedLine. - std::list Tokens; + std::vector Tokens; /// The indent level of the \c UnwrappedLine. unsigned Level; Index: clang/lib/Format/UnwrappedLineParser.cpp === --- clang/lib/Format/UnwrappedLineParser.cpp +++ clang/lib/Format/UnwrappedLineParser.cpp @@ -3056,24 +3056,15 @@ llvm::dbgs() << Prefix << "Line(" << Line.Level << ", FSC=" << Line.FirstStartColumn << ")" << (Line.InPPDirective ? " MACRO" : "") << ": "; - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -llvm::dbgs() << I->Tok->Tok.getName() << "[" - << "T=" << (unsigned)I->Tok->getType() - << ", OC=" << I->Tok->OriginalColumn << "] "; - } - for (std::list::const_iterator I = Line.Tokens.begin(), -E = Line.Tokens.end(); - I != E; ++I) { -const UnwrappedLineNode = *I; -for (SmallVectorImpl::const_iterator - I =
[PATCH] D112613: [RISCV] Change TARGET_BUILTIN require to zve32x for vector instruction
eopXD added inline comments. Comment at: clang/test/CodeGen/RISCV/rvv-intrinsics-overloaded/vaadd.c:3 // REQUIRES: riscv-registered-target -// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-v -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s +// RUN: %clang_cc1 -triple riscv64 -target-feature +experimental-zve32x -target-feature +experimental-zve64x -disable-O0-optnone -emit-llvm %s -o - | opt -S -mem2reg | FileCheck --check-prefix=CHECK-RV64 %s craig.topper wrote: > Why do we need to add zve32x and zve64x to the command line? Doesn't zve64x > imply zve32x? Just added D113336 to resolve this. I will rebase this patch and change test cases. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112613/new/ https://reviews.llvm.org/D112613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113336: [Clang][RISCV] Let clang_cc1 be able to imply feautes
eopXD created this revision. eopXD added a reviewer: craig.topper. Herald added subscribers: VincentWu, luke957, achieveartificialintelligence, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya. eopXD requested review of this revision. Herald added subscribers: llvm-commits, cfe-commits, MaskRay. Herald added projects: clang, LLVM. Under ASTContext, clang only copies the features from the options with Target->initFeatureMap, and no implications is done there. Add implication using RISCVISAInfo. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D113336 Files: clang/lib/Basic/Targets/RISCV.cpp llvm/include/llvm/Support/RISCVISAInfo.h llvm/lib/Support/RISCVISAInfo.cpp Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -796,3 +796,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -65,6 +65,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -212,7 +212,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +Diags.Report(diag::err_invalid_feature_combination) << OutputErrMsg.str(); +return false; + } + + return TargetInfo::initFeatureMap(Features, Diags, CPU, +(*ParseResult)->toFeatureVector()); } /// Return true if has this feature, need to sync with handleTargetFeatures. Index: llvm/lib/Support/RISCVISAInfo.cpp === --- llvm/lib/Support/RISCVISAInfo.cpp +++ llvm/lib/Support/RISCVISAInfo.cpp @@ -796,3 +796,17 @@ return Arch.str(); } + +std::vector RISCVISAInfo::toFeatureVector() const { + std::vector FeatureVector; + for (auto Ext : Exts) { +std::string ExtName = Ext.first; +if (ExtName == "i") // i is not recognized in clang -cc1 + continue; +std::string Feature = isExperimentalExtension(ExtName) + ? "+experimental-" + ExtName + : "+" + ExtName; +FeatureVector.push_back(Feature); + } + return FeatureVector; +} Index: llvm/include/llvm/Support/RISCVISAInfo.h === --- llvm/include/llvm/Support/RISCVISAInfo.h +++ llvm/include/llvm/Support/RISCVISAInfo.h @@ -65,6 +65,7 @@ bool hasExtension(StringRef Ext) const; std::string toString() const; + std::vector toFeatureVector() const; static bool isSupportedExtensionFeature(StringRef Ext); static bool isSupportedExtension(StringRef Ext); Index: clang/lib/Basic/Targets/RISCV.cpp === --- clang/lib/Basic/Targets/RISCV.cpp +++ clang/lib/Basic/Targets/RISCV.cpp @@ -212,7 +212,20 @@ if (getTriple().getArch() == llvm::Triple::riscv64) Features["64bit"] = true; - return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec); + unsigned XLen = Features["64bit"] ? 64 : 32; + auto ParseResult = llvm::RISCVISAInfo::parseFeatures(XLen, FeaturesVec); + if (!ParseResult) { +std::string Buffer; +llvm::raw_string_ostream OutputErrMsg(Buffer); +handleAllErrors(ParseResult.takeError(), [&](llvm::StringError ) { + OutputErrMsg << ErrMsg.getMessage(); +}); +
[PATCH] D108482: [Clang] Fix instantiation of OpaqueValueExprs (Bug #45964)
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rGb5aef90d4656: [Clang] Fix instantiation of OpaqueValueExprs (Bug #45964) (authored by ricejasonf, committed by tambre). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D108482/new/ https://reviews.llvm.org/D108482 Files: clang/lib/Sema/TreeTransform.h clang/test/CodeGenCXX/pr45964-decomp-transform.cpp Index: clang/test/CodeGenCXX/pr45964-decomp-transform.cpp === --- /dev/null +++ clang/test/CodeGenCXX/pr45964-decomp-transform.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s + +int a[1]; +// CHECK: @a = global [1 x i32] zeroinitializer +template +void test_transform() { + auto [b] = a; +} +void (*d)(){test_transform<0>}; +// CHECK-LABEL: define {{.*}} @_Z14test_transformILi0EEvv +// CHECK: [[ENTRY:.*]]: +// CHECK-NEXT: [[ARR:%.*]] = alloca [1 x i32] +// CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* [[ARR]], i64 0, i64 0 +// CHECK-NEXT: br label %[[BODY:.*]] +// CHECK-EMPTY: +// CHECK-NEXT: [[BODY]]: +// CHECK-NEXT: [[CUR:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[BODY]] ] +// CHECK-NEXT: [[DEST:%.*]] = getelementptr inbounds i32, i32* [[BEGIN]], i64 [[CUR]] +// CHECK-NEXT: [[SRC:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* @a, i64 0, i64 [[CUR]] +// CHECK-NEXT: [[X:%.*]] = load i32, i32* [[SRC]] +// CHECK-NEXT: store i32 [[X]], i32* [[DEST]] +// CHECK-NEXT: [[NEXT]] = add nuw i64 [[CUR]], 1 +// CHECK-NEXT: [[EQ:%.*]] = icmp eq i64 [[NEXT]], 1 +// CHECK-NEXT: br i1 [[EQ]], label %[[FIN:.*]], label %[[BODY]] +// CHECK-EMPTY: +// CHECK-NEXT: [[FIN]]: +// CHECK-NEXT: ret void Index: clang/lib/Sema/TreeTransform.h === --- clang/lib/Sema/TreeTransform.h +++ clang/lib/Sema/TreeTransform.h @@ -3853,8 +3853,10 @@ if (auto *FE = dyn_cast(Init)) Init = FE->getSubExpr(); - if (auto *AIL = dyn_cast(Init)) -Init = AIL->getCommonExpr(); + if (auto *AIL = dyn_cast(Init)) { +OpaqueValueExpr *OVE = AIL->getCommonExpr(); +Init = OVE->getSourceExpr(); + } if (MaterializeTemporaryExpr *MTE = dyn_cast(Init)) Init = MTE->getSubExpr(); Index: clang/test/CodeGenCXX/pr45964-decomp-transform.cpp === --- /dev/null +++ clang/test/CodeGenCXX/pr45964-decomp-transform.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s + +int a[1]; +// CHECK: @a = global [1 x i32] zeroinitializer +template +void test_transform() { + auto [b] = a; +} +void (*d)(){test_transform<0>}; +// CHECK-LABEL: define {{.*}} @_Z14test_transformILi0EEvv +// CHECK: [[ENTRY:.*]]: +// CHECK-NEXT: [[ARR:%.*]] = alloca [1 x i32] +// CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* [[ARR]], i64 0, i64 0 +// CHECK-NEXT: br label %[[BODY:.*]] +// CHECK-EMPTY: +// CHECK-NEXT: [[BODY]]: +// CHECK-NEXT: [[CUR:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[BODY]] ] +// CHECK-NEXT: [[DEST:%.*]] = getelementptr inbounds i32, i32* [[BEGIN]], i64 [[CUR]] +// CHECK-NEXT: [[SRC:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* @a, i64 0, i64 [[CUR]] +// CHECK-NEXT: [[X:%.*]] = load i32, i32* [[SRC]] +// CHECK-NEXT: store i32 [[X]], i32* [[DEST]] +// CHECK-NEXT: [[NEXT]] = add nuw i64 [[CUR]], 1 +// CHECK-NEXT: [[EQ:%.*]] = icmp eq i64 [[NEXT]], 1 +// CHECK-NEXT: br i1 [[EQ]], label %[[FIN:.*]], label %[[BODY]] +// CHECK-EMPTY: +// CHECK-NEXT: [[FIN]]: +// CHECK-NEXT: ret void Index: clang/lib/Sema/TreeTransform.h === --- clang/lib/Sema/TreeTransform.h +++ clang/lib/Sema/TreeTransform.h @@ -3853,8 +3853,10 @@ if (auto *FE = dyn_cast(Init)) Init = FE->getSubExpr(); - if (auto *AIL = dyn_cast(Init)) -Init = AIL->getCommonExpr(); + if (auto *AIL = dyn_cast(Init)) { +OpaqueValueExpr *OVE = AIL->getCommonExpr(); +Init = OVE->getSourceExpr(); + } if (MaterializeTemporaryExpr *MTE = dyn_cast(Init)) Init = MTE->getSubExpr(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] b5aef90 - [Clang] Fix instantiation of OpaqueValueExprs (Bug #45964)
Author: Jason Rice Date: 2021-11-06T10:06:38+02:00 New Revision: b5aef90d4656c5188759d03e2c5c3dc3d8bb398b URL: https://github.com/llvm/llvm-project/commit/b5aef90d4656c5188759d03e2c5c3dc3d8bb398b DIFF: https://github.com/llvm/llvm-project/commit/b5aef90d4656c5188759d03e2c5c3dc3d8bb398b.diff LOG: [Clang] Fix instantiation of OpaqueValueExprs (Bug #45964) The structured bindings decomposition of a non-dependent array in a dependent context (a template) were, upon instantiation, creating nested OpaqueValueExprs that would trigger assertions in CodeGen. Additionally the OpaqueValuesExpr's contained SourceExpr is being emitted in CodeGen, but there was no code for its transform in template instantiation. This would trigger other assertions such as when emitting a DeclRefExpr that refers to a VarDecl that is not marked as ODR-used. This is all based on cursory deduction, but with the way the code flows from SemaTemplateInstantiate back to SemaInit, it is apparent that the nesting of OpaqueValueExpr is unintentional. This commit fixes https://bugs.llvm.org/show_bug.cgi?id=45964 and possible other issues involving OpaqueValueExprs in template instantiations might be resolved. Reviewed By: aaron.ballman, rjmccall Differential Revision: https://reviews.llvm.org/D108482 Added: clang/test/CodeGenCXX/pr45964-decomp-transform.cpp Modified: clang/lib/Sema/TreeTransform.h Removed: diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index ad61a6782976e..3f0f21b2e6e73 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -3853,8 +3853,10 @@ ExprResult TreeTransform::TransformInitializer(Expr *Init, if (auto *FE = dyn_cast(Init)) Init = FE->getSubExpr(); - if (auto *AIL = dyn_cast(Init)) -Init = AIL->getCommonExpr(); + if (auto *AIL = dyn_cast(Init)) { +OpaqueValueExpr *OVE = AIL->getCommonExpr(); +Init = OVE->getSourceExpr(); + } if (MaterializeTemporaryExpr *MTE = dyn_cast(Init)) Init = MTE->getSubExpr(); diff --git a/clang/test/CodeGenCXX/pr45964-decomp-transform.cpp b/clang/test/CodeGenCXX/pr45964-decomp-transform.cpp new file mode 100644 index 0..927624ca6e370 --- /dev/null +++ b/clang/test/CodeGenCXX/pr45964-decomp-transform.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s + +int a[1]; +// CHECK: @a = global [1 x i32] zeroinitializer +template +void test_transform() { + auto [b] = a; +} +void (*d)(){test_transform<0>}; +// CHECK-LABEL: define {{.*}} @_Z14test_transformILi0EEvv +// CHECK: [[ENTRY:.*]]: +// CHECK-NEXT: [[ARR:%.*]] = alloca [1 x i32] +// CHECK-NEXT: [[BEGIN:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* [[ARR]], i64 0, i64 0 +// CHECK-NEXT: br label %[[BODY:.*]] +// CHECK-EMPTY: +// CHECK-NEXT: [[BODY]]: +// CHECK-NEXT: [[CUR:%.*]] = phi i64 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[BODY]] ] +// CHECK-NEXT: [[DEST:%.*]] = getelementptr inbounds i32, i32* [[BEGIN]], i64 [[CUR]] +// CHECK-NEXT: [[SRC:%.*]] = getelementptr inbounds [1 x i32], [1 x i32]* @a, i64 0, i64 [[CUR]] +// CHECK-NEXT: [[X:%.*]] = load i32, i32* [[SRC]] +// CHECK-NEXT: store i32 [[X]], i32* [[DEST]] +// CHECK-NEXT: [[NEXT]] = add nuw i64 [[CUR]], 1 +// CHECK-NEXT: [[EQ:%.*]] = icmp eq i64 [[NEXT]], 1 +// CHECK-NEXT: br i1 [[EQ]], label %[[FIN:.*]], label %[[BODY]] +// CHECK-EMPTY: +// CHECK-NEXT: [[FIN]]: +// CHECK-NEXT: ret void ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D112926: run-clang-tidy.py analyze unique files only
This revision was automatically updated to reflect the committed changes. Closed by commit rG0dc856ed20e0: [clang-tidy] run-clang-tidy.py: analyze unique files only (authored by serkazi, committed by salman-javed-nz). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112926/new/ https://reviews.llvm.org/D112926 Files: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py === --- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -273,8 +273,8 @@ # Load the database and extract all files. database = json.load(open(os.path.join(build_path, db_path))) - files = [make_absolute(entry['file'], entry['directory']) - for entry in database] + files = set([make_absolute(entry['file'], entry['directory']) + for entry in database]) max_task = args.j if max_task == 0: Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py === --- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -273,8 +273,8 @@ # Load the database and extract all files. database = json.load(open(os.path.join(build_path, db_path))) - files = [make_absolute(entry['file'], entry['directory']) - for entry in database] + files = set([make_absolute(entry['file'], entry['directory']) + for entry in database]) max_task = args.j if max_task == 0: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] 0dc856e - [clang-tidy] run-clang-tidy.py: analyze unique files only
Author: Serikzhan Kazi Date: 2021-11-06T19:53:18+13:00 New Revision: 0dc856ed20e0fb64dd7cb0a10db35c58c3ef95e6 URL: https://github.com/llvm/llvm-project/commit/0dc856ed20e0fb64dd7cb0a10db35c58c3ef95e6 DIFF: https://github.com/llvm/llvm-project/commit/0dc856ed20e0fb64dd7cb0a10db35c58c3ef95e6.diff LOG: [clang-tidy] run-clang-tidy.py: analyze unique files only The files in compile-commands.json can potentially include duplicates. Change run-clang-tidy.py so that it does not run on the duplicate entries. Differential Revision: https://reviews.llvm.org/D112926 Added: Modified: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py Removed: diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py index acd1ed6979c0d..e6cff6a7414d1 100755 --- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py +++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py @@ -273,8 +273,8 @@ def main(): # Load the database and extract all files. database = json.load(open(os.path.join(build_path, db_path))) - files = [make_absolute(entry['file'], entry['directory']) - for entry in database] + files = set([make_absolute(entry['file'], entry['directory']) + for entry in database]) max_task = args.j if max_task == 0: ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D113320: [clang-format] Address fixme
owenpan added a comment. Looks okay. Comment at: clang/lib/Format/UnwrappedLineParser.cpp:3064-3068 + for (const auto : Line.Tokens) { +for (const auto : Node.Children) + printDebugInfo(ChildNode, "\nChild: "); + } Nit: elide braces. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113320/new/ https://reviews.llvm.org/D113320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D112941: [clang] Add support for the new pointer authentication builtins.
rjmccall added inline comments. Comment at: clang/include/clang/Driver/Options.td:2865-2872 +let Group = f_Group in { + let Flags = [CC1Option] in { +def fptrauth_intrinsics : Flag<["-"], "fptrauth-intrinsics">, + HelpText<"Enable pointer-authentication intrinsics">; + } + def fno_ptrauth_intrinsics : Flag<["-"], "fno-ptrauth-intrinsics">; +} kristof.beyls wrote: > My impression is that generally for `__builtin_XXX` intrinsics, there are no > compiler flags to make them available or remove their availability. > Is there a good reason why a command line option is needed for the > `__builtin_ptrauth` intrinsics, but not (IIUC) for most or any other existing > `__builtin_XXX` intrinsic? > If there is no good reason, it seems better to me to not have a command line > option so there is better consistency across all `__builtin_XXX` intrinsics? > > (after having read more of the patch): my impression has changed now that the > f(no-)ptrauth-intrinsics flag rather selects whether the ptrauth intrinsics > get lowered to PAuth hardware instructions, or to "regular" instructions > emulating the behavior of authenticated pointers. If that is correct (and > assuming it's a useful option to have), I would guess a different name for > the command line option could be less misleading. As is, it suggests this > selects whether ptrauth_ intrinsics are available or not. If instead, as I'm > guessing above, this selects whether ptrauth_ intrinsics get lowered to PAuth > instructions or not, maybe something like '-femulate-ptrauth' would describe > the effect of the command line switch a bit better? The ptrauth features were implemented gradually, beginning with the intrinsics. Originally we needed a way to enable the intrinsics feature without relying on target information. We do still need a way to enable them without necessarily enabling automatic type/qualifier-based pointer authentication. I don't know if we need to be able to *disable* them when the target supports them; I agree that that would be a little strange. If not, we could just enable the intrinsics whenever either the target says they're okay or software emulation (a separate, experimental feature) is enabled. The AArch64 target has a `+pauth` target feature. However, I don't know if `-arch arm64e` actually adds that feature on Apple targets. Also, the `HasPAuth` field in the clang `TargetInfo` does not appear to be properly initialized to `false` when `+pauth` *isn't* present; fortunately, that field never used. I'm not sure if it would actually be okay to remove the `-fptrauth-intrinsics` driver option if we just enabled the intrinsics based on the target feature. That does feel cleaner, but unfortunately, we at Apple probably have explicit uses of the option that we'd have to clean up before we could remove the option. We could treat that as an Apple problem and keep it out of the open source tree, though, and maybe remove the option altogether someday. Ahmed, thoughts? Comment at: clang/lib/Headers/ptrauth.h:19-37 + /* A process-independent key which can be used to sign code pointers. + Signing and authenticating with this key is a no-op in processes + which disable ABI pointer authentication. */ + ptrauth_key_process_independent_code = ptrauth_key_asia, + + /* A process-specific key which can be used to sign code pointers. + Signing and authenticating with this key is enforced even in processes kristof.beyls wrote: > I think, but am not sure, that the decision of which keys are process > independent and which ones are process-dependent is a software platform > choice? > If so, maybe ptrauth_key_process_{in,}dependent_* should only get defined > conditionally? > I'm not sure if any decisions have been taken already for e.g. linux, > Android, other platforms. > If not, maybe this block of code should be surrounded by an ifdef that is > enabled only when targeting Darwin? Yes, in retrospect it was a bad idea to define these particular generic names. I believe Apple platforms no longer have "process-independent" keys. It should really just be (1) the concrete keys, (2) recommended default keys for code and data pointers, and then (3) the specific keys used in specific schemas. Beyond that, if people want a specific different key for some purpose, they should ask for it. Unfortunately, there's already a fair amount of code using these names. We could deprecate the old names and point people towards the new names, though. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112941/new/ https://reviews.llvm.org/D112941 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits