[clang] [flang] [llvm] add -floop-fuse to clang and flang (PR #142686)

2025-06-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic requested changes to this pull request. I don't think we should expose clang driver options for passes that are known to have significant issues. If you want to add a `cl::opt` flag to allow scheduling this in the pipeline and accessible for early testing via `-mllvm`,

[clang] [Sema] Implement fix as suggested by FIXME (PR #143142)

2025-06-09 Thread Nikita Popov via cfe-commits
nikic wrote: Looks neutral: https://llvm-compile-time-tracker.com/compare.php?from=e4060d3beab3b525b49baaa15484e3c595740a2f&to=aace43c7cc60347e1853e55ee7c033a19a9a65ea&stat=instructions:u max-rss seems to have an improvement on tramp3d-v4 in multiple configurations, so that's probably not nois

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-06-06 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/130973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Fix error that reference to PointerType is ambiguous in clang/lib/Analysis/UnsafeBufferUsage.cpp (PR #142966)

2025-06-05 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. LGTM, but I would also consider dropping the "using namespace llvm" instead. This seems a bit unusual for a file in clang/lib/Analysis. https://github.com/llvm/llvm-project/pull/142966 ___ cfe-commi

[clang] [llvm] [NFC][LLVM] Refactor IRBuilder::Create{VScale,ElementCount,TypeSize}. (PR #142803)

2025-06-04 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/142803 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-06-04 Thread Nikita Popov via cfe-commits
@@ -136,9 +136,69 @@ const llvm::abi::Type *QualTypeMapper::convertRecordType(const RecordType *RT) { if (RD->isUnion()) return convertUnionType(RD); + + // Handle C++ classes with base classes + auto *const CXXRd = dyn_cast(RD); + if (CXXRd && (CXXRd->getNumBases()

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-06-04 Thread Nikita Popov via cfe-commits
@@ -136,9 +136,69 @@ const llvm::abi::Type *QualTypeMapper::convertRecordType(const RecordType *RT) { if (RD->isUnion()) return convertUnionType(RD); + + // Handle C++ classes with base classes + auto *const CXXRd = dyn_cast(RD); + if (CXXRd && (CXXRd->getNumBases()

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-06-04 Thread Nikita Popov via cfe-commits
@@ -136,9 +136,69 @@ const llvm::abi::Type *QualTypeMapper::convertRecordType(const RecordType *RT) { if (RD->isUnion()) return convertUnionType(RD); + + // Handle C++ classes with base classes + auto *const CXXRd = dyn_cast(RD); + if (CXXRd && (CXXRd->getNumBases()

[clang] [llvm] Global string alignment (PR #142346)

2025-06-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: I'm not sure this is the right fix for the issue. Just like for allocas, the global variable alignment is a *minimum* required alignment, which can and should be raised by targets if it improves code generation. (The exception to this is if the global has a

[clang] [llvm] Global string alignment (PR #142346)

2025-06-02 Thread Nikita Popov via cfe-commits
@@ -52,7 +52,7 @@ GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str, *M, StrConstant->getType(), true, GlobalValue::PrivateLinkage, StrConstant, Name, nullptr, GlobalVariable::NotThreadLocal, AddressSpace); GV->setUnnamedAddr(GlobalValue::UnnamedAd

[clang] [llvm] Global string alignment (PR #142346)

2025-06-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/142346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CodeGen] Move CodeGenPGO behind unique_ptr (NFC) (PR #142155)

2025-06-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/142155 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-06-01 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-06-01 Thread Nikita Popov via cfe-commits
nikic wrote: QualtypeMapper.h -> QualTypeMapper.h to match the class. https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-06-01 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: One thing still missing here is handling for C++ structs with base classes. https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mail

[clang] [clang] Serialization: support hashing null template arguments (PR #141890)

2025-05-30 Thread Nikita Popov via cfe-commits
nikic wrote: For the record, the manual backport PR is at: https://github.com/llvm/llvm-project/pull/141957 https://github.com/llvm/llvm-project/pull/141890 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] [CodeGen] Move CodeGenPGO behind unique_ptr (NFC) (PR #142155)

2025-05-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/142155 The InstrProf headers are very expensive. Avoid including them in all of CodeGen/ by making the CodeGenPGO member behind a unqiue_ptr. This reduces clang build time by 0.8%: https://llvm-compile-time-tracker.com/

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,209 @@ +#include "clang/AST/RecordLayout.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/Analyses/ThreadSafetyTIL.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/TargetInfo.h" +#include "llvm/ABI/Types.h" +#include "llvm/Support/Alignment.h" +#include

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
nikic wrote: I think this should be part of the clang/CodeGen library, not a new one. https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,78 @@ +#ifndef LLVM_ABI_QUALTYPE_MAPPER_H +#define LLVM_ABI_QUALTYPE_MAPPER_H nikic wrote: Outdated header guard. https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commits mailing list cfe-commits@lis

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,260 @@ +#ifndef LLVM_ABI_TYPES_H +#define LLVM_ABI_TYPES_H + +#include "llvm/ADT/APFloat.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Alignment.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/TypeSize.h" +#include +#include + +namespace l

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
nikic wrote: We should include the license file header in the newly created files: https://llvm.org/docs/CodingStandards.html#file-headers https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commits mailing list

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,260 @@ +#ifndef LLVM_ABI_TYPES_H +#define LLVM_ABI_TYPES_H + +#include "llvm/ADT/APFloat.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Alignment.h" +#include "llvm/Support/Allocator.h" +#include "llvm/Support/TypeSize.h" +#include +#include --

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,209 @@ +#include "clang/AST/RecordLayout.h" +#include "clang/AST/Type.h" +#include "clang/Analysis/Analyses/ThreadSafetyTIL.h" +#include "clang/Basic/LLVM.h" +#include "clang/Basic/TargetInfo.h" +#include "llvm/ABI/Types.h" +#include "llvm/Support/Alignment.h" +#include

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,78 @@ +#ifndef LLVM_ABI_QUALTYPE_MAPPER_H +#define LLVM_ABI_QUALTYPE_MAPPER_H + +#include "llvm/IR/DerivedTypes.h" +#include "llvm/Support/Allocator.h" +#include +#include +#include +#include +#include nikic wrote: Should always use `""` for non-s

[clang] [llvm] [WIP] ABI Lowering Library (PR #140112)

2025-05-30 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,78 @@ +#ifndef LLVM_ABI_QUALTYPE_MAPPER_H +#define LLVM_ABI_QUALTYPE_MAPPER_H + +#include "llvm/IR/DerivedTypes.h" +#include "llvm/Support/Allocator.h" +#include +#include +#include +#include +#include + +// Specialization for QualType +template <> struct llvm::Den

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
nikic wrote: It would probably be best to split up the LLVM and the Clang changes. https://github.com/llvm/llvm-project/pull/125258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,90 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=instcombine < %s | FileCheck %s + +; sinf clobbering errno, but %p cannot alias errno per C/C++ strict aliasing rules via TBAA. +; Hence, can

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,90 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=instcombine < %s | FileCheck %s + +; sinf clobbering errno, but %p cannot alias errno per C/C++ strict aliasing rules via TBAA. +; Hence, can

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -970,6 +971,19 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, } ModRefInfo Result = ArgMR | OtherMR; + + // Refine writes to errno memory. We can safely exclude the errno location if + // the given memory location is an alloca, the size of the memor

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -970,6 +971,19 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, } ModRefInfo Result = ArgMR | OtherMR; + + // Refine writes to errno memory. We can safely exclude the errno location if + // the given memory location is an alloca, the size of the memor

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -970,6 +971,19 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, } ModRefInfo Result = ArgMR | OtherMR; + + // Refine writes to errno memory. We can safely exclude the errno location if + // the given memory location is an alloca, the size of the memor

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,90 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 +; RUN: opt -S -passes=instcombine < %s | FileCheck %s + +; sinf clobbering errno, but %p cannot alias errno per C/C++ strict aliasing rules via TBAA. +; Hence, can

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -970,6 +971,19 @@ ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call, } ModRefInfo Result = ArgMR | OtherMR; + + // Refine writes to errno memory. We can safely exclude the errno location if + // the given memory location is an alloca, the size of the memor

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
@@ -385,6 +386,20 @@ AliasResult TypeBasedAAResult::alias(const MemoryLocation &LocA, return AliasResult::NoAlias; } +AliasResult TypeBasedAAResult::aliasErrno(const MemoryLocation &Loc, + const Module *M) { + if (!shouldUseTBAA())

[clang] [llvm] [clang][CodeGen][AA] Introduce `!llvm.errno.tbaa` for errno alias disambiguation (PR #125258)

2025-05-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: * The metadata should be documented in LangRef. * We should test linking of two modules with the metadata. Both the case where they match and where they don't (e.g. mixing C and C++). IRLinker::linkNamedMDNodes should be the relevant code. (I do wonder whethe

[clang] [llvm] Add support for Windows Secure Hot-Patching (PR #138972)

2025-05-24 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,287 @@ +//===-- WindowsHotPatch.cpp - Support for Windows hotpatching -===// +// +// 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: Ap

[clang] [CMake][Release] Build with -ffat-lto-objects (PR #140381)

2025-05-24 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: This is an improvement, but should we also strip the bitcode? Otherwise people will still get errors if they try to use the archives if their host clang version is older. https://github.com/llvm/llvm-project/pull/140381 __

[clang] [lld] [llvm] [mlir] [LLVM][Windows] Elide `PrettyStackTrace` output for usage errors (PR #140956)

2025-05-22 Thread Nikita Popov via cfe-commits
@@ -61,11 +61,14 @@ struct ScopedFatalErrorHandler { /// @deprecated Use reportFatalInternalError() or reportFatalUsageError() /// instead. [[noreturn]] LLVM_ABI void report_fatal_error(const char *reason, - bool gen_crash_diag = tru

[clang] [lld] [llvm] [LLVM][Windows] Elide `PrettyStackTrace` output for usage errors (PR #140956)

2025-05-21 Thread Nikita Popov via cfe-commits
@@ -61,11 +61,14 @@ struct ScopedFatalErrorHandler { /// @deprecated Use reportFatalInternalError() or reportFatalUsageError() /// instead. [[noreturn]] LLVM_ABI void report_fatal_error(const char *reason, - bool gen_crash_diag = tru

[clang] [lld] [llvm] [LLVM][Windows] Elide `PrettyStackTrace` output for usage errors (PR #140956)

2025-05-21 Thread Nikita Popov via cfe-commits
https://github.com/nikic requested changes to this pull request. https://github.com/llvm/llvm-project/pull/140956 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [lld] [llvm] [LLVM][Windows] Elide `PrettyStackTrace` output for usage errors (PR #140956)

2025-05-21 Thread Nikita Popov via cfe-commits
@@ -61,11 +61,14 @@ struct ScopedFatalErrorHandler { /// @deprecated Use reportFatalInternalError() or reportFatalUsageError() /// instead. [[noreturn]] LLVM_ABI void report_fatal_error(const char *reason, - bool gen_crash_diag = tru

[clang] [llvm] [RISCV] Improve casting between i1 scalable vectors and i8 fixed vectors for -mrvv-vector-bits (PR #139190)

2025-05-14 Thread Nikita Popov via cfe-commits
@@ -1476,8 +1486,14 @@ CoerceScalableToFixed(CodeGenFunction &CGF, llvm::FixedVectorType *ToTy, // If we are casting a scalable i1 predicate vector to a fixed i8 // vector, first bitcast the source. if (FromTy->getElementType()->isIntegerTy(1) && - FromTy->getElemen

[clang-tools-extra] [clangd] Use StringRef::consume_back_insensitive (NFC) (PR #139456)

2025-05-11 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/139456 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Use std::tie to implement operator< (NFC) (PR #139438)

2025-05-11 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/139438 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tools-extra] Remove unused local variables (NFC) (PR #139382)

2025-05-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/139382 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [BasicAA] Do not decompose past casts with different index width (PR #119365)

2025-05-05 Thread Nikita Popov via cfe-commits
nikic wrote: @liushuyu Thanks for the report, should be fixed by https://github.com/llvm/llvm-project/pull/138528. https://github.com/llvm/llvm-project/pull/119365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-05 Thread Nikita Popov via cfe-commits
nikic wrote: @optimisan Good point. I've put up https://github.com/llvm/llvm-project/pull/138502 to update the docs. https://github.com/llvm/llvm-project/pull/138251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-05 Thread Nikita Popov via cfe-commits
https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/138251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Remove unused local variables (NFC) (PR #138468)

2025-05-04 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/138468 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/138251 >From 114ba17da2f522c5fd5045f5030a44fe13b3af27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 2 May 2025 12:46:48 +0200 Subject: [PATCH 1/6] [ErrorHandling] Add reportFatalInternalError + reportFatalUsage

[clang] [llvm] [IRBuilder] Add versions of createInsertVector/createExtractVector that take a uint64_t index. (PR #138324)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/138324 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
@@ -59,22 +59,42 @@ namespace llvm { ~ScopedFatalErrorHandler() { remove_fatal_error_handler(); } }; -/// Reports a serious error, calling any installed error handler. These -/// functions are intended to be used for error conditions which are outside -/// the control of

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/138251 >From 114ba17da2f522c5fd5045f5030a44fe13b3af27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 2 May 2025 12:46:48 +0200 Subject: [PATCH 1/5] [ErrorHandling] Add reportFatalInternalError + reportFatalUsage

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/138251 >From 114ba17da2f522c5fd5045f5030a44fe13b3af27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 2 May 2025 12:46:48 +0200 Subject: [PATCH 1/4] [ErrorHandling] Add reportFatalInternalError + reportFatalUsage

[clang] [C] Diagnose use of C++ keywords in C (PR #137234)

2025-05-02 Thread Nikita Popov via cfe-commits
@@ -250,6 +250,32 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts, return CurStatus; } +static bool IsKeywordInCpp(unsigned Flags) { + while (Flags != 0) { +unsigned CurFlag = Flags & ~(Flags - 1); +Flags = Flags & ~CurFlag; +switch (static

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
@@ -59,22 +59,41 @@ namespace llvm { ~ScopedFatalErrorHandler() { remove_fatal_error_handler(); } }; -/// Reports a serious error, calling any installed error handler. These -/// functions are intended to be used for error conditions which are outside -/// the control of

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/138251 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/138251 >From 114ba17da2f522c5fd5045f5030a44fe13b3af27 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 2 May 2025 12:46:48 +0200 Subject: [PATCH 1/2] [ErrorHandling] Add reportFatalInternalError + reportFatalUsage

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
@@ -59,22 +59,41 @@ namespace llvm { ~ScopedFatalErrorHandler() { remove_fatal_error_handler(); } }; -/// Reports a serious error, calling any installed error handler. These -/// functions are intended to be used for error conditions which are outside -/// the control of

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
@@ -59,22 +59,41 @@ namespace llvm { ~ScopedFatalErrorHandler() { remove_fatal_error_handler(); } }; -/// Reports a serious error, calling any installed error handler. These -/// functions are intended to be used for error conditions which are outside -/// the control of

[clang] [llvm] [mlir] [ErrorHandling] Add reportFatalInternalError + reportFatalUsageError (NFC) (PR #138251)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/138251 This implements the result of the discussion at: https://discourse.llvm.org/t/rfc-report-fatal-error-and-the-default-value-of-gencrashdialog/73587 There are two different use cases for report_fatal_error, so repla

[clang] [llvm] [mlir] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-05-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/137958 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-05-01 Thread Nikita Popov via cfe-commits
@@ -26,11 +26,15 @@ typedef vbool64_t fixed_bool64_t __attribute__((riscv_rvv_vector_bits(__riscv_v_ // // CHECK-128-LABEL: @call_bool32_ff( // CHECK-128-NEXT: entry: +// CHECK-128-NEXT:[[SAVED_VALUE:%.*]] = alloca <1 x i8>, align 1 nikic wrote: I'd expe

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-05-01 Thread Nikita Popov via cfe-commits
@@ -26,11 +26,15 @@ typedef vbool64_t fixed_bool64_t __attribute__((riscv_rvv_vector_bits(__riscv_v_ // // CHECK-128-LABEL: @call_bool32_ff( // CHECK-128-NEXT: entry: +// CHECK-128-NEXT:[[SAVED_VALUE:%.*]] = alloca <1 x i8>, align 1 nikic wrote: @paulwal

[clang] [Clang] Do not warn for serialized builtin or command-line definitions (PR #137306)

2025-05-01 Thread Nikita Popov via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?= Message-ID: In-Reply-To: @@ -371,8 +371,12 @@ bool Preprocessor::CheckMacroName(Token &MacroNameTok, MacroUse isDefineUndef, SourceLocation MacroNameLoc = MacroNameTok.getLocation(); if (ShadowFlag) *ShadowFlag = false; - if

[clang] [Clang] Do not warn for serialized builtin or command-line definitions (PR #137306)

2025-05-01 Thread Nikita Popov via cfe-commits
Juan Manuel Martinez =?utf-8?q?Caamaño?= Message-ID: In-Reply-To: nikic wrote: This has a large negative compile-time impact, esp for unoptimized builds: https://llvm-compile-time-tracker.com/compare.php?from=7ec1e0f7ba9f3b03fa6163ab62c17dc9b404303e&to=0d3d2f639c42b22fc1b9453c7b834dbb0f16c0dc

[clang] [llvm] [mlir] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/137958 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-ser

[clang] [llvm] [mlir] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/137958 >From 2d3db51939ec6ca2dfb2e327bce0f33bd2532ff9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 30 Apr 2025 13:00:19 +0200 Subject: [PATCH 1/2] [IR] Do not store Function inside BlockAddress Currently Block

[clang] [llvm] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Nikita Popov via cfe-commits
@@ -912,6 +912,11 @@ class BlockAddress final : public Constant { /// block must be embedded into a function. static BlockAddress *get(BasicBlock *BB); + /// Return a BlockAddress for the specified basic block, which may not be + /// part of a function. The specified typ

[clang] [llvm] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/137958 >From 2d3db51939ec6ca2dfb2e327bce0f33bd2532ff9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 30 Apr 2025 13:00:19 +0200 Subject: [PATCH] [IR] Do not store Function inside BlockAddress Currently BlockAddr

[clang] [llvm] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Nikita Popov via cfe-commits
@@ -32,7 +32,7 @@ void llvm::reduceFunctionsDeltaPass(Oracle &O, ReducerWorkItem &WorkItem) { // Intrinsics don't have function bodies that are useful to // reduce. Additionally, intrinsics may have additional operand // constraints. But, do drop intrinsics that ar

[clang] [llvm] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/137958 Currently BlockAddresses store both the Function and the BasicBlock they reference, and the BlockAddress is part of the use list of both the Function and BasicBlock. This is quite awkward, because this is not re

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-30 Thread Nikita Popov via cfe-commits
@@ -4238,7 +4238,8 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, else elemTy = CGF.ConvertTypeForMem(elementType); - if (CGF.getLangOpts().PointerOverflowDefined) + if (CGF.getLangOpts().PointerOverflowDefined || + CGF.isUnderlyingBasePointerConstan

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: While we should omit inbounds, I think it would be good to not suppress the sanitizer. If the sanitizer doesn't warn about it, then things will never get better :( https://github.com/llvm/llvm-project/pull/137849 _

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
@@ -26,11 +26,15 @@ typedef vbool64_t fixed_bool64_t __attribute__((riscv_rvv_vector_bits(__riscv_v_ // // CHECK-128-LABEL: @call_bool32_ff( // CHECK-128-NEXT: entry: +// CHECK-128-NEXT:[[SAVED_VALUE:%.*]] = alloca <1 x i8>, align 1 nikic wrote: Looks li

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/130973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
@@ -554,6 +554,22 @@ class VectorType : public Type { return VectorType::get(VTy->getElementType(), EltCnt * 2); } + /// This static method returns a VectorType with the same size-in-bits as + /// SizeTy but with an element type that matches the scalar type of EltTy. +

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
@@ -554,6 +554,22 @@ class VectorType : public Type { return VectorType::get(VTy->getElementType(), EltCnt * 2); } + /// This static method returns a VectorType with the same size-in-bits as + /// SizeTy but with an element type that matches the scalar type of EltTy. -

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
@@ -80,7 +80,9 @@ fixed_bool32_t from_vbool32_t(vbool32_t type) { // // CHECK-128-LABEL: @to_vbool32_t( // CHECK-128-NEXT: entry: -// CHECK-128-NEXT:ret [[TYPE_COERCE:%.*]] +// CHECK-128-NEXT:[[SAVED_VALUE:%.*]] = alloca <1 x i8>, align 1 +// CHECK-128-NEXT: [[SAV

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: Apart from the RISCV test changes this looks reasonable to me. https://github.com/llvm/llvm-project/pull/130973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/

[clang] [llvm] [LLVM][SROA] Teach SROA how to "bitcast" between fixed and scalable vectors. (PR #130973)

2025-04-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/130973 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver] Simplify string comparisons (NFC) (PR #137756)

2025-04-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. https://github.com/llvm/llvm-project/pull/137756 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Clang: Add nsz to llvm.minnum and llvm.maxnum emitted from fmin and fmax (PR #113133)

2025-04-25 Thread Nikita Popov via cfe-commits
nikic wrote: > > I'm not sure this is correct. At least the way alive models the flag, I > > believe this would also allow returning -0.0 even if both operands are 0.0, > > which is not a legal outcome. > > That sounds like a bad modeling. It shouldn't permit synthesizing a -0 out of > nowher

[clang] [llvm] Clang: Add nsz to llvm.minnum and llvm.maxnum emitted from fmin and fmax (PR #113133)

2025-04-25 Thread Nikita Popov via cfe-commits
nikic wrote: I'm not sure this is correct. At least the way alive models the flag, I believe this would also allow returning -0.0 even if both operands are 0.0, which is not a legal outcome. https://github.com/llvm/llvm-project/pull/113133 ___ cfe-co

[clang] [llvm] [OpenMP] Remove 'libomptarget.devicertl.a' fatbinary and use static library (PR #126143)

2025-04-24 Thread Nikita Popov via cfe-commits
nikic wrote: A naive question from someone who is not familiar with this area: Is any of this stuff usable with anything but a matching version of clang? If no, can we place these things in the clang resource directory, where the other version-bound runtimes live? https://github.com/llvm/llvm

[clang] [llvm] [TargetVerifier][AMDGPU] Add TargetVerifier. (PR #123609)

2025-04-23 Thread Nikita Popov via cfe-commits
nikic wrote: > In general, non-power-of-2 integer types are not compilable to machine code > on AMDGPU. That sounds like a bug in the AMDGPU backend. https://github.com/llvm/llvm-project/pull/123609 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [llvm] [TargetVerifier][AMDGPU] Add TargetVerifier. (PR #123609)

2025-04-23 Thread Nikita Popov via cfe-commits
nikic wrote: I agree with @efriedma-quic that we can't have targets restricting what integer types are legal in IR. And as far as I can tell, the AMDGPU backend does handle such types (there are plenty of tests with i24 values for example). (Which isn't to say that other things can't be enforc

[clang] Control analysis-based diagnostics with #pragma (PR #136323)

2025-04-23 Thread Nikita Popov via cfe-commits
nikic wrote: FYI this introduces some overhead: https://llvm-compile-time-tracker.com/compare.php?from=2a9f77f6bd48d757b2d45aadcb6cf76ef4b4ef32&to=71ce9e26aec00e4af27a69ccfab8ca1773ed7018&stat=instructions:u About 0.3% on clang files. https://github.com/llvm/llvm-project/pull/136323 __

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-18 Thread Nikita Popov via cfe-commits
nikic wrote: > I don't see the necessity of using operand bundles. All of the possible > arguments are metadata strings, not SSA values. Can't we just use metadata > instead? Metadata always has to be droppable. Some of this could in theory be handled with metadata if we say the behavior (wit

[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-18 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/136196 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][RFC] Bypass TAD during overload resolution if a perfect match exists (PR #133426)

2025-04-18 Thread Nikita Popov via cfe-commits
nikic wrote: The final version had a 4% improvement on clang bootstrap: https://llvm-compile-time-tracker.com/compare.php?from=23324b8b109aed1f77cb20cef476b795f33b6835&to=8c5a307bd8d406e6167a5cd3ce3c74e2e3bfb2a6&stat=instructions:u Wow. https://github.com/llvm/llvm-project/pull/133426

[clang] [llvm] AMDGPU: Mark workitem ID intrinsics with range attribute (PR #136196)

2025-04-17 Thread Nikita Popov via cfe-commits
nikic wrote: > This avoids the need to have special handling at every use site. > Unfortunately this means we unnecessarily emit AssertZext in the DAG (where > we already directly understand the range of the intrinsic), andt we regress > in undefined cases as we don't fold out asserts on undef

[clang] [llvm] [SROA] Vector promote some memsets (PR #133301)

2025-04-14 Thread Nikita Popov via cfe-commits
nikic wrote: > > I don't think your general approach here is going to work. We need to be > > careful about introducing vector operations out of thin air, because LLVM > > is not going to second guess them. If you convert a memset to <32768 x i8> > > ops here, LLVM is going to carry those all

[clang] [llvm] [SROA] Vector promote some memsets (PR #133301)

2025-04-14 Thread Nikita Popov via cfe-commits
@@ -1170,10 +1204,17 @@ class AllocaSlices::SliceBuilder : public PtrUseVisitor { if (!IsOffsetKnown) return PI.setAborted(&II); +bool Splittable; + +if (getVectorTypeFor(II, DL)) + Splittable = isSplittableMemOp(AS.AI.getAllocatedType(), II.isVolatile

[clang] [llvm] [SROA] Vector promote some memsets (PR #133301)

2025-04-14 Thread Nikita Popov via cfe-commits
https://github.com/nikic requested changes to this pull request. So if I understand correctly, you are marking memsets as unsplittable, lowering them to vector zero and smaller accesses to inserts/extracts. I don't think your general approach here is going to work. We need to be careful about

[clang] [llvm] [SROA] Vector promote some memsets (PR #133301)

2025-04-14 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/133301 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen][X86] don't coerce int128 into `{i64,i64}` for SysV-like ABIs (PR #135230)

2025-04-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/135230 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen][X86] don't coerce int128 into `{i64,i64}` for SysV-like ABIs (PR #135230)

2025-04-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: I haven't checked the implementation, but conceptually this looks fine. Passing as i128 instead of {i64, i64} is better for optimization purposes. Rust already passes these as i128, so we know that works, and change will improve x-lang LTO. (Clang also passe

[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)

2025-04-09 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/135079 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

  1   2   3   4   5   6   7   8   9   10   >