Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
905c7aa
[CodeGen] Use MCRegUnit in two more TRI methods (NFC) (#167680)
s-barannikov Nov 12, 2025
d3a813b
[DTLTO][PS4,PS5] Suppress system headers directory warning (#167685)
bd1976bris Nov 12, 2025
9ba738a
[VPlan] Fix assert in store-user in narrowToSingleScalars (#167686)
artagnon Nov 12, 2025
dba8507
[HLSL] Rework semantic handling as attributes (#166796)
Keenuts Nov 12, 2025
b9eb974
[lldb][ClangModulesDeclVendor] Fix use-after-free of diagnostics stre…
Michael137 Nov 12, 2025
830f690
[Docs] Fix typo in vp.load.ff intrinsic documentation. NFC (#167721)
topperc Nov 12, 2025
58ac95d
[AMDGPU] Avoid changing minOccupancy if unclustered schedule was not …
dhruvachak Nov 12, 2025
24be0ba
DAG: Fix assert on nofpclass call with aggregate return (#167725)
arsenm Nov 12, 2025
a22834a
[CIR] Handle null base class initialization (#167023)
andykaylor Nov 12, 2025
a5a78d0
[mlir][linalg][python] Add Python Bindings for Inferring Contraction …
bangtianliu Nov 12, 2025
4d772de
[X86] Remove Redundant Default Destructor
boomanaiden154 Nov 12, 2025
201a461
AArch64: Add baseline test for treating exp as known positive (#167603)
arsenm Nov 12, 2025
ec4207b
[lldb] Adapt shared cache ObjC class metadata extraction for long ter…
bulbazord Nov 12, 2025
7f4a3a9
[MLIR][XeGPU][TransformOps] Add convert_layout op (#167342)
tkarna Nov 12, 2025
280d0df
[lldb] Remove test that disassembles all of Foundation (#167596)
bulbazord Nov 12, 2025
87da620
[lldb][ClangExpressionParser] Clean up ownership of members in ClangD…
Michael137 Nov 12, 2025
0a34d37
[mlir][memref] Remove invalid `extract_aligned_pointer_as_index` fold…
Hardcode84 Nov 12, 2025
28dbbba
[bazel] Fix LLDB :Host Build (#167711)
boomanaiden154 Nov 12, 2025
242a6cb
[libc] Handle the `unknown` default target in CMake (#115122)
petrhosek Nov 12, 2025
e7bccc7
[flang] Fixed regression in copy-in/copy-out (#161259)
eugeneepshteyn Nov 12, 2025
43ca08d
[libc++] Simplify the implementation of aligned_storage (#162459)
philnik777 Nov 12, 2025
0385a18
DAG: exp opcodes cannotBeOrderedNegativeFP (#167604)
arsenm Nov 12, 2025
cc54ee8
[clang][HLSL] Fix crash issue due to Twine usage
darkbuck Nov 12, 2025
0c0c1a7
[X86][NewPM] Port DynAllocaExpander to New PM
boomanaiden154 Nov 12, 2025
782759b
DAG: Use poison when widening build_vector (#167631)
arsenm Nov 12, 2025
e5e9c3b
[libunwind] Fix build error because of wrong register size (#167743)
medismailben Nov 12, 2025
a799a8e
[CIR] Cast record size to uint64 to prevent overflow (#167525)
HendrikHuebner Nov 12, 2025
47cef55
[AsmPrinter] Replace improper use of Register with MCRegUnit (NFC) (#…
s-barannikov Nov 12, 2025
919bff7
[Github] Make bazel workflow run all tests (#167576)
boomanaiden154 Nov 12, 2025
6806349
[lldb] Split up shared cache objc metadata extractor body (#167761)
bulbazord Nov 12, 2025
dfdada1
CodeGen: Remove target hook for terminal rule (#165962)
arsenm Nov 12, 2025
603ba84
[AArch64][llvm] Add instructions for FEAT_MOPS_GO (#164913)
jthackray Nov 12, 2025
9361113
[CodeGen] Remove the check that allowed non-POD compound literals to …
ahatanak Nov 12, 2025
1d2429b
Revert "[HLSL] Rework semantic handling as attributes #166796" (#167759)
Keenuts Nov 12, 2025
260df80
[CIR] Handle scalar DerivedToBase cast expressions (#167370)
andykaylor Nov 12, 2025
cf9cb54
[CIR] Emit promise declaration in coroutine (#166683)
Andres-Salamanca Nov 12, 2025
66da12a
[flang][OpenMP] Delete include of unused header, NFC (#167762)
kparzysz Nov 12, 2025
6636659
CodeGen/AMDGPU: Allow 3-address conversion of bundled instructions (#…
nhaehnle Nov 12, 2025
53a65ba
[VPlan] Don't look up recipe for IV step via RecipeBuilder. (NFC)
fhahn Nov 12, 2025
71763a5
[clang] Extract `CompilerInvocation::visitPaths()` (#167420)
jansvoboda11 Nov 12, 2025
b6bcfde
[VPlan] Get opcode & type from recipe in adjustRecipesForReduction (NFC)
fhahn Nov 12, 2025
bdf3f24
[mlir][NVVM] Add support for barrier0-reduction operation (#167036)
clementval Nov 12, 2025
2e489f7
CodeGen: Fix CodeView crashes with empty llvm.dbg.cu (#163286)
arsenm Nov 12, 2025
342bf57
[LifetimeSafety] Ignore parentheses when tracking expressions (#167245)
usx95 Nov 12, 2025
4b05581
[AMDGPU] Regenerate gfx1250 wmma MC test. NFC (#167773)
rampitec Nov 12, 2025
dbf77e4
[utils] revamp options controlling lit's output (#167192)
hnrklssn Nov 12, 2025
a01a921
[ARM] Prevent stack argument overwrite during tail calls (#166492)
dtellenbach Nov 12, 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
10 changes: 7 additions & 3 deletions .github/workflows/bazel-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ jobs:
bazel-build:
name: "Bazel Build/Test"
runs-on: llvm-premerge-linux-runners
# Only run on US Central workers so we only have to keep one cache warm as
# the cache buckets are per cluster.
runs-on:
group: llvm-premerge-cluster-us-central
labels: llvm-premerge-linux-runners
if: github.repository == 'llvm/llvm-project'
steps:
- name: Fetch LLVM sources
Expand All @@ -44,7 +48,7 @@ jobs:
- name: Setup System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmpfr-dev libpfm4-dev
sudo apt-get install -y libmpfr-dev libpfm4-dev m4 libedit-dev
sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.27.0/bazelisk-amd64.deb > /tmp/bazelisk.deb
sudo apt-get install -y /tmp/bazelisk.deb
rm /tmp/bazelisk.deb
Expand All @@ -54,4 +58,4 @@ jobs:
bazelisk test --config=ci --sandbox_base="" \
--remote_cache=https://storage.googleapis.com/$CACHE_GCS_BUCKET-bazel \
--google_default_credentials \
@llvm-project//llvm/unittests:adt_tests
@llvm-project//... //...
2 changes: 2 additions & 0 deletions clang/include/clang/CIR/MissingFeatures.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ struct MissingFeatures {
static bool coroEndBuiltinCall() { return false; }
static bool coroutineFrame() { return false; }
static bool emitBodyAndFallthrough() { return false; }
static bool coroOutsideFrameMD() { return false; }

// Various handling of deferred processing in CIRGenModule.
static bool cgmRelease() { return false; }
Expand Down Expand Up @@ -298,6 +299,7 @@ struct MissingFeatures {
static bool opTBAA() { return false; }
static bool peepholeProtection() { return false; }
static bool pgoUse() { return false; }
static bool pointerAuthentication() { return false; }
static bool pointerOverflowSanitizer() { return false; }
static bool preservedAccessIndexRegion() { return false; }
static bool requiresCleanups() { return false; }
Expand Down
13 changes: 13 additions & 0 deletions clang/include/clang/Frontend/CompilerInvocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ class CompilerInvocationBase {
}
/// @}

/// Visitation.
/// @{
/// Visits paths stored in the invocation. The callback may return true to
/// short-circuit the visitation, or return false to continue visiting.
void visitPaths(llvm::function_ref<bool(StringRef)> Callback) const;
/// @}

/// Command line generation.
/// @{
using StringAllocator = llvm::function_ref<const char *(const Twine &)>;
Expand Down Expand Up @@ -181,6 +188,12 @@ class CompilerInvocationBase {
/// This is a (less-efficient) wrapper over generateCC1CommandLine().
std::vector<std::string> getCC1CommandLine() const;

protected:
/// Visits paths stored in the invocation. This is generally unsafe to call
/// directly, and each sub-class need to ensure calling this doesn't violate
/// its invariants.
void visitPathsImpl(llvm::function_ref<bool(std::string &)> Predicate);

private:
/// Generate command line options from DiagnosticOptions.
static void GenerateDiagnosticArgs(const DiagnosticOptions &Opts,
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Frontend/FrontendOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ class FrontendInputFile {
/// Whether we're dealing with a 'system' input (vs. a 'user' input).
bool IsSystem = false;

friend class CompilerInvocationBase;

public:
FrontendInputFile() = default;
FrontendInputFile(StringRef File, InputKind Kind, bool IsSystem = false)
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/Analysis/LifetimeSafety/Origins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Origin &OriginManager::addOrigin(OriginID ID, const clang::Expr &E) {

// TODO: Mark this method as const once we remove the call to getOrCreate.
OriginID OriginManager::get(const Expr &E) {
if (auto *ParenIgnored = E.IgnoreParens(); ParenIgnored != &E)
return get(*ParenIgnored);
auto It = ExprToOriginID.find(&E);
if (It != ExprToOriginID.end())
return It->second;
Expand Down
104 changes: 102 additions & 2 deletions clang/lib/CIR/CodeGen/CIRGenCoroutine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "CIRGenFunction.h"
#include "mlir/Support/LLVM.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/CIR/Dialect/IR/CIRTypes.h"
#include "clang/CIR/MissingFeatures.h"
Expand All @@ -33,6 +34,65 @@ struct clang::CIRGen::CGCoroData {
CIRGenFunction::CGCoroInfo::CGCoroInfo() {}
CIRGenFunction::CGCoroInfo::~CGCoroInfo() {}

namespace {
// FIXME: both GetParamRef and ParamReferenceReplacerRAII are good template
// candidates to be shared among LLVM / CIR codegen.

// Hunts for the parameter reference in the parameter copy/move declaration.
struct GetParamRef : public StmtVisitor<GetParamRef> {
public:
DeclRefExpr *expr = nullptr;
GetParamRef() {}
void VisitDeclRefExpr(DeclRefExpr *e) {
assert(expr == nullptr && "multilple declref in param move");
expr = e;
}
void VisitStmt(Stmt *s) {
for (Stmt *c : s->children()) {
if (c)
Visit(c);
}
}
};

// This class replaces references to parameters to their copies by changing
// the addresses in CGF.LocalDeclMap and restoring back the original values in
// its destructor.
struct ParamReferenceReplacerRAII {
CIRGenFunction::DeclMapTy savedLocals;
CIRGenFunction::DeclMapTy &localDeclMap;

ParamReferenceReplacerRAII(CIRGenFunction::DeclMapTy &localDeclMap)
: localDeclMap(localDeclMap) {}

void addCopy(const DeclStmt *pm) {
// Figure out what param it refers to.

assert(pm->isSingleDecl());
const VarDecl *vd = static_cast<const VarDecl *>(pm->getSingleDecl());
const Expr *initExpr = vd->getInit();
GetParamRef visitor;
visitor.Visit(const_cast<Expr *>(initExpr));
assert(visitor.expr);
DeclRefExpr *dreOrig = visitor.expr;
auto *pd = dreOrig->getDecl();

auto it = localDeclMap.find(pd);
assert(it != localDeclMap.end() && "parameter is not found");
savedLocals.insert({pd, it->second});

auto copyIt = localDeclMap.find(vd);
assert(copyIt != localDeclMap.end() && "parameter copy is not found");
it->second = copyIt->getSecond();
}

~ParamReferenceReplacerRAII() {
for (auto &&savedLocal : savedLocals) {
localDeclMap.insert({savedLocal.first, savedLocal.second});
}
}
};
} // namespace
static void createCoroData(CIRGenFunction &cgf,
CIRGenFunction::CGCoroInfo &curCoro,
cir::CallOp coroId) {
Expand Down Expand Up @@ -149,7 +209,47 @@ CIRGenFunction::emitCoroutineBody(const CoroutineBodyStmt &s) {
if (s.getReturnStmtOnAllocFailure())
cgm.errorNYI("handle coroutine return alloc failure");

assert(!cir::MissingFeatures::generateDebugInfo());
assert(!cir::MissingFeatures::emitBodyAndFallthrough());
{
assert(!cir::MissingFeatures::generateDebugInfo());
ParamReferenceReplacerRAII paramReplacer(localDeclMap);
// Create mapping between parameters and copy-params for coroutine
// function.
llvm::ArrayRef<const Stmt *> paramMoves = s.getParamMoves();
assert((paramMoves.size() == 0 || (paramMoves.size() == fnArgs.size())) &&
"ParamMoves and FnArgs should be the same size for coroutine "
"function");
// For zipping the arg map into debug info.
assert(!cir::MissingFeatures::generateDebugInfo());

// Create parameter copies. We do it before creating a promise, since an
// evolution of coroutine TS may allow promise constructor to observe
// parameter copies.
assert(!cir::MissingFeatures::coroOutsideFrameMD());
for (auto *pm : paramMoves) {
if (emitStmt(pm, /*useCurrentScope=*/true).failed())
return mlir::failure();
paramReplacer.addCopy(cast<DeclStmt>(pm));
}

if (emitStmt(s.getPromiseDeclStmt(), /*useCurrentScope=*/true).failed())
return mlir::failure();
// returnValue should be valid as long as the coroutine's return type
// is not void. The assertion could help us to reduce the check later.
assert(returnValue.isValid() == (bool)s.getReturnStmt());
// Now we have the promise, initialize the GRO.
// We need to emit `get_return_object` first. According to:
// [dcl.fct.def.coroutine]p7
// The call to get_return_­object is sequenced before the call to
// initial_suspend and is invoked at most once.
//
// So we couldn't emit return value when we emit return statment,
// otherwise the call to get_return_object wouldn't be in front
// of initial_suspend.
if (returnValue.isValid())
emitAnyExprToMem(s.getReturnValue(), returnValue,
s.getReturnValue()->getType().getQualifiers(),
/*isInit*/ true);
assert(!cir::MissingFeatures::emitBodyAndFallthrough());
}
return mlir::success();
}
73 changes: 0 additions & 73 deletions clang/lib/CIR/CodeGen/CIRGenExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2134,79 +2134,6 @@ RValue CIRGenFunction::emitCXXMemberCallExpr(const CXXMemberCallExpr *ce,
ce, md, returnValue, hasQualifier, qualifier, isArrow, base);
}

void CIRGenFunction::emitCXXConstructExpr(const CXXConstructExpr *e,
AggValueSlot dest) {
assert(!dest.isIgnored() && "Must have a destination!");
const CXXConstructorDecl *cd = e->getConstructor();

// If we require zero initialization before (or instead of) calling the
// constructor, as can be the case with a non-user-provided default
// constructor, emit the zero initialization now, unless destination is
// already zeroed.
if (e->requiresZeroInitialization() && !dest.isZeroed()) {
switch (e->getConstructionKind()) {
case CXXConstructionKind::Delegating:
case CXXConstructionKind::Complete:
emitNullInitialization(getLoc(e->getSourceRange()), dest.getAddress(),
e->getType());
break;
case CXXConstructionKind::VirtualBase:
case CXXConstructionKind::NonVirtualBase:
cgm.errorNYI(e->getSourceRange(),
"emitCXXConstructExpr: base requires initialization");
break;
}
}

// If this is a call to a trivial default constructor, do nothing.
if (cd->isTrivial() && cd->isDefaultConstructor())
return;

// Elide the constructor if we're constructing from a temporary
if (getLangOpts().ElideConstructors && e->isElidable()) {
// FIXME: This only handles the simplest case, where the source object is
// passed directly as the first argument to the constructor. This
// should also handle stepping through implicit casts and conversion
// sequences which involve two steps, with a conversion operator
// follwed by a converting constructor.
const Expr *srcObj = e->getArg(0);
assert(srcObj->isTemporaryObject(getContext(), cd->getParent()));
assert(
getContext().hasSameUnqualifiedType(e->getType(), srcObj->getType()));
emitAggExpr(srcObj, dest);
return;
}

if (const ArrayType *arrayType = getContext().getAsArrayType(e->getType())) {
assert(!cir::MissingFeatures::sanitizers());
emitCXXAggrConstructorCall(cd, arrayType, dest.getAddress(), e, false);
} else {

clang::CXXCtorType type = Ctor_Complete;
bool forVirtualBase = false;
bool delegating = false;

switch (e->getConstructionKind()) {
case CXXConstructionKind::Complete:
type = Ctor_Complete;
break;
case CXXConstructionKind::Delegating:
// We should be emitting a constructor; GlobalDecl will assert this
type = curGD.getCtorType();
delegating = true;
break;
case CXXConstructionKind::VirtualBase:
forVirtualBase = true;
[[fallthrough]];
case CXXConstructionKind::NonVirtualBase:
type = Ctor_Base;
break;
}

emitCXXConstructorCall(cd, type, forVirtualBase, delegating, dest, e);
}
}

RValue CIRGenFunction::emitReferenceBindingToExpr(const Expr *e) {
// Emit the expression as an lvalue.
LValue lv = emitLValue(e);
Expand Down
25 changes: 19 additions & 6 deletions clang/lib/CIR/CodeGen/CIRGenExprAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ void AggExprEmitter::visitCXXParenListOrInitListExpr(
Expr *e, ArrayRef<Expr *> args, FieldDecl *initializedFieldInUnion,
Expr *arrayFiller) {

const AggValueSlot dest =
ensureSlot(cgf.getLoc(e->getSourceRange()), e->getType());
const mlir::Location loc = cgf.getLoc(e->getSourceRange());
const AggValueSlot dest = ensureSlot(loc, e->getType());

if (e->getType()->isConstantArrayType()) {
cir::ArrayType arrayTy =
Expand Down Expand Up @@ -819,10 +819,23 @@ void AggExprEmitter::visitCXXParenListOrInitListExpr(
if (auto *cxxrd = dyn_cast<CXXRecordDecl>(record)) {
assert(numInitElements >= cxxrd->getNumBases() &&
"missing initializer for base class");
if (cxxrd->getNumBases() > 0) {
cgf.cgm.errorNYI(e->getSourceRange(),
"visitCXXParenListOrInitListExpr base class init");
return;
for (auto &base : cxxrd->bases()) {
assert(!base.isVirtual() && "should not see vbases here");
CXXRecordDecl *baseRD = base.getType()->getAsCXXRecordDecl();
Address address = cgf.getAddressOfDirectBaseInCompleteClass(
loc, dest.getAddress(), cxxrd, baseRD,
/*baseIsVirtual=*/false);
assert(!cir::MissingFeatures::aggValueSlotGC());
AggValueSlot aggSlot = AggValueSlot::forAddr(
address, Qualifiers(), AggValueSlot::IsDestructed,
AggValueSlot::IsNotAliased,
cgf.getOverlapForBaseInit(cxxrd, baseRD, false));
cgf.emitAggExpr(args[curInitIndex++], aggSlot);
if (base.getType().isDestructedType()) {
cgf.cgm.errorNYI(e->getSourceRange(),
"push deferred deactivation cleanup");
return;
}
}
}

Expand Down
Loading
Loading