[clang] [NFC][Clang] Use StringSwitch instead of array for parsing attribute scope (PR #115414)

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

[clang] [llvm] [TLI] Add support for reallocarray (PR #114818)

2024-11-08 Thread Nikita Popov via cfe-commits
@@ -577,6 +577,21 @@ bool llvm::inferNonMandatoryLibFuncAttrs(Function &F, Changed |= setDoesNotCapture(F, 0); Changed |= setArgNoUndef(F, 1); break; + case LibFunc_reallocarray: +Changed |= setAllocFamily(F, "malloc"); +Changed |= setAllocKind(F, AllocFnKi

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-18 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/116331 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [HLSL] Adding Flatten and Branch if attributes (PR #116331)

2024-11-18 Thread Nikita Popov via cfe-commits
@@ -53,3 +53,6 @@ LLVM_FIXED_MD_KIND(MD_DIAssignID, "DIAssignID", 38) LLVM_FIXED_MD_KIND(MD_coro_outside_frame, "coro.outside.frame", 39) LLVM_FIXED_MD_KIND(MD_mmra, "mmra", 40) LLVM_FIXED_MD_KIND(MD_noalias_addrspace, "noalias.addrspace", 41) +// TODO: this will likelly be pla

[clang] Reland "[clang] Add nuw attribute to GEPs (#105496)" (PR #107257)

2024-11-18 Thread Nikita Popov via cfe-commits
nikic wrote: @sbc100 That wasm is not necessarily a miscompile, it may be UB in the source program, if it uses a negative number in an *unsigned* variable to index an array. Is the affected code clean under ubsan? (See https://github.com/llvm/llvm-project/issues/108770 for a similar report tha

[clang] [llvm] [mlir] [LLVM][IR] Use splat syntax when printing ConstantExpr based splats. (PR #116856)

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

[clang] [Lex] Remove unused includes (NFC) (PR #116460)

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

[clang] [Driver] Remove unused includes (NFC) (PR #116316)

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

[clang] [AST] Avoid repeated hash lookups (NFC) (PR #116549)

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

[clang] [llvm] Introduce symbol versioning for clang-cpp (PR #116556)

2024-11-17 Thread Nikita Popov via cfe-commits
nikic wrote: There's an existing PR for this here: https://github.com/llvm/llvm-project/pull/110758 https://github.com/llvm/llvm-project/pull/116556 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinf

[clang] [clang-shlib] Add symbol versioning to all symbols (PR #110758)

2024-11-21 Thread Nikita Popov via cfe-commits
nikic wrote: Closing this in favor of the merged https://github.com/llvm/llvm-project/pull/116556. https://github.com/llvm/llvm-project/pull/110758 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo

[clang] [clang-shlib] Add symbol versioning to all symbols (PR #110758)

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

[clang] [AST] Migrate away from PointerUnion::{is, get} (NFC) (PR #117469)

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

[clang-tools-extra] [lld] [llvm] tools: Remove untested PluginLoader includes (PR #117644)

2024-11-26 Thread Nikita Popov via cfe-commits
nikic wrote: Hm, I would have expected the removal in opt to break polly tests using `%loadPolly` (which still use the legacy PM). https://github.com/llvm/llvm-project/pull/117644 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [lldb] [Clang] Improve Sema diagnostic performance for __builtin_counted_by_ref (PR #116719)

2024-11-26 Thread Nikita Popov via cfe-commits
nikic wrote: > Is there a branch up for this on https://llvm-compile-time-tracker.com/ so > that we've verified that this actually improves performance? Compile-time: https://llvm-compile-time-tracker.com/compare.php?from=105b7803ea22823a2fca2a82ee843d0884e9cbf3&to=dcb3e2b6b4333556fbfa3d7a5a45

[clang] [Clang] Fix name lookup for dependent bases (PR #114978)

2024-11-26 Thread Nikita Popov via cfe-commits
nikic wrote: FYI this seems to have significant cost for some types of C++ code, in particular clang build time regresses by 0.35% (https://llvm-compile-time-tracker.com/compare.php?from=4a7b56e6e7dd0f83c379ad06b6e81450bc691ba6&to=486644723038555a224fd09d462bb5099e64809e&stat=instructions:u).

[clang] [llvm] [IR] Allow fast math flags on fptrunc and fpext (PR #115894)

2024-11-26 Thread Nikita Popov via cfe-commits
@@ -1875,13 +1873,17 @@ Instruction *InstCombinerImpl::visitFPTrunc(FPTruncInst &FPT) { // fptrunc (select Cond, (fpext X), Y --> select Cond, X, (fptrunc Y) Value *NarrowY = Builder.CreateFPTrunc(Y, Ty); Value *Sel = Builder.CreateSelect(Cond, X, NarrowY, "n

[clang] [Sema] Migrate away from PointerUnion::{is, get} (NFC) (PR #117498)

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

[clang] [PowerPC] Fix incorrect store alignment for __builtin_vsx_build_pair() (PR #108606)

2024-09-17 Thread Nikita Popov via cfe-commits
@@ -18197,7 +18197,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID, CallOps.push_back(Ops[i]); llvm::Function *F = CGM.getIntrinsic(ID); Value *Call = Builder.CreateCall(F, CallOps); -return Builder.CreateAlignedStore(Call, Ops[0], MaybeAli

[clang] [llvm] [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (PR #116888)

2024-12-01 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/116888 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (PR #116888)

2024-12-01 Thread Nikita Popov via cfe-commits
@@ -1898,6 +1882,60 @@ static Instruction *foldSelectICmpEq(SelectInst &SI, ICmpInst *ICI, return nullptr; } +/// Fold `X Pred C1 ? X BOp C2 : C1 BOp C2` to `min/max(X, C1) BOp C2`. +/// This allows for better canonicalization. +static Value *foldSelectWithConstOpToBinOp(IC

[clang] [llvm] [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (PR #116888)

2024-12-01 Thread Nikita Popov via cfe-commits
@@ -1898,6 +1882,60 @@ static Instruction *foldSelectICmpEq(SelectInst &SI, ICmpInst *ICI, return nullptr; } +/// Fold `X Pred C1 ? X BOp C2 : C1 BOp C2` to `min/max(X, C1) BOp C2`. +/// This allows for better canonicalization. +static Value *foldSelectWithConstOpToBinOp(IC

[clang] [llvm] [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (PR #116888)

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

[clang] [llvm] [Loads] Check context instruction for context-sensitive derefability (PR #109277)

2024-12-02 Thread Nikita Popov via cfe-commits
nikic wrote: > @nikic By the way, are there plans to support allocation functions other than > alloca in this check? I don't see currently any llvm passes assigning > dereferenceable(_or_null) attribute to something like `malloc(42)` , but I > don't see why not and in that case this should als

[libclc] [libcxx] [llvm] [openmp] [polly] [llvm] Move sub-project lead maintainers into their own Maintainers.md files (PR #118309)

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

[libclc] [libcxx] [llvm] [openmp] [polly] [llvm] Move sub-project lead maintainers into their own Maintainers.md files (PR #118309)

2024-12-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: Looks reasonable to me. We might want to use this chance to also get the information up to date... I think for polly this should probably be @tobiasgrosser -> @Meinersbur. For libclc maybe @tstellar -> @frasercrmck (or maybe both). https://github.com/llvm/l

[clang] [llvm] [SelectionDAG][PowerPC] Add an intrinsic for memcmp. (PR #118178)

2024-12-02 Thread Nikita Popov via cfe-commits
nikic wrote: You'll have to create an RFC on discourse if you want to add a new target-independent memory intrinsic. Though if changing the name is the extent of the "special handling" you need, we probably shouldn't be adding an intrinsic for that. https://github.com/llvm/llvm-project/pull/1

[libclc] [libcxx] [llvm] [openmp] [polly] [llvm] Move sub-project lead maintainers into their own Maintainers.md files (PR #118309)

2024-12-02 Thread Nikita Popov via cfe-commits
@@ -434,29 +433,17 @@ Others only have a lead maintainer listed here. [Flang maintainers](https://github.com/llvm/llvm-project/blob/main/flang/Maintainers.txt) -[LLD maintainers](https://github.com/llvm/llvm-project/blob/main/lld/CODE_OWNERS.TXT) - -[LLDB maintainers](http

[libclc] [libcxx] [llvm] [openmp] [polly] [llvm] Move sub-project lead maintainers into their own Maintainers.md files (PR #118309)

2024-12-02 Thread Nikita Popov via cfe-commits
nikic wrote: For openmp I'm not really sure, maybe @jdoerfert or @jpeyton52 can advise. https://github.com/llvm/llvm-project/pull/118309 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TableGen] Remove unused includes (NFC) (PR #116168)

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

[clang] bc3b0fa - [AST] Remove unnecessary include (NFC)

2024-11-15 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-11-15T16:54:33+01:00 New Revision: bc3b0fadd5120bd88ed6635583941f7763523c0a URL: https://github.com/llvm/llvm-project/commit/bc3b0fadd5120bd88ed6635583941f7763523c0a DIFF: https://github.com/llvm/llvm-project/commit/bc3b0fadd5120bd88ed6635583941f7763523c0a.diff

[clang] [clang-tools-extra] [Clang] Use TargetInfo when deciding if an address space is compatible (PR #115777)

2024-11-15 Thread Nikita Popov via cfe-commits
@@ -31,6 +31,7 @@ #include "clang/Basic/PointerAuthOptions.h" #include "clang/Basic/SourceLocation.h" #include "clang/Basic/Specifiers.h" +#include "clang/Basic/TargetInfo.h" nikic wrote: I dropped this include again in https://github.com/llvm/llvm-project/co

[clang] [CodeGen] Remove unused includes (NFC) (PR #116459)

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

[clang] [Lex] Remove unused includes (NFC) (PR #116460)

2024-11-16 Thread Nikita Popov via cfe-commits
@@ -14,14 +14,10 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/FileManager.h" #include "clang/Lex/HeaderMapTypes.h" -#include "llvm/ADT/SmallString.h" #include "llvm/Support/Compiler.h" -#include "llvm/Support/DataTypes.h" #include "llvm/Support/Debug.h" #includ

[clang] [Sema] Remove unused includes (NFC) (PR #116461)

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

[clang] [llvm] [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (PR #116888)

2024-12-01 Thread Nikita Popov via cfe-commits
nikic wrote: Please also rebase, I expect https://github.com/llvm/llvm-project/pull/118195 will results in some test changes. https://github.com/llvm/llvm-project/pull/116888 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [llvm] [InstCombine] Fold `X Pred C2 ? X BOp C1 : C2 BOp C1` to `min/max(X, C2) BOp C1` (PR #116888)

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

[clang] [llvm] [SCCP] Infer nuw for gep nusw with non-negative offsets (PR #118819)

2024-12-05 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/118819 >From 1dadf4d77f1cec342179b923d3ab37ea3b983a25 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 5 Dec 2024 12:10:59 +0100 Subject: [PATCH] [SCCP] Infer nuw for gep nusw with non-negative offsets If the GEP

[clang] [clang][bytecode] Handle bitcasts involving bitfields (PR #116843)

2024-12-05 Thread Nikita Popov via cfe-commits
Timm =?utf-8?q?Bäder?= , Timm =?utf-8?q?Bäder?= Message-ID: In-Reply-To: nikic wrote: It looks like this still fails on i386 after the reapply: ``` RUN: at line 1: /builddir/build/BUILD/llvm-20.0.0_pre20241205.gb86a5993bc7be5-build/llvm-project-b86a5993bc7be59b49879a0e768f53b7330f71b2/llvm/r

[clang] [llvm] [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (PR #111513)

2024-12-05 Thread Nikita Popov via cfe-commits
nikic wrote: Reverted this because it breaks a the build. I initially assumed this is due to disabled docs per the previous comment, but I think in my case the problem is actually that this seems to be trying to write to the source directory, which is forbidden. If you need to write out files,

[clang] [llvm] [clang-format] Add cmake target clang-format-style-options for updating ClangFormatStyleOptions.rst (PR #111513)

2024-12-05 Thread Nikita Popov via cfe-commits
nikic wrote: Reading back here, the general thing you are trying to do here is not allowed. At best you can add this as a manually invoked target that is not implicitly called by anything else. Though the actually correct way to handle this is what was proposed in https://github.com/llvm/llvm-

[clang] [CodeGen] Migrate away from PointerUnion::{is, get} (NFC) (PR #118600)

2024-12-04 Thread Nikita Popov via cfe-commits
@@ -37,8 +37,8 @@ void ConstantInitFuture::abandon() { void ConstantInitFuture::installInGlobal(llvm::GlobalVariable *GV) { assert(Data && "installing null future"); - if (Data.is()) { -GV->setInitializer(Data.get()); + if (auto *C = dyn_cast(Data)) { +GV->setIniti

[clang] Switch builtin strings to use string tables (PR #118734)

2024-12-08 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/118734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Switch builtin strings to use string tables (PR #118734)

2024-12-08 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. Confirmed that this works on GCC now. I'd suggest to replace the use of StringLiteral::size with plain sizeof(). The build time overhead of going through StringLiteral here is substantial. https://github.com/llvm/llvm-project/pull/118734 ___

[clang] Switch builtin strings to use string tables (PR #118734)

2024-12-08 Thread Nikita Popov via cfe-commits
@@ -68,23 +69,156 @@ enum ID { FirstTSBuiltin }; +// The info used to represent each builtin. struct Info { - llvm::StringLiteral Name; - const char *Type, *Attributes; - const char *Features; + // Rather than store pointers to the string literals describing these four

[clang] Switch builtin strings to use string tables (PR #118734)

2024-12-08 Thread Nikita Popov via cfe-commits
@@ -68,23 +69,156 @@ enum ID { FirstTSBuiltin }; +// The info used to represent each builtin. struct Info { - llvm::StringLiteral Name; - const char *Type, *Attributes; - const char *Features; + // Rather than store pointers to the string literals describing these four

[clang] Switch builtin strings to use string tables (PR #118734)

2024-12-06 Thread Nikita Popov via cfe-commits
https://github.com/nikic requested changes to this pull request. Fails to build with GCC: ``` FAILED: tools/clang/lib/Basic/CMakeFiles/obj.clangBasic.dir/Builtins.cpp.o CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/c++ -DCLANG_EXPORTS -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CON

[clang] [llvm] [SCCP] Infer nuw for gep nusw with non-negative offsets (PR #118819)

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

[clang] [CodeGen] Migrate away from PointerUnion::{is, get} (NFC) (PR #118600)

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

[clang] [clang-tools-extra] [clang] Compute accurate begin location for CallExpr with explicit object parameter (PR #117841)

2024-12-06 Thread Nikita Popov via cfe-commits
nikic wrote: It looks like this causes a significant compile-time regression: https://llvm-compile-time-tracker.com/compare.php?from=2b855dd97092e2178ac5c470a804a17ec440d7e5&to=9ccde12f5eeb91152900082a2ae839e2a9702b31&stat=instructions:u (Maybe most clearly seen during clang bootstrap, where th

[clang] [nfc][clang-offload-bundler] Don't leak on exit(1) (PR #119178)

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

[clang] [clang] Fix non-deterministic infinite recursion... (PR #118288)

2024-12-09 Thread Nikita Popov via cfe-commits
Alejandro =?utf-8?q?Álvarez_Ayllón?Message-ID: In-Reply-To: nikic wrote: @erichkeane I'm not seeing any significant compile-time impact: https://llvm-compile-time-tracker.com/compare.php?from=e0ea9fd6dc36f585e364d4e569095ebe063e2573&to=7fb8c423fddd1a81287b54f48da4de1c81566fc1&stat=instructions

[clang] [llvm] [ConstantFolding] Infer getelementptr nuw flag (PR #119214)

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

[clang] [llvm] [InstCombine] Infer nuw for gep inbounds from base of object (PR #119225)

2024-12-09 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/119225 When we have a gep inbounds from the base of an object (e.g. alloca or global), we know that the index cannot be negative, as this would go out of bounds. As such, we can infer nuw as well. The implementation is

[clang] [compiler-rt] [Clang] Adjust pointer-overflow sanitizer for N3322 (PR #120719)

2025-01-06 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/120719 >From cf1a8ee68d10668c1031a21daa251108c4fca98c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 20 Dec 2024 12:41:01 +0100 Subject: [PATCH 1/4] [Clang] Adjust pointer-overflow sanitizer for N3322 N3322 make

[clang] [llvm] [IR][AsmParser] Revamp how floating-point literals in LLVM IR. (PR #121838)

2025-01-07 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: As you still support the legacy format, could you please restrict this PR to only the parser changes, and leave the printer changes (and the mass test update they require) to a followup? https://github.com/llvm/llvm-project/pull/121838 __

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-07 Thread Nikita Popov via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [TableGen] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125158)

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

[clang] [libclang] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125631)

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

[clang] [Sema] Migrate away from PointerUnion::dyn_cast (NFC) (PR #125630)

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

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -358,49 +360,59 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [CodeGen][SystemZ] Replace PointerType::getUnqual(Type) with opaque version (NFC) (PR #126280)

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

[clang] [CodeGen][XCore] Replace PointerType::getUnqual(Type) with opaque version (NFC) (PR #126279)

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

[clang] [CodeGen] Replace of PointerType::get(Type) with opaque version (NFC) (PR #124771)

2025-02-08 Thread Nikita Popov via cfe-commits
@@ -1097,31 +1097,10 @@ llvm::Type *CodeGenModule::getBlockDescriptorType() { if (BlockDescriptorType) return BlockDescriptorType; - llvm::Type *UnsignedLongTy = -getTypes().ConvertType(getContext().UnsignedLongTy); - - // struct __block_descriptor { - // unsign

[clang] [CodeGen] Replace of PointerType::get(Type) with opaque version (NFC) (PR #124771)

2025-02-08 Thread Nikita Popov via cfe-commits
@@ -347,7 +347,7 @@ void CodeGenFunction::registerGlobalDtorWithAtExit(llvm::Constant *dtorStub) { // extern "C" int atexit(void (*f)(void)); assert(dtorStub->getType() == llvm::PointerType::get( - llvm::FunctionType::get(CGM.VoidTy, false), +

[clang] [CodeGen] Replace of PointerType::get(Type) with opaque version (NFC) (PR #124771)

2025-02-08 Thread Nikita Popov via cfe-commits
@@ -197,10 +198,9 @@ class Address { /// Return the type of the pointer value. llvm::PointerType *getType() const { -return llvm::PointerType::get( -ElementType, -llvm::cast(Pointer.getPointer()->getType()) -->getAddressSpace()); +auto A

[clang] [CodeGen][Hexagon] Replace PointerType::getUnqual(Type) with opaque version (NFC) (PR #126274)

2025-02-08 Thread Nikita Popov via cfe-commits
@@ -388,22 +385,16 @@ Address HexagonABIInfo::EmitVAArgForHexagonLinux(CodeGenFunction &CGF, CGF.Builder.CreateStore(__new_overflow_area_pointer, __current_saved_reg_area_pointer_p); - // Bitcast the overflow area pointer to the type of argument.

[clang] [CodeGen][AArch64] Replace PointerType::getUnqual(Type) with opaque version (NFC) (PR #126278)

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

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/125880 >From 2f698e27ae61b91019544cc707c134e0aec9ecd3 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 30 Jan 2025 12:08:01 +0100 Subject: [PATCH 1/7] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -358,49 +363,54 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [TableGen] Avoid repeated hash lookups (NFC) (PR #126464)

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

[clang] [AST] Avoid repeated hash lookups (NFC) (PR #126461)

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

[clang] [Lex] Avoid repeated hash lookups (NFC) (PR #126462)

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

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

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

[clang] [Serialization] Avoid repeated hash lookups (NFC) (PR #126429)

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

[clang] [Sema] Avoid repeated hash lookups (NFC) (PR #126428)

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

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -774,7 +774,7 @@ define i1 @captureICmpRev(ptr %x) { define i1 @nocaptureInboundsGEPICmp(ptr %x) { ; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) ; FNATTRS-LABEL: define i1 @nocaptureInboundsGEPICmp -; FNATTRS-SAME: (ptr rea

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -358,49 +360,64 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -358,49 +360,59 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-07 Thread Nikita Popov via cfe-commits
@@ -774,7 +774,7 @@ define i1 @captureICmpRev(ptr %x) { define i1 @nocaptureInboundsGEPICmp(ptr %x) { ; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) ; FNATTRS-LABEL: define i1 @nocaptureInboundsGEPICmp -; FNATTRS-SAME: (ptr rea

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,156 @@ +//===- FatLtoCleanup.cpp - clean up IR for the FatLTO pipeline --*- 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: Ap

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: Looks reasonable to me. https://github.com/llvm/llvm-project/pull/125911 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,156 @@ +//===- FatLtoCleanup.cpp - clean up IR for the FatLTO pipeline --*- 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: Ap

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,46 @@ + +; RUN: opt -passes="fatlto-cleanup" -mtriple=x86_64-unknown-fuchsia < %s -S | FileCheck %s nikic wrote: Use UTC please. Also, is the triple here really needed? https://github.com/llvm/llvm-project/pull/125911

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,35 @@ +//===- FatLtoCleanup.h - clean up IR for the FatLTO pipeline *- 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: Apa

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -1,21 +1,24 @@ // REQUIRES: x86-registered-target +// RUN: rm -rf %t && split-file %s %t // RUN: %clang_cc1 -triple x86_64-unknown-fuchsia -O2 -flto -ffat-lto-objects \ -// RUN: -fsanitize=cfi-icall -fsanitize-trap=cfi-icall -fvisibility=hidden -emit-llvm -o - %s

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,35 @@ +//===- FatLtoCleanup.h - clean up IR for the FatLTO pipeline *- 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: Apa

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,156 @@ +//===- FatLtoCleanup.cpp - clean up IR for the FatLTO pipeline --*- 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: Ap

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

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

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,156 @@ +//===- FatLtoCleanup.cpp - clean up IR for the FatLTO pipeline --*- 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: Ap

[clang] [llvm] [llvm][fatlto] Add FatLTOCleanup pass (PR #125911)

2025-02-10 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,156 @@ +//===- FatLtoCleanup.cpp - clean up IR for the FatLTO pipeline --*- 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: Ap

[clang] [clang] Handle f(no-)strict-overflow, f(no-)wrapv, f(no-)wrapv-pointer like gcc (PR #126524)

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

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-06 Thread Nikita Popov via cfe-commits
@@ -358,49 +363,54 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-06 Thread Nikita Popov via cfe-commits
@@ -94,31 +96,53 @@ namespace llvm { /// U->getUser() is always an Instruction. virtual bool shouldExplore(const Use *U); -/// captured - Information about the pointer was captured by the user of -/// use U. Return true to stop the traversal or false to continu

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-06 Thread Nikita Popov via cfe-commits
@@ -358,49 +363,54 @@ UseCaptureKind llvm::DetermineUseCaptureKind( // Volatile stores make the address observable. auto *ACXI = cast(I); if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile()) - return UseCaptureKind::MAY_CAPTURE; -return

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-06 Thread Nikita Popov via cfe-commits
@@ -1303,27 +1341,42 @@ static void addArgumentAttrs(const SCCNodeSet &SCCNodes, ArgumentSCCNodes.insert(I->Definition); } -bool SCCCaptured = false; +// At the SCC level, only track merged CaptureComponents. We're not +// currently prepared to handle pro

[libclc] [libclc] Allow default path when looking for llvm-spirv (PR #126071)

2025-02-06 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/126071 This is an external tool, so I don't think there is an expectation that it has to be in the LLVM tools bindir. It may also be in the default system bindir (which is not necessarily the same). >From 2badb97494720

[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)

2025-02-06 Thread Nikita Popov via cfe-commits
@@ -438,18 +448,21 @@ void llvm::PointerMayBeCaptured(const Value *V, CaptureTracker *Tracker, }; while (!Worklist.empty()) { const Use *U = Worklist.pop_back_val(); -switch (DetermineUseCaptureKind(*U, IsDereferenceableOrNull)) { -case UseCaptureKind::NO_CAPTU

<    6   7   8   9   10   11   12   13   14   15   >