[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-16 Thread Nikita Popov via cfe-commits
@@ -3283,10 +3285,15 @@ static bool isAllocSiteRemovable(Instruction *AI, case Intrinsic::memcpy: case Intrinsic::memset: { MemIntrinsic *MI = cast(II); -if (MI->isVolatile() || MI->getRawDest() != PI) +if (MI->isVolatile(

[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-16 Thread Nikita Popov via cfe-commits
@@ -3362,10 +3385,23 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) { DIB.reset(new DIBuilder(*MI.getModule(), /*AllowUnresolved=*/false)); } - if (isAllocSiteRemovable(&MI, Users, TLI)) { + // Determine what getInitialValueOfAllocation would return

[clang] [clang][cmake] Don't pass -fno-strict-aliasing for GCC (PR #144222)

2025-06-14 Thread Nikita Popov via cfe-commits
nikic wrote: To confirm, you do not get any `-Wstrict-aliasing` warnings with modern GCC after this change? https://github.com/llvm/llvm-project/pull/144222 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

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

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,172 @@ +//===- ABIFunctionInfo.h - ABI Function Information - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,136 @@ +//===- ABIInfo.h - ABI information access & encapsulation - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,74 @@ +//== QualTypeMapper.h - Maps Clang QualType to LLVMABI Types ---==// +// +// 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,404 @@ +//== QualTypeMapper.cpp - Maps Clang QualType to LLVMABI Types -==// +// +// 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,172 @@ +//===- ABIFunctionInfo.h - ABI Function Information - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,172 @@ +//===- ABIFunctionInfo.h - ABI Function Information - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,172 @@ +//===- ABIFunctionInfo.h - ABI Function Information - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,102 @@ +//===- BPF.cpp ===// +// +// 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,282 @@ +//===- ABI/Types.h --*- 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,136 @@ +//===- ABIInfo.h - ABI information access & encapsulation - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,172 @@ +//===- ABIFunctionInfo.h - ABI Function Information - 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] [WIP] ABI Lowering Library (PR #140112)

2025-06-14 Thread Nikita Popov via cfe-commits
@@ -3,6 +3,7 @@ include(LLVM-Build) # `Demangle', `Support' and `TableGen' libraries are added on the top-level # CMakeLists.txt +# add_subdirectory(ABI) nikic wrote: Should add cmake now that we have cpp files. https://github.com/llvm/llvm-project/pull/1401

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

2025-06-17 Thread Nikita Popov via cfe-commits
nikic wrote: On x86, what we actually end up doing is to combine those to unaligned i64 loads (see https://godbolt.org/z/P5z674x4r), which is probably the best outcome if they are supported. I assume AMDGPU does not support unaligned loads, and that's why you want to have single element loads

[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] [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] [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] [HLSL] Don't use CreateRuntimeFunction for intrinsics (PR #145334)

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

[clang] [HLSL] Don't use CreateRuntimeFunction for intrinsics (PR #145334)

2025-06-23 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/145334 HLSL uses CreateRuntimeFunction for two intrinsics. This is pretty unusual thing to do, and doesn't match what the rest of the file does. I suspect this might be because these are convergent calls, but the intrin

[clang] [HLSL] Don't use CreateRuntimeFunction for intrinsics (PR #145334)

2025-06-23 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/145334 >From 9ce18af49d38fcd5031ee4b432ab2f092818a045 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 23 Jun 2025 15:52:59 +0200 Subject: [PATCH] [HLSL] Don't use CreateRuntimeFunction for intrinsics HLSL uses Cr

[clang] [HLSL] Don't use CreateRuntimeFunction for intrinsics (PR #145334)

2025-06-23 Thread Nikita Popov via cfe-commits
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/145334 ___ 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-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -167,6 +167,7 @@ add_clang_library(clangCodeGen LINK_LIBS clangAST + LLVMABI nikic wrote: This should be part of LLVM_LINK_COMPONENTS instead. https://github.com/llvm/llvm-project/pull/140112 ___ cfe-commit

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -858,12 +865,28 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( // Construct the function info. We co-allocate the ArgInfos. FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, info, paramInfos,

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -858,12 +865,28 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( // Construct the function info. We co-allocate the ArgInfos. FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, info, paramInfos,

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -104,6 +106,17 @@ static CGCXXABI *createCXXABI(CodeGenModule &CGM) { llvm_unreachable("invalid C++ ABI kind"); } +static std::unique_ptr +makeTargetCodeGenInfo(llvm::abi::TypeBuilder TB) { nikic wrote: The pass by value here is probably not intentional?

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,241 @@ +//=== ABITypeMapper.cpp - Maps LLVM ABI Types to LLVM IR Types --===// +// +// 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: Apach

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -872,20 +895,122 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( } else if (info.getCC() == CC_Swift || info.getCC() == CC_SwiftAsync) { swiftcall::computeABIInfo(CGM, *FI); } else { -CGM.getABIInfo().computeInfo(*FI); +if (isBPF) + CGM.

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -858,12 +865,28 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( // Construct the function info. We co-allocate the ArgInfos. FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, info, paramInfos,

[clang] [C++][Modules] A module directive may only appear as the first preprocessing tokens in a file (PR #144233)

2025-06-21 Thread Nikita Popov via cfe-commits
nikic wrote: This causes a large compile-time regression: https://llvm-compile-time-tracker.com/compare.php?from=1b5d6ec6855369d109fcb740ecd3812231b7a279&to=ea321392ebc487c1000e43576f44af99edf28a5f&stat=instructions:u https://github.com/llvm/llvm-project/pull/144233

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

2025-06-21 Thread Nikita Popov via cfe-commits
@@ -858,12 +865,28 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( // Construct the function info. We co-allocate the ArgInfos. FI = CGFunctionInfo::create(CC, isInstanceMethod, isChainCall, isDelegateCall, info, paramInfos,

[clang] [llvm] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)

2025-06-24 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,157 @@ +//===- AMDGPUExpandFeaturePredicates.cpp - Feature Predicate Expander Pass ===// +// +// 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] [AMDGPU][clang][CodeGen][opt] Add late-resolved feature identifying predicates (PR #134016)

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

[clang] [llvm] Triple: Forward declare Twine and remove include (PR #145685)

2025-06-25 Thread Nikita Popov via cfe-commits
@@ -349,7 +350,12 @@ class Triple { /// triple fields unknown. Triple() = default; + LLVM_ABI explicit Triple(std::string &&Str); nikic wrote: Probably my C++-foo is not strong enough, but I thought that doing a by-value pass + std::move gives you the s

[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] [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] 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] [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: 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,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,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
@@ -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,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] [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,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
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] [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] [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] [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] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-12 Thread Nikita Popov via cfe-commits
nikic wrote: Need to modify this test to preserve behavior. Also the next one, etc. https://github.com/llvm/llvm-project/pull/143958 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-b

[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-12 Thread Nikita Popov via cfe-commits
@@ -112,11 +112,7 @@ declare i1 @fn5(ptr byval({ i32, i32 }) align 4 %r) define i1 @test5() { ; CHECK-LABEL: define i1 @test5() { -; CHECK-NEXT:[[TMP1:%.*]] = alloca { i32, i32 }, align 4 nikic wrote: Should replace this alloca with an argument to retain

[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-12 Thread Nikita Popov via cfe-commits
@@ -3362,10 +3385,23 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) { DIB.reset(new DIBuilder(*MI.getModule(), /*AllowUnresolved=*/false)); } - if (isAllocSiteRemovable(&MI, Users, TLI)) { + // Determine what getInitialValueOfAllocation would return

[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-12 Thread Nikita Popov via cfe-commits
@@ -3382,6 +3418,17 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) { eraseInstFromFunction(*I); Users[i] = nullptr; // Skip examining in the next loop. } +if (auto *MTI = dyn_cast(I)) { + if (KnowInitZero && getUn

[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-12 Thread Nikita Popov via cfe-commits
@@ -3283,10 +3285,15 @@ static bool isAllocSiteRemovable(Instruction *AI, case Intrinsic::memcpy: case Intrinsic::memset: { MemIntrinsic *MI = cast(II); -if (MI->isVolatile() || MI->getRawDest() != PI) +if (MI->isVolatile(

[clang] [llvm] [InstCombine] remove dead loads, such as memcpy from undef (PR #143958)

2025-06-12 Thread Nikita Popov via cfe-commits
@@ -364,20 +364,8 @@ define <2 x i1> @and_ne_with_diff_one_splatvec(<2 x i32> %x) { define void @simplify_before_foldAndOfICmps(ptr %p) { ; CHECK-LABEL: @simplify_before_foldAndOfICmps( -; CHECK-NEXT:[[A8:%.*]] = alloca i16, align 2 -; CHECK-NEXT:[[L7:%.*]] = load i16

[clang] [llvm] Add __attribute__((visibility("default"))) attribute to certain symbols to stop them being hidden when linking clangInterpreter library to other libraries during Emscripten build (PR #1

2025-07-03 Thread Nikita Popov via cfe-commits
nikic wrote: > Also, this is separate to the issue to making a Windows Shared library issue > here #109483 (this purely based on your comment that ' the annotation effort > hasn't progressed to them yet') That same work also enables building libLLVM/libclang with `-fvisibilty=hidden`, which i

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

2025-06-25 Thread Nikita Popov via cfe-commits
@@ -164,7 +164,8 @@ QualTypeMapper::convertArrayType(const clang::ArrayType *AT) { /// \return LLVM ABI VectorType with element type, count, and alignment const llvm::abi::Type *QualTypeMapper::convertVectorType(const VectorType *VT) { const llvm::abi::Type *ElementType = c

[clang] [llvm] Triple: Forward declare Twine and remove include (PR #145685)

2025-06-25 Thread Nikita Popov via cfe-commits
@@ -349,7 +350,12 @@ class Triple { /// triple fields unknown. Triple() = default; + LLVM_ABI explicit Triple(std::string &&Str); nikic wrote: Why `std::string &&` and `const std::string &` rather than one `std::string` ctor? https://github.com/llvm/ll

[clang] [llvm] Add __attribute__((visibility("default"))) attribute to certain symbols to stop them being hidden when linking clangInterpreter library to other libraries during Emscripten build (PR #1

2025-07-03 Thread Nikita Popov via cfe-commits
https://github.com/nikic commented: I'm super confused by what you are doing here. Most of the symbols you are annotating here are not inline and shouldn't be affected by `-fvisibility-inlines-hidden`. Some of them have already been annotated as LLVM_ABI in the header (and some of them haven't

[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

2025-07-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/146595 >From 8bfa43c61c47c978ddcba509f22cf0a605b83fa0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 1 Jul 2025 13:51:43 +0200 Subject: [PATCH 1/3] [DenseMap] Do not align pointer sentinel values (NFC) DenseMapI

[clang] [llvm] [EarlyCSE] Add support for writeonly call CSE (PR #145474)

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

[clang] [Clang] Verify data layout consistency (PR #144720)

2025-07-01 Thread Nikita Popov via cfe-commits
nikic wrote: I've put up https://github.com/llvm/llvm-project/pull/146494 for the wasm f128 alignment. https://github.com/llvm/llvm-project/pull/144720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [llvm] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

2025-07-02 Thread Nikita Popov via cfe-commits
nikic wrote: > Do you know if this runs into issues with undefined behavior? I don't know > the exact rules, but remember reading something along the lines that some OOB > pointers cannot even be compared without running into UB. Having pointers > that don't respect type alignment sounds like

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

2025-07-02 Thread Nikita Popov via cfe-commits
@@ -871,20 +928,50 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( } else if (info.getCC() == CC_Swift || info.getCC() == CC_SwiftAsync) { swiftcall::computeABIInfo(CGM, *FI); } else { -CGM.getABIInfo().computeInfo(*FI); +if (isBPF) + CGM.f

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

2025-07-02 Thread Nikita Popov via cfe-commits
@@ -825,6 +831,47 @@ void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI); } } // namespace clang +ABIArgInfo CodeGenTypes::convertABIArgInfo(const llvm::abi::ABIArgInfo &abiInfo, + QualType type) { + ABIArgInfo res

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

2025-07-02 Thread Nikita Popov via cfe-commits
@@ -17,19 +17,50 @@ #include "llvm/ABI/ABIFunctionInfo.h" #include "llvm/ABI/Types.h" #include +#include +#include namespace llvm { namespace abi { +struct ABICompatInfo { + unsigned Version = UINT_MAX; + + struct ABIFlags { +bool PassInt128VectorsInMem : 1; +

[clang] [Clang] Partially fix m68k alignments (PR #144740)

2025-06-30 Thread Nikita Popov via cfe-commits
nikic wrote: Ping :) https://github.com/llvm/llvm-project/pull/144740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [llvm] Enable LLVM_LINK_LLVM_DYLIB by default on non-Windows platforms (PR #138187)

2025-06-30 Thread Nikita Popov via cfe-commits
@@ -20,7 +20,6 @@ target_link_libraries(CoreTests LLVMBOLTRewrite LLVMBOLTProfile LLVMBOLTUtils - LLVMTestingSupport ) nikic wrote: Should split this into a separate PR. Worth noting that https://github.com/llvm/llvm-project/pull/145448 has an alter

[clang] [libc] [llvm] [DebugInfo][RemoveDIs] Suppress getNextNonDebugInfoInstruction (PR #144383)

2025-06-30 Thread Nikita Popov via cfe-commits
nikic wrote: Reverse ping :) https://github.com/llvm/llvm-project/pull/144383 ___ 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-07-02 Thread Nikita Popov via cfe-commits
@@ -849,6 +896,7 @@ const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo( void *insertPos = nullptr; CGFunctionInfo *FI = FunctionInfos.FindNodeOrInsertPos(ID, insertPos); + llvm::abi::ABIFunctionInfo *tempFI; nikic wrote: Move down to initializat

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

2025-07-02 Thread Nikita Popov via cfe-commits
@@ -825,6 +831,47 @@ void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI); } } // namespace clang +ABIArgInfo CodeGenTypes::convertABIArgInfo(const llvm::abi::ABIArgInfo &abiInfo, + QualType type) {

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

2025-07-02 Thread Nikita Popov via cfe-commits
@@ -825,6 +831,47 @@ void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI); } } // namespace clang +ABIArgInfo CodeGenTypes::convertABIArgInfo(const llvm::abi::ABIArgInfo &abiInfo, + QualType type) { + ABIArgInfo res

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

2025-07-02 Thread Nikita Popov via cfe-commits
@@ -0,0 +1,69 @@ +//===- ABIInfo.h - ABI information access & encapsulation - 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] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

2025-07-02 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/146595 >From 8bfa43c61c47c978ddcba509f22cf0a605b83fa0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 1 Jul 2025 13:51:43 +0200 Subject: [PATCH 1/2] [DenseMap] Do not align pointer sentinel values (NFC) DenseMapI

[clang] [llvm] [EarlyCSE] Add support for writeonly call CSE (PR #145474)

2025-06-27 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/145474 >From 3d51cf4796fe5f1e1577ce23f2970975bd216157 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 24 Jun 2025 10:08:40 +0200 Subject: [PATCH 1/4] [EarlyCSE] Add tests for writeonly --- llvm/test/Transforms/E

[clang] [llvm] [EarlyCSE] Add support for writeonly call CSE (PR #145474)

2025-06-27 Thread Nikita Popov via cfe-commits
nikic wrote: Skipping memsets for now. I added a PhaseOrdering test in https://github.com/llvm/llvm-project/commit/ec150a9944b2ce447c94944043fe1b87234e971f. I think what we're mainly missing is store sinking support in DSE. https://github.com/llvm/llvm-project/pull/145474 _

[clang] [Clang] Verify data layout consistency (PR #144720)

2025-06-27 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/144720 >From 4a70541ed734969f0db13c6fdf76c79702cc2b6e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 18 Jun 2025 14:48:19 +0200 Subject: [PATCH] [Clang] Verify data layout consistency Verify that the alignments

[clang] [Clang] Verify data layout consistency (PR #144720)

2025-06-27 Thread Nikita Popov via cfe-commits
nikic wrote: Ping :) https://github.com/llvm/llvm-project/pull/144720 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Verify data layout consistency (PR #144720)

2025-07-01 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/144720 >From af31642573b26c0f987b89148b65854ea2f5919a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 18 Jun 2025 14:48:19 +0200 Subject: [PATCH 1/2] [Clang] Verify data layout consistency Verify that the alignme

[clang] [Clang] Partially fix m68k alignments (PR #144740)

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

[clang] [Clang][Wasm] Set __float128 alignment to 64 for emscripten (PR #146494)

2025-07-01 Thread Nikita Popov via cfe-commits
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/146494 https://reviews.llvm.org/D104808 set the alignment of long double to 64 bits. This is also the alignment specified in the LLVM data layout. However, the alignment of __float128 was left at 128 bits. I assume tha

[clang] [Clang] Verify data layout consistency (PR #144720)

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

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

2025-07-20 Thread Nikita Popov via cfe-commits
nikic wrote: > @nikic Can you check the compile-time impact of this patch? https://llvm-compile-time-tracker.com/compare.php?from=aa27d4e0c3aef8047828aa453f2943730aa779c6&to=6fab608ecf50f2f36ee635e3a5d7e5f326c9e635&stat=instructions:u https://github.com/llvm/llvm-project/pull/135079 ___

[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

2025-07-07 Thread Nikita Popov via cfe-commits
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/146595 >From 28d67e3da912a0f6b09921874d1beb35a0548816 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 1 Jul 2025 13:51:43 +0200 Subject: [PATCH 1/3] [DenseMap] Do not align pointer sentinel values (NFC) DenseMapI

[clang] c3c3919 - Revert "[DenseMap] Do not align pointer sentinel values (NFC) (#146595)"

2025-07-07 Thread Nikita Popov via cfe-commits
Author: Nikita Popov Date: 2025-07-07T15:15:47+02:00 New Revision: c3c3919dc2d37d62e539376679feed7aaf799259 URL: https://github.com/llvm/llvm-project/commit/c3c3919dc2d37d62e539376679feed7aaf799259 DIFF: https://github.com/llvm/llvm-project/commit/c3c3919dc2d37d62e539376679feed7aaf799259.diff

[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

2025-07-07 Thread Nikita Popov via cfe-commits
nikic wrote: Reverted this due to ubsan errors like: > /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/ValueHandle.h:286:64: > runtime error: upcast of misaligned address 0x for type > 'llvm::BasicBlock', which requires 8 byte alignment The problem

[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

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

[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

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

[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)

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

[clang] [Clang][Wasm] Set __float128 alignment to 64 for emscripten (PR #146494)

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

[clang] [llvm] [PowerPC][AIX] Specify correct ABI alignment for double (PR #144673)

2025-07-08 Thread Nikita Popov via cfe-commits
nikic wrote: @amy-kwan Just wanted to check back whether you found out anything more about the test issues? https://github.com/llvm/llvm-project/pull/144673 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

<    11   12   13   14   15   16   17   >