[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

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

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits
@@ -3136,7 +3136,7 @@ static void LLVMPositionBuilderImpl(IRBuilder<> *Builder, BasicBlock *Block, Instruction *Instr, bool BeforeDbgRecords) { BasicBlock::iterator I = Instr ? Instr->getIterator() : Block->end(); I.setHeadBit(BeforeDbg

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

2024-06-24 Thread Nikita Popov via cfe-commits
@@ -44,15 +44,19 @@ template <> struct ilist_alloc_traits { iterator_range::iterator> getDbgRecordRange(DbgMarker *); +/// Class used to generate an insert position (ultimately always a +/// BasicBlock::iterator, which it will implicitly convert to) from either: +/// - An Inst

[clang] [llvm] [mlir] [polly] [IR][NFC] Update IRBuilder to use InsertPosition (PR #96497)

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

[clang] 30299b8 - [CommandLine] Avoid ManagedStatic.h include (NFC)

2024-06-21 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-06-21T15:45:17+02:00 New Revision: 30299b87171cbad2dacb8b1ec0e75801785f16d9 URL: https://github.com/llvm/llvm-project/commit/30299b87171cbad2dacb8b1ec0e75801785f16d9 DIFF: https://github.com/llvm/llvm-project/commit/30299b87171cbad2dacb8b1ec0e75801785f16d9.diff

[clang-tools-extra] 48ef912 - [VFS] Avoid include (NFC)

2024-06-21 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-06-21T15:17:41+02:00 New Revision: 48ef912e2b32798b704af242e551a7090102c750 URL: https://github.com/llvm/llvm-project/commit/48ef912e2b32798b704af242e551a7090102c750 DIFF: https://github.com/llvm/llvm-project/commit/48ef912e2b32798b704af242e551a7090102c750.diff

[clang] [llvm] Intrinsic: introduce minimumnum and maximumnum (PR #93841)

2024-06-20 Thread Nikita Popov via cfe-commits
nikic wrote: It looks like this PR was merged without being approved, and I also couldn't find the corresponding RFC for this addition on discourse. I've reverted it for now. https://github.com/llvm/llvm-project/pull/93841 ___ cfe-commits mailing lis

[clang] [lld] [llvm] [PassManager] Remove some unnecessary includes (NFC) (PR #96175)

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

[clang] [lld] [llvm] [PassManager] Remove some unnecessary includes (NFC) (PR #96175)

2024-06-20 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/96175 >From 8a5e15bffd2bbb1fbb35968f38a0ad2ba067 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 20 Jun 2024 13:25:28 +0200 Subject: [PATCH 1/2] [PassManger] Remove some unnecessary includes (NFC) SmallPtrSet.

[clang] [llvm] [PassManager] Remove some unnecessary includes (NFC) (PR #96175)

2024-06-20 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/96175 >From 4da2e8622b296b644755c924f317d0be95ce4d42 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 20 Jun 2024 13:25:28 +0200 Subject: [PATCH] [PassManger] Remove some unnecessary includes (NFC) SmallPtrSet.h an

[clang] [llvm] [PassManager] Remove some unnecessary includes (NFC) (PR #96175)

2024-06-20 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/96175 SmallPtrSet.h and TimeProfiler.h are unused. CommandLine.h is only needed for the UseNewDbgInfoFormat declare, which can be moved to the places that need it. >From 09446aad3123c3051267fd3311ffc9ad2fb99486 Mon Sep 1

[clang] [llvm] [polly] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

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

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
@@ -1567,68 +1242,33 @@ void LoadInst::AssertOK() { "Ptr must have pointer type."); } -static Align computeLoadStoreDefaultAlign(Type *Ty, BasicBlock *BB) { - assert(BB && "Insertion BB cannot be null when alignment not provided!"); +static Align computeLoadStoreDefa

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
nikic wrote: It looks like polly needs an update as well. https://github.com/llvm/llvm-project/pull/94226 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
@@ -63,10 +63,10 @@ class IRBuilderDefaultInserter { virtual ~IRBuilderDefaultInserter(); virtual void InsertHelper(Instruction *I, const Twine &Name, -BasicBlock *BB, BasicBlock::iterator InsertPt) const { -if (

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
@@ -44,6 +44,23 @@ template <> struct ilist_alloc_traits { iterator_range::iterator> getDbgRecordRange(DbgMarker *); +class InsertPosition { + using InstListType = SymbolTableList, + ilist_parent>; + InstListType::iterator InsertAt; + +p

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
@@ -120,7 +120,8 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, Alloca = Builder.CreateAlloca(Ty, ArraySize, Name); else Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), - ArraySize,

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
@@ -1460,56 +1184,29 @@ static Value *getAISize(LLVMContext &Context, Value *Amt) { return Amt; } -static Align computeAllocaDefaultAlign(Type *Ty, BasicBlock *BB) { - assert(BB && "Insertion BB cannot be null when alignment not provided!"); +static Align computeAllocaDefa

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
@@ -63,10 +63,10 @@ class IRBuilderDefaultInserter { virtual ~IRBuilderDefaultInserter(); virtual void InsertHelper(Instruction *I, const Twine &Name, -BasicBlock *BB, BasicBlock::iterator InsertPt) const { -if (

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

2024-06-19 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. Thanks for doing this, LGTM! https://github.com/llvm/llvm-project/pull/94226 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [LLVM] Add InsertPosition union-type to remove overloads of Instruction-creation (PR #94226)

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

[clang] [clang] Lower _BitInt(129+) to a different type in LLVM IR (PR #91364)

2024-06-18 Thread Nikita Popov via cfe-commits
@@ -118,6 +124,37 @@ llvm::Type *CodeGenTypes::ConvertTypeForMem(QualType T, bool ForBitField) { return R; } +bool CodeGenTypes::LLVMTypeLayoutMatchesAST(QualType ASTTy, +llvm::Type *LLVMTy) { + CharUnits ASTSize = Context.getTyp

[clang-tools-extra] [llvm] [llvm] Remove the Legacy PM Hello example (PR #95708)

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

[clang] cc2dc09 - Reapply [ConstantFold] Drop gep of gep fold entirely (#95126)

2024-06-13 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-06-13T17:03:35+02:00 New Revision: cc2dc0916ad6a00ebc9373a58854d77cf73af122 URL: https://github.com/llvm/llvm-project/commit/cc2dc0916ad6a00ebc9373a58854d77cf73af122 DIFF: https://github.com/llvm/llvm-project/commit/cc2dc0916ad6a00ebc9373a58854d77cf73af122.diff

[clang] [llvm] Reapply "[llvm][IR] Extend BranchWeightMetadata to track provenance o… (PR #95281)

2024-06-12 Thread Nikita Popov via cfe-commits
https://github.com/nikic approved this pull request. Looks good now, no text size of compile-time changes. https://github.com/llvm/llvm-project/pull/95281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/li

[clang] [llvm] [ConstantFold] Drop gep of gep fold entirely (PR #95126)

2024-06-12 Thread Nikita Popov via cfe-commits
nikic wrote: @agozillon Thanks for looking into this! This change isn't urgent, so I'm happy to wait for your PR to go in first. https://github.com/llvm/llvm-project/pull/95126 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm

[clang] [llvm] [ConstantFold] Drop gep of gep fold entirely (PR #95126)

2024-06-12 Thread Nikita Popov via cfe-commits
nikic wrote: > I believe this broke our flang+openmp+offload bot: > https://lab.llvm.org/staging/#/builders/140/builds/10168 Happy to help > looking into it. That's for the heads-up, I've reverted this patch in https://github.com/llvm/llvm-project/commit/cece0a105b29dcbb9d88d0aa264c4745c07a84

[clang] cece0a1 - Revert "[ConstantFold] Drop gep of gep fold entirely (#95126)"

2024-06-12 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-06-12T11:52:12+02:00 New Revision: cece0a105b29dcbb9d88d0aa264c4745c07a8456 URL: https://github.com/llvm/llvm-project/commit/cece0a105b29dcbb9d88d0aa264c4745c07a8456 DIFF: https://github.com/llvm/llvm-project/commit/cece0a105b29dcbb9d88d0aa264c4745c07a8456.diff

[clang] [llvm] [ConstantFold] Drop gep of gep fold entirely (PR #95126)

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

[clang] [Clang] Swap range metadata to attribute for intrinsics. (PR #94851)

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

[clang] [llvm] [ConstantFold] Drop gep of gep fold entirely (PR #95126)

2024-06-11 Thread Nikita Popov via cfe-commits
nikic wrote: > See > [51e459a](https://github.com/llvm/llvm-project/commit/51e459a561519c8d51e2b4cadddc0d1f99c8b7ef): > > > This causes some non-trivial text size increases in unoptimized builds for > > Bullet. Revert while I investigate. > > Can you double check this? This was mitigated by

[clang] [llvm] [ConstantFold] Drop gep of gep fold entirely (PR #95126)

2024-06-11 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/95126 This is a followup to https://github.com/llvm/llvm-project/pull/93823 and drops the DataLayout-unaware GEP of GEP fold entirely. All cases are now left to the DataLayout-aware constant folder, which will fold every

[clang-tools-extra] [clangd] Use clang_target_link_libraries() for clang libs (PR #94937)

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

[clang] [llvm] Revert "[llvm][IR] Extend BranchWeightMetadata to track provenance of weights" (PR #95060)

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

[clang] [llvm] Revert "[llvm][IR] Extend BranchWeightMetadata to track provenance of weights" (PR #95060)

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

[clang-tools-extra] [clangd] Use clang_target_link_libraries() for clang libs (PR #94937)

2024-06-10 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/94937 Use clang_target_link_libraries() instead of LINK_LIBS when linking clang libraries. This ensures that in CLANG_LINK_CLANG_DYLIB mode we link against libclang-cpp.so (instead of linking against both it and the stat

[clang] [CodeGen] Simplify codegen for array initialization (PR #93956)

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

[clang] [flang] [llvm] [mlir] [Flang]Fix for changed code at the end of AllocaIP. (PR #92430)

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

[clang] [CodeGen] Simplify codegen for array initialization (PR #93956)

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

[clang] [flang] [llvm] [mlir] [Flang]Fix for changed code at the end of AllocaIP. (PR #92430)

2024-06-06 Thread Nikita Popov via cfe-commits
nikic wrote: > > Allocas should be placed at the start of the entry block. > > Would it be acceptable to make this change such that the alloca's are at the > very start of the block? I have tried that, and it seems to work. It will > still mean changes to the tests, and I can't guarantee ALL a

[clang-tools-extra] [clang-tidy] Remove redundant LINK_LIBS (PR #94588)

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

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-06 Thread Nikita Popov via cfe-commits
nikic wrote: I suspect I may have misdiagnosed the issue, and the actual problem may be just https://github.com/llvm/llvm-project/pull/94588. I'll double check whether this change is necessary before landing. https://github.com/llvm/llvm-project/pull/93454 _

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-06-06 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/93454 >From b0bcd36b62a93e7d8bd0f7f01e857ce9aa7544c2 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 27 May 2024 11:56:41 +0200 Subject: [PATCH 1/2] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs add_clang_lib

[clang-tools-extra] [clang-tidy] Remove redundant LINK_LIBS (PR #94588)

2024-06-06 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/94588 clangAnalysis is already being pulled in via clang_target_link_libraries(). Also listing it in LINK_LIBS means that we'll link both against the static libraries and the shared libclang-cpp.so library if CLANG_LINK_

[clang] [llvm] [NVPTX] Revamp NVVMIntrRange pass (PR #94422)

2024-06-05 Thread Nikita Popov via cfe-commits
@@ -139,24 +138,23 @@ define ptx_device i32 @test_ctaid_w() { define ptx_device i32 @test_nctaid_y() { ; CHECK: mov.u32 %r{{[0-9]+}}, %nctaid.y; -; RANGE: call i32 @llvm.nvvm.read.ptx.sreg.nctaid.y(), !range ![[GRID_SIZE_YZ:[0-9]+]] +; RANGE: call range(i32 1, 65536) i32 @llv

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-06-03 Thread Nikita Popov via cfe-commits
nikic wrote: @mikaelholmen Thanks for the report, should be fixed by https://github.com/llvm/llvm-project/commit/bda8d1ad72fc72f21f6c536692594376d00db8b6. https://github.com/llvm/llvm-project/pull/92885 ___ cfe-commits mailing list cfe-commits@lists.l

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

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

[clang] 51e459a - Revert "[ConstantFold] Remove non-trivial gep-of-gep fold (#93823)"

2024-05-31 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-31T10:37:32+02:00 New Revision: 51e459a561519c8d51e2b4cadddc0d1f99c8b7ef URL: https://github.com/llvm/llvm-project/commit/51e459a561519c8d51e2b4cadddc0d1f99c8b7ef DIFF: https://github.com/llvm/llvm-project/commit/51e459a561519c8d51e2b4cadddc0d1f99c8b7ef.diff

[clang] [llvm] [ConstantFold] Remove non-trivial gep-of-gep fold (PR #93823)

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

[clang] [llvm] [clang] Introduce target-specific `Sema` components (PR #93179)

2024-05-31 Thread Nikita Popov via cfe-commits
nikic wrote: > I wonder if compile-time regressions come from new translation units I add, > because they definitely include stuff. Yes, I believe that is the primary contributor. You can see the per-file breakdown here: https://llvm-compile-time-tracker.com/compare_clang.php?from=59e2a6b08f3

[clang] 63dc31b - Reapply [IR] Avoid creating icmp/fcmp constant expressions (#92885)

2024-05-30 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-31T08:55:59+02:00 New Revision: 63dc31b68b78bc0e5deef21b98cab72de997c471 URL: https://github.com/llvm/llvm-project/commit/63dc31b68b78bc0e5deef21b98cab72de997c471 DIFF: https://github.com/llvm/llvm-project/commit/63dc31b68b78bc0e5deef21b98cab72de997c471.diff

[clang] [llvm] [ConstantFold] Remove non-trivial gep-of-gep fold (PR #93823)

2024-05-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/93823 >From 7fbc0366638de3262294c1923a1b45aa6338fe8f Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 30 May 2024 09:57:21 +0200 Subject: [PATCH 1/2] [ConstantFold] Remove non-trivial gep-of-gep fold This fold is s

[clang] [llvm] [clang] Introduce target-specific `Sema` components (PR #93179)

2024-05-30 Thread Nikita Popov via cfe-commits
nikic wrote: These Sema refactorings have been increasing the time to build clang by a small increment with every patch -- this one is an extra large jump of 0.7% (https://llvm-compile-time-tracker.com/compare.php?from=59e2a6b08f3e40afea87da3838ba69e1e15b6672&to=8aa80199751b0cd6631d057b0bfb2158

[clang] [llvm] [ConstantFold] Remove non-trivial gep-of-gep fold (PR #93823)

2024-05-30 Thread Nikita Popov via cfe-commits
nikic wrote: > > because the DL-aware constant folding will take care of this anyway. > > Can you point out where we do this fold? https://github.com/llvm/llvm-project/blob/1f46729a18ef13c3ba4184ead1da4ab3037cb7ae/llvm/lib/Analysis/ConstantFolding.cpp#L865 > > I've only kept the straightforwar

[clang] [llvm] [ConstantFold] Remove non-trivial gep-of-gep fold (PR #93823)

2024-05-30 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/93823 This fold is subtly incorrect, because DL-unaware constant folding does not know the correct index type to use, and just performs the addition in the type that happens to already be there. This is incorrect, since

[clang] b2bd024 - [CGExprAgg] Don't create zero index GEP

2024-05-30 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-30T11:47:07+02:00 New Revision: b2bd024384b484647da9fd9863bf6f77b5731949 URL: https://github.com/llvm/llvm-project/commit/b2bd024384b484647da9fd9863bf6f77b5731949 DIFF: https://github.com/llvm/llvm-project/commit/b2bd024384b484647da9fd9863bf6f77b5731949.diff

[clang] cd9a02e - [CodeGen] Remove useless zero-index constant GEPs (NFCI)

2024-05-30 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-30T10:24:57+02:00 New Revision: cd9a02e2c76ec2f37409c6f7becd61e605c117d8 URL: https://github.com/llvm/llvm-project/commit/cd9a02e2c76ec2f37409c6f7becd61e605c117d8 DIFF: https://github.com/llvm/llvm-project/commit/cd9a02e2c76ec2f37409c6f7becd61e605c117d8.diff

[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

2024-05-30 Thread Nikita Popov via cfe-commits
nikic wrote: This change seems to have some compile-time overhead. I'm not seeing a lot on CTMark, but during the clang bootstrap there are many files with ~1% regressions (http://llvm-compile-time-tracker.com/compare_clang.php?from=ec8fe598a94d2826f8e4f79367a5a45a6b32d284&to=9c4a716c1292096fc

[clang] [compiler-rt] [llvm] [mlir] [ConstantFold] Remove notional over-indexing fold (PR #93697)

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

[clang] [compiler-rt] [llvm] [mlir] [ConstantFold] Remove notional over-indexing fold (PR #93697)

2024-05-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/93697 >From 8a6462df3f329aa939db4c8bff87bd57bb0d6445 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 28 May 2024 13:47:05 +0200 Subject: [PATCH 1/3] [ConstantFold] Remove notional over-indexing fold The data-layou

[clang] [llvm] [mlir] [ConstantFold] Remove notional over-indexing fold (PR #93697)

2024-05-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/93697 >From 8a6462df3f329aa939db4c8bff87bd57bb0d6445 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 28 May 2024 13:47:05 +0200 Subject: [PATCH 1/2] [ConstantFold] Remove notional over-indexing fold The data-layou

[clang] [llvm] [ConstantFold] Remove notional over-indexing fold (PR #93697)

2024-05-29 Thread Nikita Popov via cfe-commits
nikic wrote: @aeubanks Following up on this comment: https://github.com/llvm/llvm-project/pull/89872#discussion_r1578582193 After looking into this a bit, I do think we can drop this and make things a good bit simpler :) https://github.com/llvm/llvm-project/pull/93697

[clang] [llvm] [ConstantFold] Remove notional over-indexing fold (PR #93697)

2024-05-29 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/93697 The data-layout independent constant folding currently has some rather gnarly code for canonicalizing GEP indices to reduce "notional overindexing", and then infers inbounds based on that canonicalization. Now tha

[clang] 975477e - [CGBuiltin] Explicitly use inbounds GEP (NFCI)

2024-05-29 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-29T16:39:21+02:00 New Revision: 975477e7f7ee1d8c29975224abb452f73b90db36 URL: https://github.com/llvm/llvm-project/commit/975477e7f7ee1d8c29975224abb452f73b90db36 DIFF: https://github.com/llvm/llvm-project/commit/975477e7f7ee1d8c29975224abb452f73b90db36.diff

[clang] [llvm] [inline] Clone return range attribute on the callsite into inlined call (PR #92666)

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

[clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)

2024-05-28 Thread Nikita Popov via cfe-commits
nikic wrote: > > FYI this causes a minor compile-time improvement in stage1 builds using > > gcc: > > https://llvm-compile-time-tracker.com/compare.php?from=32c3561d44aa792ef08d72b5a4c342c9965bc4c2&to=4feae05c6abda364a9295aecfa600d7d4e7dfeb6&stat=instructions:u > > While that's nice, it does s

[clang] [llvm] [inline] Clone return range attribute on the callsite into inlined call (PR #92666)

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

[clang] [llvm] [inline] Clone return range attribute on the callsite into inlined call (PR #92666)

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

[clang] [llvm] [inline] Clone return range attribute on the callsite into inlined call (PR #92666)

2024-05-28 Thread Nikita Popov via cfe-commits
@@ -1444,6 +1445,8 @@ static AttrBuilder IdentifyValidPoisonGeneratingAttributes(CallBase &CB) { Valid.addAttribute(Attribute::NonNull); if (CB.hasRetAttr(Attribute::Alignment)) Valid.addAlignmentAttr(CB.getRetAlign()); + if (CB.hasRetAttr(Attribute::Range)) +Va

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-28 Thread Nikita Popov via cfe-commits
nikic wrote: Okay, I managed to get access to a MacOS machine (turns out the GCC compile farm has one!) and figured out what the problem is. Basically, the presence of the constant expression meant that we previously always fell back to JIT and now we use the IR interpreter instead, which fail

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

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

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

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

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-27 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/90824 >From ff4658cf7661003d940452251147ee58315c774c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 2 May 2024 12:11:18 +0900 Subject: [PATCH 1/7] Add support for getelementptr nusw and nuw --- llvm/docs/LangRef

[clang] [cmake] Respect CLANG_LINK_CLANG_DYLIB for objlibs (PR #93454)

2024-05-27 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/93454 add_clang_library() will create a library clangFoo that depends on objlib obj.clangFoo. Then clang_target_link_libraries() will add a clang-cpp dependency to clangFoo, but obj.clangFoo will instead get dependencies

[clang] [lld] [llvm] Run ObjCContractPass in Default Codegen Pipeline (PR #92331)

2024-05-23 Thread Nikita Popov via cfe-commits
@@ -31,6 +31,10 @@ ; CHECK-NEXT: AArch64 Stack Tagging ; CHECK-NEXT: SME ABI Pass ; CHECK-NEXT: Exception handling preparation +; CHECK-NEXT: Dominator Tree Construction +; CHECK-NEXT: Basic Alias Analysis (stateless AA impl) +; CHECK-NEXT: F

[clang] [lld] [llvm] Run ObjCContractPass in Default Codegen Pipeline (PR #92331)

2024-05-23 Thread Nikita Popov via cfe-commits
nikic wrote: Reverted due to major compile-time regressions for unoptimized builds, see https://llvm-compile-time-tracker.com/compare.php?from=910292c3ac2ebe43cdbc90223c6c9702128316db&to=8cc8e5d6c6ac9bfc888f3449f7e424678deae8c2&stat=instructions:u. https://github.com/llvm/llvm-project/pull/9233

[clang] 1579e9c - Revert "Run ObjCContractPass in Default Codegen Pipeline (#92331)"

2024-05-23 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-24T08:14:26+02:00 New Revision: 1579e9ca9ce17364963861517fecf13b00fe4d8a URL: https://github.com/llvm/llvm-project/commit/1579e9ca9ce17364963861517fecf13b00fe4d8a DIFF: https://github.com/llvm/llvm-project/commit/1579e9ca9ce17364963861517fecf13b00fe4d8a.diff

[clang] [lldb] [llvm] Remove some `try_compile` CMake checks for compiler flags (PR #92953)

2024-05-23 Thread Nikita Popov via cfe-commits
nikic wrote: FYI this causes a minor compile-time improvement in stage1 builds using gcc: https://llvm-compile-time-tracker.com/compare.php?from=32c3561d44aa792ef08d72b5a4c342c9965bc4c2&to=4feae05c6abda364a9295aecfa600d7d4e7dfeb6&stat=instructions:u While that's nice, it does suggest that the f

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-23 Thread Nikita Popov via cfe-commits
nikic wrote: Unfortunately this is a Darwin-only test, and I don't have access to any MacOS systems. @JDevlieghere Could you please help me debug this issue? The test fails when trying to evaluate this expression: https://github.com/llvm/llvm-project/blob/58ddf3a0c6b6bbdf682ef3421d05e846a6e00

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-22 Thread Nikita Popov via cfe-commits
nikic wrote: There's already another approval from @aeubanks, so I plan to merge this next Monday if there's no more feedback. https://github.com/llvm/llvm-project/pull/90824 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.o

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-22 Thread Nikita Popov via cfe-commits
nikic wrote: @antmox Already fixed in https://github.com/llvm/llvm-project/commit/c609c04e32ef43f63a6ee54025fadf649c3247cc. https://github.com/llvm/llvm-project/pull/92885 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] c609c04 - [CodeGen] Use fixed triple in weak-external test (NFC)

2024-05-21 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-22T08:37:09+02:00 New Revision: c609c04e32ef43f63a6ee54025fadf649c3247cc URL: https://github.com/llvm/llvm-project/commit/c609c04e32ef43f63a6ee54025fadf649c3247cc DIFF: https://github.com/llvm/llvm-project/commit/c609c04e32ef43f63a6ee54025fadf649c3247cc.diff

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

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

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-21 Thread Nikita Popov via cfe-commits
@@ -8,7 +8,8 @@ // CHECK: entry: // CHECK-NEXT: %retval = alloca i32 // CHECK-NEXT: store i32 0, ptr %retval -// CHECK-NEXT: [[ZEXT:%.*]] = zext i1 true to i32 +// CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr @b, @a +// CHECK-NEXT: [[ZEXT:%.*]] = zext i1 [[CMP]] to i32

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-21 Thread Nikita Popov via cfe-commits
@@ -1422,7 +1417,7 @@ define i1 @user_of_not_called() { ; CHECK-LABEL: define {{[^@]+}}@user_of_not_called() { ; CHECK-NEXT:call void @useFnDecl(ptr addrspace(42) noundef nonnull addrspacecast (ptr @not_called1 to ptr addrspace(42))) ; CHECK-NEXT:call void @useFnDef(pt

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-21 Thread Nikita Popov via cfe-commits
@@ -43,9 +43,9 @@ ; CHECK: @mul = global ptr null ; CHECK: @xor = global ptr @A ; CHECK: @B = external global %Ty -; CHECK: @icmp_ult1 = global i1 icmp ugt (ptr getelementptr inbounds (i64, ptr @A, i64 1), ptr @A) +; CHECK: @icmp_ult1 = global i1 icmp ult (ptr @A, ptr geteleme

[clang] [llvm] [IR] Avoid creating icmp/fcmp constant expressions (PR #92885)

2024-05-21 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/92885 Do not create icmp/fcmp constant expressions in IRBuilder etc anymore, i.e. treat them as "undesirable". This is in preparation for removing them entirely. Part of: https://discourse.llvm.org/t/rfc-remove-most-cons

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-21 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/90824 >From b74cc982c95f7750a581e93bc0f246786c69ef3d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 2 May 2024 12:11:18 +0900 Subject: [PATCH 1/7] Add support for getelementptr nusw and nuw --- llvm/docs/LangRef

[clang] [llvm] [MC] Make UseAssemblerInfoForParsing mostly true (PR #91082)

2024-05-20 Thread Nikita Popov via cfe-commits
nikic wrote: @MaskRay Thanks! That does fix the regression. https://github.com/llvm/llvm-project/pull/91082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [ConstantFolding] Canonicalize constexpr GEPs to i8 (PR #89872)

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

[clang] [llvm] [MC] Make UseAssemblerInfoForParsing mostly true (PR #91082)

2024-05-20 Thread Nikita Popov via cfe-commits
nikic wrote: @MaskRay It looks like the new version still causes large compile-time regressions for sqlite3 debug builds: http://llvm-compile-time-tracker.com/compare.php?from=7529fe2e92e79eef22a528a7168e4dd777d6e9bd&to=9500a5d02e23f9b43294e5f662ac099f8989c0e4&stat=instructions:u It's smaller

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-16 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,93 @@ +//===-- llvm/GEPNoWrapFlags.h - NoWrap flags for GEPs ---*- 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] [MC] Remove UseAssemblerInfoForParsing (PR #91082)

2024-05-15 Thread Nikita Popov via cfe-commits
nikic wrote: Reverted in https://github.com/llvm/llvm-project/commit/fa750f09be6966de7423ddce1af7d1eaf817182c due to large compile-time regressions in some cases, see https://llvm-compile-time-tracker.com/compare.php?from=9bbefb7f600019c9d7025281132dd160729bfff2&to=03c53c69a367008da689f0d2940e

[clang] fa750f0 - Revert "[MC] Remove UseAssemblerInfoForParsing"

2024-05-15 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2024-05-16T09:56:07+09:00 New Revision: fa750f09be6966de7423ddce1af7d1eaf817182c URL: https://github.com/llvm/llvm-project/commit/fa750f09be6966de7423ddce1af7d1eaf817182c DIFF: https://github.com/llvm/llvm-project/commit/fa750f09be6966de7423ddce1af7d1eaf817182c.diff

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-15 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/90824 >From 009ffa45c131982caac5b9025678cde0418ac003 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 2 May 2024 12:11:18 +0900 Subject: [PATCH 1/7] Add support for getelementptr nusw and nuw --- llvm/docs/LangRef

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-15 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/90824 >From 009ffa45c131982caac5b9025678cde0418ac003 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 2 May 2024 12:11:18 +0900 Subject: [PATCH 1/5] Add support for getelementptr nusw and nuw --- llvm/docs/LangRef

[clang] [flang] [llvm] [InstCombine] Canonicalize constant GEPs to i8 source element type (PR #68882)

2024-05-14 Thread Nikita Popov via cfe-commits
nikic wrote: @sgundapa Hm, I think the problem may be that while https://github.com/llvm/llvm-project/pull/90802 removes the limitation on the element types, it's still limited to single-index GEPs, while here there are multiple indices. (Assuming this is related to swapping the GEPs at all, I

[clang] [flang] [llvm] [InstCombine] Canonicalize constant GEPs to i8 source element type (PR #68882)

2024-05-13 Thread Nikita Popov via cfe-commits
nikic wrote: @sgundapa Does https://github.com/llvm/llvm-project/pull/90802 fix the issue you're seeing? https://github.com/llvm/llvm-project/pull/68882 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-02 Thread Nikita Popov via cfe-commits
@@ -1699,8 +1701,12 @@ Expected BitcodeReader::materializeValue(unsigned StartValID, I = GetElementPtrInst::Create(BC->SrcElemTy, Ops[0], ArrayRef(Ops).drop_front(), "constexpr", InsertBB); -

[clang] [llvm] [IR] Add getelementptr nusw and nuw flags (PR #90824)

2024-05-02 Thread Nikita Popov via cfe-commits
@@ -316,3 +316,82 @@ define <2 x i32> @test_trunc_both_reversed_vector(<2 x i64> %a) { %res = trunc nsw nuw <2 x i64> %a to <2 x i32> ret <2 x i32> %res } + +define ptr @gep_nuw(ptr %p, i64 %idx) { +; CHECK: %gep = getelementptr nuw i8, ptr %p, i64 %idx + %gep = getelemen

<    1   2   3   4   5   6   7   8   9   >