Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from llvm:main #5550

Merged
merged 49 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
52b5947
SCEV: re-org a test, regen via UTC (#126237)
artagnon Feb 7, 2025
1454fc9
[mlir][spirv] Add definition for OpGroupNonUniformBallotBitCount (#12…
IgWod-IMG Feb 7, 2025
a69975d
[clang][bytecode] Remove unnecessary if statement (#126223)
tbaederr Feb 7, 2025
7f21c77
ValueTracking: modernize isKnownInversion (NFC) (#126234)
artagnon Feb 7, 2025
2a6cfbd
[clang] [test] Adjust XFAILs for windows in unique_object_duplication…
mstorsjo Feb 7, 2025
3fdb348
[LangRef] Fix some formatting issues (NFC) (#126224)
MacDue Feb 7, 2025
991123f
[X86] Add test where storing return addr clobbers argument stack slot.
fhahn Feb 7, 2025
b51fc2a
[flang] Modifications to ieee_support_standard (#125967)
vdonaldson Feb 7, 2025
cfd8980
[SPIRV] Handle vector load/store for RWBuffer (#125581)
s-perron Feb 7, 2025
a361de6
[RDF] Create phi nodes for clobbering defs (#123694)
yandalur Feb 7, 2025
1f2c36a
[ARM] Reject fixed-point VCVT with different registers (#126232)
ostannard Feb 7, 2025
b284a84
[MLIR][NVVM] Add default constructor for `nvvm.barrier` [NFC] (#126225)
grypp Feb 7, 2025
0227396
Revert "[libc++] Reduce std::conjunction overhead (#124259)"
philnik777 Feb 7, 2025
c8b2ba7
[LLD][COFF] Add test for hybrid patchable thunks on ARM64X (NFC) (#12…
cjacek Feb 7, 2025
abd31b4
[LLD][MinGW] Exclude load config symbols from auto-export (#126134)
cjacek Feb 7, 2025
2b43543
[AMDGPU][True16][MC][CodeGen] true16 for v_alignbyte_b32 (#125706)
broxigarchen Feb 7, 2025
79e9887
[flang] test fix (#126251)
vdonaldson Feb 7, 2025
27598ab
[libc++] Further refactor sequence container benchmarks (#126129)
ldionne Feb 7, 2025
1611059
[VPlan] Compute cost for binary op VPInstruction with underlying valu…
fhahn Feb 7, 2025
1f67070
[ViewOpGraph] Improve GraphViz output (#125509)
ehein6 Feb 7, 2025
289b176
[SPIRV] Fix a warning
kazutakahirata Feb 7, 2025
46f5662
[Hexagon] Avoid repeated map lookups (NFC) (#126185)
kazutakahirata Feb 7, 2025
dbb20fc
[ObjectYAML] Avoid repeated hash lookups (NFC) (#126187)
kazutakahirata Feb 7, 2025
80a4718
[GVNHoist] Avoid repeated hash lookups (NFC) (#126189)
kazutakahirata Feb 7, 2025
0afbefa
[TableGen] Avoid repeated hash lookups (NFC) (#126190)
kazutakahirata Feb 7, 2025
d017042
[emacs][clang-format] Suppress reference to free variable errors (#12…
gutron Feb 7, 2025
247430e
[bazel] Temporarily disable a broken LookupAddressRangeWithStmtSequen…
hokein Feb 7, 2025
4c7cbb9
[flang] update PPC vector tests (NFC) (#126256)
kkwli Feb 7, 2025
2c43479
[AArch64] Fix op mask detection in performZExtDeinterleaveShuffleComb…
davemgreen Feb 7, 2025
f304049
[NVPTX] Add tcgen05 wait/fence/commit intrinsics (#126091)
durga4github Feb 7, 2025
1438c8d
[Fuchsia] Support PGO (#120323)
petrhosek Feb 7, 2025
4d7192a
[clang][doc] Provide documentation for FixedPointLiteral matcher (#12…
earnol Feb 7, 2025
3f8e280
[HLSL] Implement HLSL Elementwise casting (excluding splat cases); Re…
spall Feb 7, 2025
c4c22a5
[Clang][TableGen] Use PointerType::get(Context) in MVE TableGen emitt…
junlarsen Feb 7, 2025
92eeff4
[Clang] Forward `-Xarch_<arch> -Wl,foo` for GPU toolchains (#126248)
jhuber6 Feb 7, 2025
51759ff
fix: removes invalid token from LLVM_VERSION_SUFFIX in LIBC namespace…
samvangysegem Feb 7, 2025
7eaaa4e
[BoundsSafety][doc] Fix formatting (#126245)
pfusik Feb 7, 2025
bfba621
[clang-linker-wrapper][lit] Fix OpenMP SPIR-V ELF test again (#126142)
sarnex Feb 7, 2025
6832514
[mlir][Vector] Fold `vector.extract` from poison vector (#126122)
dcaballe Feb 7, 2025
571a987
[mlir][tosa] Change 'shape' of RESHAPE from attribute to input shape …
tatwaichong Feb 7, 2025
7aabbf2
[llvm][ELF] Separate out .dwo bytes written in stats (#126165)
aeubanks Feb 7, 2025
5a0075a
[mlir][Vector] Generate poison vectors in vector.shape_cast lowering …
dcaballe Feb 7, 2025
e566313
[libc][signal] clean up usage of sighandler_t (#125745)
nickdesaulniers Feb 7, 2025
2c4dd89
[mlir][Vector] Introduce poison in LowerVectorBitCast/Broadcast/Trans…
dcaballe Feb 7, 2025
f2a1103
[libc][stdfix] Implement fixed point `countlsfx` functions in llvm-li…
krishna2803 Feb 7, 2025
5566bfa
[RISCV] Improve RISCVOperand Printing (#126179)
lenary Feb 7, 2025
501901e
[HLSL][NFC] Add test check to make sure the resource handle gets stor…
hekota Feb 7, 2025
73f11ac
[mlir][tosa] Use explicit namespace for OpTrait. (#126286)
ScottTodd Feb 7, 2025
4df287a
[bazel] Add missing dependency for 5a0075adbb623c8661862b9af1272b8f43…
d0k Feb 7, 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
44 changes: 44 additions & 0 deletions clang/cmake/caches/Fuchsia-stage2-instrumented.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file sets up a CMakeCache for the second stage of a Fuchsia toolchain build.

include(${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake)

if(NOT APPLE)
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
endif()

set(CLANG_BOOTSTRAP_TARGETS
check-all
check-clang
check-lld
check-llvm
clang
clang-test-depends
toolchain-distribution
install-toolchain-distribution
install-toolchain-distribution-stripped
install-toolchain-distribution-toolchain
lld-test-depends
llvm-config
llvm-test-depends
test-depends
test-suite CACHE STRING "")

get_cmake_property(variableNames VARIABLES)
foreach(variableName ${variableNames})
if(variableName MATCHES "^STAGE2_")
string(REPLACE "STAGE2_" "" new_name ${variableName})
list(APPEND EXTRA_ARGS "-D${new_name}=${${variableName}}")
endif()
endforeach()

set(CLANG_PGO_TRAINING_DEPS
builtins
runtimes
CACHE STRING "")

# Setup the bootstrap build.
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
set(CLANG_BOOTSTRAP_CMAKE_ARGS
${EXTRA_ARGS}
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
CACHE STRING "")
55 changes: 32 additions & 23 deletions clang/cmake/caches/Fuchsia.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ else()
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "")
set(SANITIZER_CXX_ABI "libc++" CACHE STRING "")
set(SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
set(SANITIZER_TEST_CXX "libc++" CACHE STRING "")
set(SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "")
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
endif()
Expand Down Expand Up @@ -164,34 +174,29 @@ endif()

set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")

set(_FUCHSIA_BOOTSTRAP_TARGETS
check-all
check-clang
check-lld
check-llvm
check-polly
llvm-config
clang-test-depends
lld-test-depends
llvm-test-depends
test-suite
test-depends
toolchain-distribution
install-toolchain-distribution
install-toolchain-distribution-stripped
install-toolchain-distribution-toolchain
clang)
generate-profdata
stage2
stage2-toolchain-distribution
stage2-install-toolchain-distribution
stage2-install-toolchain-distribution-stripped
stage2-install-toolchain-distribution-toolchain
stage2-check-all
stage2-check-lld
stage2-check-llvm
stage2-check-clang
stage2-test-suite)

if(FUCHSIA_ENABLE_LLDB)
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
check-lldb
lldb-test-depends
debugger-distribution
install-debugger-distribution
install-debugger-distribution-stripped
install-debugger-distribution-toolchain)
stage2-check-lldb
stage2-debugger-distribution
stage2-install-debugger-distribution
stage2-install-debugger-distribution-stripped
stage2-install-debugger-distribution-toolchain)
endif()

set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
Expand All @@ -200,6 +205,7 @@ set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
get_cmake_property(variableNames VARIABLES)
foreach(variableName ${variableNames})
if(variableName MATCHES "^STAGE2_")
list(APPEND EXTRA_ARGS "-D${variableName}=${${variableName}}")
string(REPLACE "STAGE2_" "" new_name ${variableName})
string(REPLACE ";" "|" value "${${variableName}}")
list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
Expand All @@ -209,6 +215,9 @@ endforeach()
# TODO: This is a temporary workaround until we figure out the right solution.
set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")

set(LLVM_BUILTIN_TARGETS "default" CACHE STRING "")
set(LLVM_RUNTIME_TARGETS "default" CACHE STRING "")

# Setup the bootstrap build.
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
set(CLANG_BOOTSTRAP_EXTRA_DEPS
Expand All @@ -217,5 +226,5 @@ set(CLANG_BOOTSTRAP_EXTRA_DEPS
CACHE STRING "")
set(CLANG_BOOTSTRAP_CMAKE_ARGS
${EXTRA_ARGS}
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2-instrumented.cmake
CACHE STRING "")
7 changes: 4 additions & 3 deletions clang/docs/BoundsSafety.rst
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,8 @@ that has the define.
#if defined(__has_feature) && __has_feature(bounds_safety)
#define __counted_by(T) __attribute__((__counted_by__(T)))
// ... other bounds annotations
#else #define __counted_by(T) // defined as nothing
#else
#define __counted_by(T) // defined as nothing
// ... other bounds annotations
#endif

Expand Down Expand Up @@ -987,7 +988,7 @@ and it does not guarantee other types of memory safety properties. Consequently,
it may not prevent some of the secondary bounds safety violations caused by
other types of safety violations such as type confusion. For instance,
``-fbounds-safety`` does not perform type-safety checks on conversions between
`__single`` pointers of different pointee types (e.g., ``char *__single`` →
``__single`` pointers of different pointee types (e.g., ``char *__single`` →
``void *__single`` → ``int *__single``) beyond what the foundation languages
(C/C++) already offer.

Expand All @@ -1003,4 +1004,4 @@ Try it out

Your feedback on the programming model is valuable. You may want to follow the
instruction in :doc:`BoundsSafetyAdoptionGuide` to play with ``-fbounds-safety``
and please send your feedback to `Yeoul Na <mailto:[email protected]>`_.
and please send your feedback to `Yeoul Na <mailto:[email protected]>`_.
3 changes: 3 additions & 0 deletions clang/include/clang/AST/OperationKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ CAST_OPERATION(HLSLVectorTruncation)
// Non-decaying array RValue cast (HLSL only).
CAST_OPERATION(HLSLArrayRValue)

// Aggregate by Value cast (HLSL only).
CAST_OPERATION(HLSLElementwiseCast)

//===- Binary Operations -------------------------------------------------===//
// Operators listed in order of precedence.
// Note that additions to this should also update the StmtVisitor class,
Expand Down
23 changes: 22 additions & 1 deletion clang/include/clang/ASTMatchers/ASTMatchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,28 @@ extern const internal::VariadicDynCastAllOfMatcher<Stmt, FloatingLiteral>
extern const internal::VariadicDynCastAllOfMatcher<Stmt, ImaginaryLiteral>
imaginaryLiteral;

/// Matches fixed point literals
/// Matches fixed-point literals eg.
/// 0.5r, 0.5hr, 0.5lr, 0.5uhr, 0.5ur, 0.5ulr
/// 1.0k, 1.0hk, 1.0lk, 1.0uhk, 1.0uk, 1.0ulk
/// Exponents 1.0e10k
/// Hexadecimal numbers 0x0.2p2r
///
/// Does not match implicit conversions such as first two lines:
/// \code
/// short _Accum sa = 2;
/// _Accum a = 12.5;
/// _Accum b = 1.25hk;
/// _Fract c = 0.25hr;
/// _Fract v = 0.35uhr;
/// _Accum g = 1.45uhk;
/// _Accum decexp1 = 1.575e1k;
/// \endcode
/// \compile_args{-ffixed-point;-std=c99}
///
/// The matcher \matcher{fixedPointLiteral()} matches
/// \match{1.25hk}, \match{0.25hr}, \match{0.35uhr},
/// \match{1.45uhk}, \match{1.575e1k}, but does not
/// match \nomatch{12.5} and \nomatch{2} from the code block.
extern const internal::VariadicDynCastAllOfMatcher<Stmt, FixedPointLiteral>
fixedPointLiteral;

Expand Down
3 changes: 3 additions & 0 deletions clang/include/clang/Sema/SemaHLSL.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class SemaHLSL : public SemaBase {
// Diagnose whether the input ID is uint/unit2/uint3 type.
bool diagnoseInputIDType(QualType T, const ParsedAttr &AL);

bool CanPerformScalarCast(QualType SrcTy, QualType DestTy);
bool ContainsBitField(QualType BaseTy);
bool CanPerformElementwiseCast(Expr *Src, QualType DestType);
ExprResult ActOnOutParamExpr(ParmVarDecl *Param, Expr *Arg);

QualType getInoutParameterType(QualType Ty);
Expand Down
3 changes: 0 additions & 3 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6234,9 +6234,6 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {

return this->emitGetPtrParam(It->second.Offset, E);
}

if (D->getType()->isReferenceType())
return this->emitDummyPtr(D, E);
}

// In case we need to re-visit a declaration.
Expand Down
1 change: 1 addition & 0 deletions clang/lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,7 @@ bool CastExpr::CastConsistency() const {
case CK_FixedPointToBoolean:
case CK_HLSLArrayRValue:
case CK_HLSLVectorTruncation:
case CK_HLSLElementwiseCast:
CheckNoBasePath:
assert(path_empty() && "Cast kind should not have a base path!");
break;
Expand Down
2 changes: 2 additions & 0 deletions clang/lib/AST/ExprConstant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15047,6 +15047,7 @@ bool IntExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_NoOp:
case CK_LValueToRValueBitCast:
case CK_HLSLArrayRValue:
case CK_HLSLElementwiseCast:
return ExprEvaluatorBaseTy::VisitCastExpr(E);

case CK_MemberPointerToBoolean:
Expand Down Expand Up @@ -15905,6 +15906,7 @@ bool ComplexExprEvaluator::VisitCastExpr(const CastExpr *E) {
case CK_IntegralToFixedPoint:
case CK_MatrixCast:
case CK_HLSLVectorTruncation:
case CK_HLSLElementwiseCast:
llvm_unreachable("invalid cast kind for complex value");

case CK_LValueToRValue:
Expand Down
73 changes: 73 additions & 0 deletions clang/lib/CodeGen/CGExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5338,6 +5338,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
case CK_MatrixCast:
case CK_HLSLVectorTruncation:
case CK_HLSLArrayRValue:
case CK_HLSLElementwiseCast:
return EmitUnsupportedLValue(E, "unexpected cast lvalue");

case CK_Dependent:
Expand Down Expand Up @@ -6376,3 +6377,75 @@ RValue CodeGenFunction::EmitPseudoObjectRValue(const PseudoObjectExpr *E,
LValue CodeGenFunction::EmitPseudoObjectLValue(const PseudoObjectExpr *E) {
return emitPseudoObjectExpr(*this, E, true, AggValueSlot::ignored()).LV;
}

void CodeGenFunction::FlattenAccessAndType(
Address Addr, QualType AddrType,
SmallVectorImpl<std::pair<Address, llvm::Value *>> &AccessList,
SmallVectorImpl<QualType> &FlatTypes) {
// WorkList is list of type we are processing + the Index List to access
// the field of that type in Addr for use in a GEP
llvm::SmallVector<std::pair<QualType, llvm::SmallVector<llvm::Value *, 4>>,
16>
WorkList;
llvm::IntegerType *IdxTy = llvm::IntegerType::get(getLLVMContext(), 32);
// Addr should be a pointer so we need to 'dereference' it
WorkList.push_back({AddrType, {llvm::ConstantInt::get(IdxTy, 0)}});

while (!WorkList.empty()) {
auto [T, IdxList] = WorkList.pop_back_val();
T = T.getCanonicalType().getUnqualifiedType();
assert(!isa<MatrixType>(T) && "Matrix types not yet supported in HLSL");
if (const auto *CAT = dyn_cast<ConstantArrayType>(T)) {
uint64_t Size = CAT->getZExtSize();
for (int64_t I = Size - 1; I > -1; I--) {
llvm::SmallVector<llvm::Value *, 4> IdxListCopy = IdxList;
IdxListCopy.push_back(llvm::ConstantInt::get(IdxTy, I));
WorkList.emplace_back(CAT->getElementType(), IdxListCopy);
}
} else if (const auto *RT = dyn_cast<RecordType>(T)) {
const RecordDecl *Record = RT->getDecl();
assert(!Record->isUnion() && "Union types not supported in flat cast.");

const CXXRecordDecl *CXXD = dyn_cast<CXXRecordDecl>(Record);

llvm::SmallVector<QualType, 16> FieldTypes;
if (CXXD && CXXD->isStandardLayout())
Record = CXXD->getStandardLayoutBaseWithFields();

// deal with potential base classes
if (CXXD && !CXXD->isStandardLayout()) {
for (auto &Base : CXXD->bases())
FieldTypes.push_back(Base.getType());
}

for (auto *FD : Record->fields())
FieldTypes.push_back(FD->getType());

for (int64_t I = FieldTypes.size() - 1; I > -1; I--) {
llvm::SmallVector<llvm::Value *, 4> IdxListCopy = IdxList;
IdxListCopy.push_back(llvm::ConstantInt::get(IdxTy, I));
WorkList.insert(WorkList.end(), {FieldTypes[I], IdxListCopy});
}
} else if (const auto *VT = dyn_cast<VectorType>(T)) {
llvm::Type *LLVMT = ConvertTypeForMem(T);
CharUnits Align = getContext().getTypeAlignInChars(T);
Address GEP =
Builder.CreateInBoundsGEP(Addr, IdxList, LLVMT, Align, "vector.gep");
for (unsigned I = 0, E = VT->getNumElements(); I < E; I++) {
llvm::Value *Idx = llvm::ConstantInt::get(IdxTy, I);
// gep on vector fields is not recommended so combine gep with
// extract/insert
AccessList.emplace_back(GEP, Idx);
FlatTypes.push_back(VT->getElementType());
}
} else {
// a scalar/builtin type
llvm::Type *LLVMT = ConvertTypeForMem(T);
CharUnits Align = getContext().getTypeAlignInChars(T);
Address GEP =
Builder.CreateInBoundsGEP(Addr, IdxList, LLVMT, Align, "gep");
AccessList.emplace_back(GEP, nullptr);
FlatTypes.push_back(T);
}
}
}
Loading
Loading