Skip to content

Commit 84d710d

Browse files
authored
Merge branch 'main' into implicit-binding-cbuffers
2 parents d82236d + 520773b commit 84d710d

File tree

167 files changed

+4587
-3968
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+4587
-3968
lines changed

bolt/test/X86/callcont-fallthru.s

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# RUN: %clangxx %cxxflags %s %t.so -o %t -Wl,-q -nostdlib
77
# RUN: link_fdata %s %t %t.pat PREAGGT1
88
# RUN: link_fdata %s %t %t.pat2 PREAGGT2
9-
# RUN: link_fdata %s %t %t.patplt PREAGGPLT
9+
# DONTRUN: link_fdata %s %t %t.patplt PREAGGPLT
1010

1111
# RUN: llvm-strip --strip-unneeded %t -o %t.strip
1212
# RUN: llvm-objcopy --remove-section=.eh_frame %t.strip %t.noeh
@@ -26,8 +26,8 @@
2626

2727
## Check pre-aggregated traces don't report zero-sized PLT fall-through as
2828
## invalid trace
29-
# RUN: llvm-bolt %t.strip --pa -p %t.patplt -o %t.out | FileCheck %s \
30-
# RUN: --check-prefix=CHECK-PLT
29+
# DONTRUN: llvm-bolt %t.strip --pa -p %t.patplt -o %t.out | FileCheck %s \
30+
# DONTRUN: --check-prefix=CHECK-PLT
3131
# CHECK-PLT: traces mismatching disassembled function contents: 0
3232

3333
.globl foo

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def PtrStrideOp : CIR_Op<"ptr_stride",
269269
let extraClassDeclaration = [{
270270
// Get type pointed by the base pointer.
271271
mlir::Type getElementTy() {
272-
return mlir::cast<cir::PointerType>(getBase().getType()).getPointee();
272+
return getBase().getType().getPointee();
273273
}
274274
}];
275275
}
@@ -1710,7 +1710,7 @@ def GetMemberOp : CIR_Op<"get_member"> {
17101710

17111711
/// Return the result type.
17121712
cir::PointerType getResultTy() {
1713-
return mlir::cast<cir::PointerType>(getResult().getType());
1713+
return getResult().getType();
17141714
}
17151715
}];
17161716

clang/include/clang/StaticAnalyzer/Core/PathSensitive/SMTConstraintManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ class SMTConstraintManager : public clang::ento::SimpleConstraintManager {
301301
llvm_unreachable("Unsupported expression to reason about!");
302302
}
303303

304+
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
304305
/// Dumps SMT formula
305306
LLVM_DUMP_METHOD void dump() const { Solver->dump(); }
307+
#endif
306308

307309
protected:
308310
// Check whether a new model is satisfiable, and update the program state.

clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,7 @@ class SymbolConjured : public SymbolData {
103103
const Stmt *getStmt() const {
104104
switch (Elem->getKind()) {
105105
case CFGElement::Initializer:
106-
if (const auto *Init = Elem->castAs<CFGInitializer>().getInitializer()) {
107-
return Init->getInit();
108-
}
109-
return nullptr;
106+
return Elem->castAs<CFGInitializer>().getInitializer()->getInit();
110107
case CFGElement::ScopeBegin:
111108
return Elem->castAs<CFGScopeBegin>().getTriggerStmt();
112109
case CFGElement::ScopeEnd:

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6115,8 +6115,9 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
61156115
case Builtin::BI__builtin_thread_pointer: {
61166116
if (!getContext().getTargetInfo().isTLSSupported())
61176117
CGM.ErrorUnsupported(E, "__builtin_thread_pointer");
6118-
// Fall through - it's already mapped to the intrinsic by ClangBuiltin.
6119-
break;
6118+
6119+
return RValue::get(Builder.CreateIntrinsic(llvm::Intrinsic::thread_pointer,
6120+
{GlobalsInt8PtrTy}, {}));
61206121
}
61216122
case Builtin::BI__builtin_os_log_format:
61226123
return emitBuiltinOSLogFormat(*E);

clang/lib/CodeGen/CGCall.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,19 +1366,23 @@ static llvm::Value *CreateCoercedLoad(Address Src, llvm::Type *Ty,
13661366
// If we are casting a fixed i8 vector to a scalable i1 predicate
13671367
// vector, use a vector insert and bitcast the result.
13681368
if (ScalableDstTy->getElementType()->isIntegerTy(1) &&
1369-
ScalableDstTy->getElementCount().isKnownMultipleOf(8) &&
13701369
FixedSrcTy->getElementType()->isIntegerTy(8)) {
13711370
ScalableDstTy = llvm::ScalableVectorType::get(
13721371
FixedSrcTy->getElementType(),
1373-
ScalableDstTy->getElementCount().getKnownMinValue() / 8);
1372+
llvm::divideCeil(
1373+
ScalableDstTy->getElementCount().getKnownMinValue(), 8));
13741374
}
13751375
if (ScalableDstTy->getElementType() == FixedSrcTy->getElementType()) {
13761376
auto *Load = CGF.Builder.CreateLoad(Src);
13771377
auto *PoisonVec = llvm::PoisonValue::get(ScalableDstTy);
13781378
llvm::Value *Result = CGF.Builder.CreateInsertVector(
13791379
ScalableDstTy, PoisonVec, Load, uint64_t(0), "cast.scalable");
1380-
if (ScalableDstTy != Ty)
1381-
Result = CGF.Builder.CreateBitCast(Result, Ty);
1380+
ScalableDstTy = cast<llvm::ScalableVectorType>(
1381+
llvm::VectorType::getWithSizeAndScalar(ScalableDstTy, Ty));
1382+
if (Result->getType() != ScalableDstTy)
1383+
Result = CGF.Builder.CreateBitCast(Result, ScalableDstTy);
1384+
if (Result->getType() != Ty)
1385+
Result = CGF.Builder.CreateExtractVector(Ty, Result, uint64_t(0));
13821386
return Result;
13831387
}
13841388
}
@@ -1476,8 +1480,14 @@ CoerceScalableToFixed(CodeGenFunction &CGF, llvm::FixedVectorType *ToTy,
14761480
// If we are casting a scalable i1 predicate vector to a fixed i8
14771481
// vector, first bitcast the source.
14781482
if (FromTy->getElementType()->isIntegerTy(1) &&
1479-
FromTy->getElementCount().isKnownMultipleOf(8) &&
14801483
ToTy->getElementType() == CGF.Builder.getInt8Ty()) {
1484+
if (!FromTy->getElementCount().isKnownMultipleOf(8)) {
1485+
FromTy = llvm::ScalableVectorType::get(
1486+
FromTy->getElementType(),
1487+
llvm::alignTo<8>(FromTy->getElementCount().getKnownMinValue()));
1488+
llvm::Value *ZeroVec = llvm::Constant::getNullValue(FromTy);
1489+
V = CGF.Builder.CreateInsertVector(FromTy, ZeroVec, V, uint64_t(0));
1490+
}
14811491
FromTy = llvm::ScalableVectorType::get(
14821492
ToTy->getElementType(),
14831493
FromTy->getElementCount().getKnownMinValue() / 8);

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,18 +2491,22 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
24912491
// If we are casting a fixed i8 vector to a scalable i1 predicate
24922492
// vector, use a vector insert and bitcast the result.
24932493
if (ScalableDstTy->getElementType()->isIntegerTy(1) &&
2494-
ScalableDstTy->getElementCount().isKnownMultipleOf(8) &&
24952494
FixedSrcTy->getElementType()->isIntegerTy(8)) {
24962495
ScalableDstTy = llvm::ScalableVectorType::get(
24972496
FixedSrcTy->getElementType(),
2498-
ScalableDstTy->getElementCount().getKnownMinValue() / 8);
2497+
llvm::divideCeil(
2498+
ScalableDstTy->getElementCount().getKnownMinValue(), 8));
24992499
}
25002500
if (FixedSrcTy->getElementType() == ScalableDstTy->getElementType()) {
25012501
llvm::Value *PoisonVec = llvm::PoisonValue::get(ScalableDstTy);
25022502
llvm::Value *Result = Builder.CreateInsertVector(
25032503
ScalableDstTy, PoisonVec, Src, uint64_t(0), "cast.scalable");
2504+
ScalableDstTy = cast<llvm::ScalableVectorType>(
2505+
llvm::VectorType::getWithSizeAndScalar(ScalableDstTy, DstTy));
2506+
if (Result->getType() != ScalableDstTy)
2507+
Result = Builder.CreateBitCast(Result, ScalableDstTy);
25042508
if (Result->getType() != DstTy)
2505-
Result = Builder.CreateBitCast(Result, DstTy);
2509+
Result = Builder.CreateExtractVector(DstTy, Result, uint64_t(0));
25062510
return Result;
25072511
}
25082512
}
@@ -2516,8 +2520,17 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
25162520
// If we are casting a scalable i1 predicate vector to a fixed i8
25172521
// vector, bitcast the source and use a vector extract.
25182522
if (ScalableSrcTy->getElementType()->isIntegerTy(1) &&
2519-
ScalableSrcTy->getElementCount().isKnownMultipleOf(8) &&
25202523
FixedDstTy->getElementType()->isIntegerTy(8)) {
2524+
if (!ScalableSrcTy->getElementCount().isKnownMultipleOf(8)) {
2525+
ScalableSrcTy = llvm::ScalableVectorType::get(
2526+
ScalableSrcTy->getElementType(),
2527+
llvm::alignTo<8>(
2528+
ScalableSrcTy->getElementCount().getKnownMinValue()));
2529+
llvm::Value *ZeroVec = llvm::Constant::getNullValue(ScalableSrcTy);
2530+
Src = Builder.CreateInsertVector(ScalableSrcTy, ZeroVec, Src,
2531+
uint64_t(0));
2532+
}
2533+
25212534
ScalableSrcTy = llvm::ScalableVectorType::get(
25222535
FixedDstTy->getElementType(),
25232536
ScalableSrcTy->getElementCount().getKnownMinValue() / 8);

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ static bool shouldAssumeDSOLocal(const CodeGenModule &CGM,
16891689

16901690
const llvm::Triple &TT = CGM.getTriple();
16911691
const auto &CGOpts = CGM.getCodeGenOpts();
1692-
if (TT.isWindowsGNUEnvironment()) {
1692+
if (TT.isOSCygMing()) {
16931693
// In MinGW, variables without DLLImport can still be automatically
16941694
// imported from a DLL by the linker; don't mark variables that
16951695
// potentially could come from another DLL as DSO local.

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3754,7 +3754,7 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM,
37543754
bool IsDLLImport = RD->hasAttr<DLLImportAttr>();
37553755

37563756
// Don't import the RTTI but emit it locally.
3757-
if (CGM.getTriple().isWindowsGNUEnvironment())
3757+
if (CGM.getTriple().isOSCygMing())
37583758
return false;
37593759

37603760
if (CGM.getVTables().isVTableExternal(RD)) {
@@ -4041,10 +4041,7 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
40414041
return llvm::GlobalValue::ExternalLinkage;
40424042
// MinGW always uses LinkOnceODRLinkage for type info.
40434043
if (RD->isDynamicClass() &&
4044-
!CGM.getContext()
4045-
.getTargetInfo()
4046-
.getTriple()
4047-
.isWindowsGNUEnvironment())
4044+
!CGM.getContext().getTargetInfo().getTriple().isOSCygMing())
40484045
return CGM.getVTableLinkage(RD);
40494046
}
40504047

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6274,7 +6274,7 @@ static void ReferenceDllExportedMembers(Sema &S, CXXRecordDecl *Class) {
62746274
}
62756275
} MarkingDllexportedContext(S, Class, ClassAttr->getLocation());
62766276

6277-
if (S.Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
6277+
if (S.Context.getTargetInfo().getTriple().isOSCygMing())
62786278
S.MarkVTableUsed(Class->getLocation(), Class, true);
62796279

62806280
for (Decl *Member : Class->decls()) {
@@ -6576,7 +6576,7 @@ void Sema::checkClassLevelDLLAttribute(CXXRecordDecl *Class) {
65766576
// declarations, except in MinGW mode.
65776577
if (ClassExported && !ClassAttr->isInherited() &&
65786578
TSK == TSK_ExplicitInstantiationDeclaration &&
6579-
!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
6579+
!Context.getTargetInfo().getTriple().isOSCygMing()) {
65806580
Class->dropAttr<DLLExportAttr>();
65816581
return;
65826582
}

0 commit comments

Comments
 (0)