Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
96a5289
[tools][llc] Add `--save-stats` option (#163967)
tomershafir Nov 9, 2025
b15e220
[tools][llc] Fix save-stats.ll require aarch64 target (#167218)
tomershafir Nov 9, 2025
cc3a505
[SelectionDAG] Fix assertion failure on inline asm register type mism…
ahmednoursphinx Nov 9, 2025
6616f07
[gn] port c940bfd7e621 (BPF SDNodeInfo)
nico Nov 9, 2025
d858aad
[NFCI][lldb][test][Recognizer] Fix mismatched C/C++ frontend subtitut…
tambry Nov 9, 2025
eef5225
[gn build] Port 00eacc29f009
llvmgnsyncbot Nov 9, 2025
0367711
[gn build] Port 8d950d27d686
llvmgnsyncbot Nov 9, 2025
04b0599
Remove unused <array> and <list> inclusion (#167116)
serge-sans-paille Nov 9, 2025
2095ea5
Remove unused <set> and <map> inclusion (#167175)
serge-sans-paille Nov 9, 2025
c3b31ba
[clang-tidy] Fix `readability-container-data-pointer` check (#165636)
zeyi2 Nov 9, 2025
6ef3218
[SPIRV] Add support for `bfloat16` atomics via the `SPV_INTEL_16bit_a…
AlexVlx Nov 9, 2025
3d82370
[mlir] Use llvm::transform (NFC) (#167205)
kazutakahirata Nov 9, 2025
d939823
[Target] Fix misleading indentation (NFC) (#167206)
kazutakahirata Nov 9, 2025
6de4f06
[clang] Remove redundant typename (NFC) (#167207)
kazutakahirata Nov 9, 2025
d4b41b9
[mlir] Consolidate two implementations of meet (NFC) (#167208)
kazutakahirata Nov 9, 2025
36e9a0b
[AArch64][GlobalISel] Correct instructions for 64bit fneg constant ve…
davemgreen Nov 9, 2025
c8f168c
[SandboxIR] Remove tight-coupling with LLVM's SwitchInst::CaseHandle …
vporpo Nov 9, 2025
24525f1
merge main into amd-staging
z1-cciauto Nov 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ void ContainerDataPointerCheck::check(const MatchFinder::MatchResult &Result) {
Lexer::getSourceText(CharSourceRange::getTokenRange(SrcRange),
*Result.SourceManager, getLangOpts())};

if (!isa<DeclRefExpr, ArraySubscriptExpr, CXXOperatorCallExpr, CallExpr,
MemberExpr>(CE))
const auto *OpCall = dyn_cast<CXXOperatorCallExpr>(CE);
const bool NeedsParens =
OpCall ? (OpCall->getOperator() != OO_Subscript)
: !isa<DeclRefExpr, MemberExpr, ArraySubscriptExpr, CallExpr>(CE);
if (NeedsParens)
ReplacementText = "(" + ReplacementText + ")";

if (CE->getType()->isPointerType())
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ Changes in existing checks
comparisons to ``npos``. Internal changes may cause new rare false positives
in non-standard containers.

- Improved :doc:`readability-container-data-pointer
<clang-tidy/checks/readability/container-data-pointer>` check by correctly
adding parentheses when the container expression is a dereference.

- Improved :doc:`readability-container-size-empty
<clang-tidy/checks/readability/container-size-empty>` check by correctly
generating fix-it hints when size method is called from implicit ``this``,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ template <typename T>
struct enable_if<true, T> {
typedef T type;
};

template <typename T>
struct unique_ptr {
T &operator*() const;
T *operator->() const;
};
}

template <typename T>
Expand Down Expand Up @@ -144,3 +150,20 @@ int *r() {
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
// CHECK-FIXES: return holder.v.data();
}

void s(std::unique_ptr<std::vector<unsigned char>> p) {
f(&(*p)[0]);
// CHECK-MESSAGES: :[[@LINE-1]]:5: warning: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer]
// CHECK-FIXES: f((*p).data());
}

void t(std::unique_ptr<container_without_data<unsigned char>> p) {
// p has no "data" member function, so no warning
f(&(*p)[0]);
}

template <typename T>
void u(std::unique_ptr<T> p) {
// we don't know if 'T' will always have "data" member function, so no warning
f(&(*p)[0]);
}
2 changes: 1 addition & 1 deletion clang/include/clang/AST/DeclBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ class DeclContext {

using udir_iterator_base =
llvm::iterator_adaptor_base<udir_iterator, lookup_iterator,
typename lookup_iterator::iterator_category,
lookup_iterator::iterator_category,
UsingDirectiveDecl *>;

struct udir_iterator : udir_iterator_base {
Expand Down
8 changes: 8 additions & 0 deletions clang/lib/CodeGen/Targets/X86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ bool IsX86_MMXType(llvm::Type *IRType) {
static llvm::Type *X86AdjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
StringRef Constraint,
llvm::Type *Ty) {
bool IsMMXCons = llvm::StringSwitch<bool>(Constraint)
.Cases({"y", "&y", "^Ym"}, true)
.Default(false);
if (IsMMXCons && Ty->isVectorTy() &&
cast<llvm::VectorType>(Ty)->getPrimitiveSizeInBits().getFixedValue() !=
64)
return nullptr; // Invalid MMX constraint

if (Constraint == "k") {
llvm::Type *Int1Ty = llvm::Type::getInt1Ty(CGF.getLLVMContext());
return llvm::FixedVectorType::get(Int1Ty, Ty->getScalarSizeInBits());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ REGISTER_LIST_WITH_PROGRAMSTATE(ActiveCritSections, CritSectionMarker)
// TODO: Move these to llvm::ImmutableList when overhauling immutable data
// structures for proper iterator concept support.
template <>
struct std::iterator_traits<
typename llvm::ImmutableList<CritSectionMarker>::iterator> {
struct std::iterator_traits<llvm::ImmutableList<CritSectionMarker>::iterator> {
using iterator_category = std::forward_iterator_tag;
using value_type = CritSectionMarker;
using difference_type = std::ptrdiff_t;
Expand Down
4 changes: 3 additions & 1 deletion clang/test/CodeGen/X86/mmx-inline-asm-error.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// RUN: %clang_cc1 -verify -triple x86_64-unknown-unknown -emit-llvm-only %s
// RUN: %clang_cc1 -verify=omp -triple x86_64-unknown-unknown -emit-llvm-only -fopenmp %s
typedef int vec256 __attribute__((ext_vector_type(8)));

vec256 foo(vec256 in) {
vec256 out;

asm("something %0" : : "y"(in)); // expected-error {{invalid input size for constraint 'y'}}
// omp-error@+1 {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
asm("something %0" : "=y"(out)); // expected-error {{invalid output size for constraint '=y'}}
// omp-error@+1 {{invalid type 'vec256' (vector of 8 'int' values) in asm input for constraint 'y'}}
asm("something %0, %0" : "+y"(out)); // expected-error {{invalid output size for constraint '+y'}}

return out;
}

6 changes: 3 additions & 3 deletions lldb/test/Shell/Recognizer/registration-unique.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@

# RUN: split-file %s %t

# RUN: %clang_host %t/main.cpp -g -o %t/cpp.out
# RUN: %clangxx_host %t/main.cpp -g -o %t/cpp.out
# RUN: %lldb -b -s %t/commands.input %t/cpp.out | FileCheck %s

# RUN: %clang_host -x objective-c++ %t/main.mm -g -o %t/objcxx.out
# RUN: %clangxx_host %t/main.mm -g -o %t/objcxx.out
# RUN: %lldb -b -s %t/commands.input %t/objcxx.out | FileCheck %s

# RUN: %clang_host %t/main.c -g -o %t/c.out
# RUN: %lldb -b -s %t/commands.input %t/c.out | FileCheck %s

# RUN: %clang_host -x objective-c %t/main.m -g -o %t/objc.out
# RUN: %clang_host %t/main.m -g -o %t/objc.out
# RUN: %lldb -b -s %t/commands.input %t/objc.out | FileCheck %s

#--- main.m
Expand Down
2 changes: 1 addition & 1 deletion lldb/test/Shell/Recognizer/verbose_trap-objc.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# REQUIRES: system-darwin
#
# RUN: %clangxx_host -x objective-c -g %S/Inputs/verbose_trap.m -o %t.out
# RUN: %clang_host -g %S/Inputs/verbose_trap.m -o %t.out
# RUN: %lldb -b -s %s %t.out | FileCheck %s

run
Expand Down
6 changes: 6 additions & 0 deletions llvm/docs/CommandGuide/llc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ End-user Options

Print statistics recorded by code-generation passes.

.. option:: --save-stats, --save-stats=cwd, --save-stats=obj

Save LLVM statistics to a file in the current directory
(:option:`--save-stats`/"--save-stats=cwd") or the directory
of the output file ("--save-stats=obj") in JSON format.

.. option:: --time-passes

Record the amount of time needed for each pass and print a report to standard
Expand Down
1 change: 1 addition & 0 deletions llvm/docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Changes to the LLVM tools
* `llvm-readelf` now dumps all hex format values in lower-case mode.
* Some code paths for supporting Python 2.7 in `llvm-lit` have been removed.
* Support for `%T` in lit has been removed.
* Add `--save-stats` option to `llc` to save LLVM statistics to a file. Compatible with the Clang option.

* `llvm-config` gained a new flag `--quote-paths` which quotes and escapes paths
emitted on stdout, to account for spaces or other special characters in path.
Expand Down
2 changes: 2 additions & 0 deletions llvm/docs/SPIRVUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ Below is a list of supported SPIR-V extensions, sorted alphabetically by their e
- Adds atomic add instruction on floating-point numbers.
* - ``SPV_EXT_shader_atomic_float_min_max``
- Adds atomic min and max instruction on floating-point numbers.
* - ``SPV_INTEL_16bit_atomics``
- Extends the SPV_EXT_shader_atomic_float_add and SPV_EXT_shader_atomic_float_min_max to support addition, minimum and maximum on 16-bit `bfloat16` floating-point numbers in memory.
* - ``SPV_INTEL_2d_block_io``
- Adds additional subgroup block prefetch, load, load transposed, load transformed and store instructions to read two-dimensional blocks of data from a two-dimensional region of memory, or to write two-dimensional blocks of data to a two dimensional region of memory.
* - ``SPV_INTEL_arbitrary_precision_integers``
Expand Down
1 change: 0 additions & 1 deletion llvm/examples/SpeculativeJIT/SpeculativeJIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ThreadPool.h"

#include <list>
#include <string>

using namespace llvm;
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/Analysis/DominanceFrontierImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "llvm/Support/GenericDomTree.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <set>
#include <utility>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/Bitcode/BitcodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBufferRef.h"
#include <map>
#include <memory>
#include <string>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <cstdint>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Error.h"
#include "llvm/TargetParser/Triple.h"
#include <map>
#include <memory>
#include <vector>

Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/DebugInfo/LogicalView/Core/LVObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "llvm/DebugInfo/LogicalView/Core/LVSupport.h"
#include "llvm/Support/Compiler.h"
#include <limits>
#include <list>
#include <string>

namespace llvm {
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "llvm/DebugInfo/LogicalView/Core/LVSort.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Compiler.h"
#include <list>
#include <map>
#include <set>

Expand Down
2 changes: 0 additions & 2 deletions llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@
#include <cassert>
#include <functional>
#include <iterator>
#include <list>
#include <memory>
#include <optional>
#include <set>
#include <utility>

namespace llvm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <algorithm>
#include <cassert>
#include <functional>
#include <list>
#include <memory>
#include <utility>
#include <vector>
Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/ProfileData/InstrProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <list>
#include <memory>
#include <string>
#include <system_error>
Expand Down
113 changes: 92 additions & 21 deletions llvm/include/llvm/SandboxIR/Instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1884,45 +1884,116 @@ class SwitchInst : public SingleLLVMInstructionImpl<llvm::SwitchInst> {
return cast<llvm::SwitchInst>(Val)->getNumCases();
}

template <typename LLVMCaseItT, typename BlockT, typename ConstT>
class CaseItImpl;

// The template helps avoid code duplication for const and non-const
// CaseHandle variants.
template <typename LLVMCaseItT, typename BlockT, typename ConstT>
class CaseHandleImpl {
Context &Ctx;
// NOTE: We are not wrapping an LLVM CaseHande here because it is not
// default-constructible. Instead we are wrapping the LLVM CaseIt
// iterator, as we can always get an LLVM CaseHandle by de-referencing it.
LLVMCaseItT LLVMCaseIt;
template <typename T1, typename T2, typename T3> friend class CaseItImpl;

public:
CaseHandleImpl(Context &Ctx, LLVMCaseItT LLVMCaseIt)
: Ctx(Ctx), LLVMCaseIt(LLVMCaseIt) {}
ConstT *getCaseValue() const;
BlockT *getCaseSuccessor() const;
unsigned getCaseIndex() const {
const auto &LLVMCaseHandle = *LLVMCaseIt;
return LLVMCaseHandle.getCaseIndex();
}
unsigned getSuccessorIndex() const {
const auto &LLVMCaseHandle = *LLVMCaseIt;
return LLVMCaseHandle.getSuccessorIndex();
}
};

// The template helps avoid code duplication for const and non-const CaseIt
// variants.
template <typename LLVMCaseItT, typename BlockT, typename ConstT>
class CaseItImpl : public iterator_facade_base<
CaseItImpl<LLVMCaseItT, BlockT, ConstT>,
std::random_access_iterator_tag,
const CaseHandleImpl<LLVMCaseItT, BlockT, ConstT>> {
CaseHandleImpl<LLVMCaseItT, BlockT, ConstT> CH;

public:
CaseItImpl(Context &Ctx, LLVMCaseItT It) : CH(Ctx, It) {}
CaseItImpl(SwitchInst *SI, ptrdiff_t CaseNum)
: CH(SI->getContext(), llvm::SwitchInst::CaseIt(
cast<llvm::SwitchInst>(SI->Val), CaseNum)) {}
CaseItImpl &operator+=(ptrdiff_t N) {
CH.LLVMCaseIt += N;
return *this;
}
CaseItImpl &operator-=(ptrdiff_t N) {
CH.LLVMCaseIt -= N;
return *this;
}
ptrdiff_t operator-(const CaseItImpl &Other) const {
return CH.LLVMCaseIt - Other.CH.LLVMCaseIt;
}
bool operator==(const CaseItImpl &Other) const {
return CH.LLVMCaseIt == Other.CH.LLVMCaseIt;
}
bool operator<(const CaseItImpl &Other) const {
return CH.LLVMCaseIt < Other.CH.LLVMCaseIt;
}
const CaseHandleImpl<LLVMCaseItT, BlockT, ConstT> &operator*() const {
return CH;
}
};

using CaseHandle =
llvm::SwitchInst::CaseHandleImpl<SwitchInst, ConstantInt, BasicBlock>;
using ConstCaseHandle =
llvm::SwitchInst::CaseHandleImpl<const SwitchInst, const ConstantInt,
const BasicBlock>;
using CaseIt = llvm::SwitchInst::CaseIteratorImpl<CaseHandle>;
using ConstCaseIt = llvm::SwitchInst::CaseIteratorImpl<ConstCaseHandle>;
CaseHandleImpl<llvm::SwitchInst::CaseIt, BasicBlock, ConstantInt>;
using CaseIt = CaseItImpl<llvm::SwitchInst::CaseIt, BasicBlock, ConstantInt>;

using ConstCaseHandle = CaseHandleImpl<llvm::SwitchInst::ConstCaseIt,
const BasicBlock, const ConstantInt>;
using ConstCaseIt = CaseItImpl<llvm::SwitchInst::ConstCaseIt,
const BasicBlock, const ConstantInt>;

/// Returns a read/write iterator that points to the first case in the
/// SwitchInst.
CaseIt case_begin() { return CaseIt(this, 0); }
ConstCaseIt case_begin() const { return ConstCaseIt(this, 0); }
CaseIt case_begin() {
return CaseIt(Ctx, cast<llvm::SwitchInst>(Val)->case_begin());
}
ConstCaseIt case_begin() const {
return ConstCaseIt(Ctx, cast<llvm::SwitchInst>(Val)->case_begin());
}
/// Returns a read/write iterator that points one past the last in the
/// SwitchInst.
CaseIt case_end() { return CaseIt(this, getNumCases()); }
ConstCaseIt case_end() const { return ConstCaseIt(this, getNumCases()); }
CaseIt case_end() {
return CaseIt(Ctx, cast<llvm::SwitchInst>(Val)->case_end());
}
ConstCaseIt case_end() const {
return ConstCaseIt(Ctx, cast<llvm::SwitchInst>(Val)->case_end());
}
/// Iteration adapter for range-for loops.
iterator_range<CaseIt> cases() {
return make_range(case_begin(), case_end());
}
iterator_range<ConstCaseIt> cases() const {
return make_range(case_begin(), case_end());
}
CaseIt case_default() { return CaseIt(this, DefaultPseudoIndex); }
CaseIt case_default() {
return CaseIt(Ctx, cast<llvm::SwitchInst>(Val)->case_default());
}
ConstCaseIt case_default() const {
return ConstCaseIt(this, DefaultPseudoIndex);
return ConstCaseIt(Ctx, cast<llvm::SwitchInst>(Val)->case_default());
}
CaseIt findCaseValue(const ConstantInt *C) {
return CaseIt(
this,
const_cast<const SwitchInst *>(this)->findCaseValue(C)->getCaseIndex());
const llvm::ConstantInt *LLVMC = cast<llvm::ConstantInt>(C->Val);
return CaseIt(Ctx, cast<llvm::SwitchInst>(Val)->findCaseValue(LLVMC));
}
ConstCaseIt findCaseValue(const ConstantInt *C) const {
ConstCaseIt I = llvm::find_if(cases(), [C](const ConstCaseHandle &Case) {
return Case.getCaseValue() == C;
});
if (I != case_end())
return I;
return case_default();
const llvm::ConstantInt *LLVMC = cast<llvm::ConstantInt>(C->Val);
return ConstCaseIt(Ctx, cast<llvm::SwitchInst>(Val)->findCaseValue(LLVMC));
}
LLVM_ABI ConstantInt *findCaseDest(BasicBlock *BB);

Expand Down
1 change: 0 additions & 1 deletion llvm/include/llvm/TargetParser/AArch64TargetParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "llvm/Support/VersionTuple.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/SubtargetFeature.h"
#include <array>
#include <set>
#include <vector>

Expand Down
Loading