Skip to content

Commit c47ce7a

Browse files
authored
Merge branch 'main' into users/zhaoqi5/opt-insertelement-idx
2 parents 1b11b02 + 957ae8a commit c47ce7a

File tree

585 files changed

+38839
-16725
lines changed

Some content is hidden

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

585 files changed

+38839
-16725
lines changed

.github/workflows/release-tasks.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,31 @@ jobs:
111111
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
112112
secrets:
113113
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
114+
115+
uncomment-download-links:
116+
name: Uncomment download links
117+
runs-on: ubuntu-24.04
118+
permissions:
119+
contents: write # For updating the release message.
120+
needs:
121+
- validate-tag
122+
- release-create
123+
- release-binaries
124+
125+
steps:
126+
- name: Install Dependencies
127+
run: |
128+
sudo apt-get update
129+
sudo apt-get install python3-github
130+
131+
- name: Checkout LLVM
132+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
133+
with:
134+
sparse-checkout: llvm/utils/release/github-upload-release.py
135+
sparse-checkout-cone-mode: false
136+
137+
- name: Uncomment Download Links
138+
env:
139+
GITHUB_TOKEN: ${{ github.token }}
140+
run: |
141+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --release ${{ needs.validate-tag.outputs.release-version }} uncomment_download_links

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,20 @@ void RewriteInstance::discoverFileObjects() {
896896
continue;
897897

898898
MarkerSymType MarkerType = BC->getMarkerType(SymInfo.Symbol);
899+
900+
// Treat ST_Function as code.
901+
Expected<object::SymbolRef::Type> TypeOrError = SymInfo.Symbol.getType();
902+
consumeError(TypeOrError.takeError());
903+
if (TypeOrError && *TypeOrError == SymbolRef::ST_Function) {
904+
if (IsData) {
905+
Expected<StringRef> NameOrError = SymInfo.Symbol.getName();
906+
consumeError(NameOrError.takeError());
907+
BC->errs() << "BOLT-WARNING: function symbol " << *NameOrError
908+
<< " lacks code marker\n";
909+
}
910+
MarkerType = MarkerSymType::CODE;
911+
}
912+
899913
if (MarkerType != MarkerSymType::NONE) {
900914
SortedMarkerSymbols.push_back(MarkerSym{SymInfo.Address, MarkerType});
901915
LastAddr = SymInfo.Address;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Check that llvm-bolt is able to recover a missing code marker.
2+
3+
# RUN: %clang %cflags %s -o %t.exe -nostdlib -fuse-ld=lld -Wl,-q
4+
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
5+
6+
# CHECK: BOLT-WARNING: function symbol foo lacks code marker
7+
8+
.text
9+
.balign 4
10+
11+
.word 0
12+
13+
## Function foo starts immediately after a data object and does not have
14+
## a matching "$x" symbol to indicate the start of code.
15+
.global foo
16+
.type foo, %function
17+
foo:
18+
.word 0xd65f03c0
19+
.size foo, .-foo
20+
21+
.global _start
22+
.type _start, %function
23+
_start:
24+
bl foo
25+
ret
26+
.size _start, .-_start

clang/cmake/caches/Release.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ if (LLVM_RELEASE_ENABLE_LTO)
102102
# FIXME: We can't use LLVM_ENABLE_LTO=Thin here, because it causes the CMake
103103
# step for the libcxx build to fail. CMAKE_INTERPROCEDURAL_OPTIMIZATION does
104104
# enable ThinLTO, though.
105-
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON" CACHE STRING "")
105+
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -DLLVM_ENABLE_LLD=ON -DLLVM_ENABLE_FATLTO=ON" CACHE STRING "")
106106
endif()
107107

108108
# Stage 1 Common Config
@@ -144,3 +144,7 @@ set_final_stage_var(CPACK_GENERATOR "TXZ" STRING)
144144
set_final_stage_var(CPACK_ARCHIVE_THREADS "0" STRING)
145145

146146
set_final_stage_var(LLVM_USE_STATIC_ZSTD "ON" BOOL)
147+
if (LLVM_RELEASE_ENABLE_LTO)
148+
set_final_stage_var(LLVM_ENABLE_FATLTO "ON" BOOL)
149+
set_final_stage_var(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_CURRENT_LIST_DIR}/release_cpack_pre_build_strip_lto.cmake" STRING)
150+
endif()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
file(GLOB files ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/lib/*.a)
2+
3+
foreach(file ${files})
4+
execute_process(COMMAND ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/bin/llvm-strip --no-strip-all -R .llvm.lto ${file})
5+
endforeach()

clang/include/clang/Basic/BuiltinsAMDGPU.def

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,16 @@ TARGET_BUILTIN(__builtin_amdgcn_global_load_monitor_b128, "V4iV4i*1Ii", "nc", "g
651651
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b32, "ii*0Ii", "nc", "gfx1250-insts")
652652
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b64, "V2iV2i*0Ii", "nc", "gfx1250-insts")
653653
TARGET_BUILTIN(__builtin_amdgcn_flat_load_monitor_b128, "V4iV4i*0Ii", "nc", "gfx1250-insts")
654+
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b8, "vc*1c*3IiIi", "nc", "gfx1250-insts")
655+
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b32, "vi*1i*3IiIi", "nc", "gfx1250-insts")
656+
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b64, "vV2i*1V2i*3IiIi", "nc", "gfx1250-insts")
657+
TARGET_BUILTIN(__builtin_amdgcn_global_load_async_to_lds_b128, "vV4i*1V4i*3IiIi", "nc", "gfx1250-insts")
658+
TARGET_BUILTIN(__builtin_amdgcn_global_store_async_from_lds_b8, "vc*1c*3IiIi", "nc", "gfx1250-insts")
659+
TARGET_BUILTIN(__builtin_amdgcn_global_store_async_from_lds_b32, "vi*1i*3IiIi", "nc", "gfx1250-insts")
660+
TARGET_BUILTIN(__builtin_amdgcn_global_store_async_from_lds_b64, "vV2i*1V2i*3IiIi", "nc", "gfx1250-insts")
661+
TARGET_BUILTIN(__builtin_amdgcn_global_store_async_from_lds_b128, "vV4i*1V4i*3IiIi", "nc", "gfx1250-insts")
662+
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_async_barrier_arrive_b64, "vLi*3", "nc", "gfx1250-insts")
663+
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_barrier_arrive_rtn_b64, "LiLi*3Li", "nc", "gfx1250-insts")
654664

655665
TARGET_BUILTIN(__builtin_amdgcn_tensor_load_to_lds, "vV4iV8iV4iV4iIi", "nc", "gfx1250-insts")
656666
TARGET_BUILTIN(__builtin_amdgcn_tensor_load_to_lds_d2, "vV4iV8iIi", "nc", "gfx1250-insts")
@@ -670,9 +680,6 @@ TARGET_BUILTIN(__builtin_amdgcn_ds_load_tr16_b128_v8i16, "V8sV8s*3", "nc", "gfx1
670680
TARGET_BUILTIN(__builtin_amdgcn_ds_load_tr16_b128_v8f16, "V8hV8h*3", "nc", "gfx1250-insts,wavefrontsize32")
671681
TARGET_BUILTIN(__builtin_amdgcn_ds_load_tr16_b128_v8bf16, "V8yV8y*3", "nc", "gfx1250-insts,wavefrontsize32")
672682

673-
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_async_barrier_arrive_b64, "vLi*3", "nc", "gfx1250-insts")
674-
TARGET_BUILTIN(__builtin_amdgcn_ds_atomic_barrier_arrive_rtn_b64, "LiLi*3Li", "nc", "gfx1250-insts")
675-
676683
TARGET_BUILTIN(__builtin_amdgcn_s_setprio_inc_wg, "vIs", "n", "setprio-inc-wg-inst")
677684
TARGET_BUILTIN(__builtin_amdgcn_s_monitor_sleep, "vIs", "n", "gfx1250-insts")
678685

clang/include/clang/Basic/DiagnosticASTKinds.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,14 @@ def note_odr_number_of_bases : Note<
511511
"class has %0 base %plural{1:class|:classes}0">;
512512
def note_odr_enumerator : Note<"enumerator %0 with value %1 here">;
513513
def note_odr_missing_enumerator : Note<"no corresponding enumerator here">;
514+
def note_odr_incompatible_fixed_underlying_type : Note<
515+
"enumeration %0 declared with incompatible fixed underlying types (%1 vs. "
516+
"%2)">;
517+
def note_odr_fixed_underlying_type : Note<
518+
"enumeration %0 has fixed underlying type here">;
519+
def note_odr_missing_fixed_underlying_type : Note<
520+
"enumeration %0 missing fixed underlying type here">;
521+
514522
def err_odr_field_type_inconsistent : Error<
515523
"field %0 declared with incompatible types in different "
516524
"translation units (%1 vs. %2)">;

clang/include/clang/Basic/FileManager.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,6 @@ class FileManager : public RefCountedBase<FileManager> {
237237
FileEntryRef getVirtualFileRef(StringRef Filename, off_t Size,
238238
time_t ModificationTime);
239239

240-
LLVM_DEPRECATED("Functions returning FileEntry are deprecated.",
241-
"getVirtualFileRef()")
242-
const FileEntry *getVirtualFile(StringRef Filename, off_t Size,
243-
time_t ModificationTime);
244-
245240
/// Retrieve a FileEntry that bypasses VFE, which is expected to be a virtual
246241
/// file entry, to access the real file. The returned FileEntry will have
247242
/// the same filename as FE but a different identity and its own stat.

clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
7575
return getConstant(loc, cir::IntAttr::get(ty, value));
7676
}
7777

78+
mlir::Value getSignedInt(mlir::Location loc, int64_t val, unsigned numBits) {
79+
auto type = cir::IntType::get(getContext(), numBits, /*isSigned=*/true);
80+
return getConstAPInt(loc, type,
81+
llvm::APInt(numBits, val, /*isSigned=*/true));
82+
}
83+
7884
mlir::Value getUnsignedInt(mlir::Location loc, uint64_t val,
7985
unsigned numBits) {
8086
auto type = cir::IntType::get(getContext(), numBits, /*isSigned=*/false);

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

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -607,8 +607,8 @@ def CIR_ConditionOp : CIR_Op<"condition", [
607607
//===----------------------------------------------------------------------===//
608608

609609
defvar CIR_YieldableScopes = [
610-
"ArrayCtor", "CaseOp", "DoWhileOp", "ForOp", "IfOp", "ScopeOp", "SwitchOp",
611-
"TernaryOp", "WhileOp"
610+
"ArrayCtor", "ArrayDtor", "CaseOp", "DoWhileOp", "ForOp", "IfOp", "ScopeOp",
611+
"SwitchOp", "TernaryOp", "WhileOp"
612612
];
613613

614614
def CIR_YieldOp : CIR_Op<"yield", [
@@ -1946,6 +1946,10 @@ def CIR_FuncOp : CIR_Op<"func", [
19461946
The function linkage information is specified by `linkage`, as defined by
19471947
`GlobalLinkageKind` attribute.
19481948

1949+
The `no_proto` keyword is used to identify functions that were declared
1950+
without a prototype and, consequently, may contain calls with invalid
1951+
arguments and undefined behavior.
1952+
19491953
Example:
19501954

19511955
```mlir
@@ -1964,6 +1968,7 @@ def CIR_FuncOp : CIR_Op<"func", [
19641968
let arguments = (ins SymbolNameAttr:$sym_name,
19651969
CIR_VisibilityAttr:$global_visibility,
19661970
TypeAttrOf<CIR_FuncType>:$function_type,
1971+
UnitAttr:$no_proto,
19671972
UnitAttr:$dso_local,
19681973
DefaultValuedAttr<CIR_GlobalLinkageKind,
19691974
"cir::GlobalLinkageKind::ExternalLinkage">:$linkage,
@@ -2005,13 +2010,6 @@ def CIR_FuncOp : CIR_Op<"func", [
20052010
return getFunctionType().getReturnTypes();
20062011
}
20072012

2008-
// TODO(cir): this should be an operand attribute, but for now we just hard-
2009-
// wire this as a function. Will later add a $no_proto argument to this op.
2010-
bool getNoProto() {
2011-
assert(!cir::MissingFeatures::opFuncNoProto());
2012-
return false;
2013-
}
2014-
20152013
//===------------------------------------------------------------------===//
20162014
// SymbolOpInterface Methods
20172015
//===------------------------------------------------------------------===//
@@ -2229,7 +2227,7 @@ def CIR_TrapOp : CIR_Op<"trap", [Terminator]> {
22292227
}
22302228

22312229
//===----------------------------------------------------------------------===//
2232-
// ArrayCtor
2230+
// ArrayCtor & ArrayDtor
22332231
//===----------------------------------------------------------------------===//
22342232

22352233
class CIR_ArrayInitDestroy<string mnemonic> : CIR_Op<mnemonic> {
@@ -2260,7 +2258,9 @@ def CIR_ArrayCtor : CIR_ArrayInitDestroy<"array.ctor"> {
22602258
let description = [{
22612259
Initialize each array element using the same C++ constructor. This
22622260
operation has one region, with one single block. The block has an
2263-
incoming argument for the current array index to initialize.
2261+
incoming argument for the current array element to initialize.
2262+
2263+
Example:
22642264

22652265
```mlir
22662266
cir.array.ctor(%0 : !cir.ptr<!cir.array<!rec_S x 42>>) {
@@ -2272,6 +2272,25 @@ def CIR_ArrayCtor : CIR_ArrayInitDestroy<"array.ctor"> {
22722272
}];
22732273
}
22742274

2275+
def CIR_ArrayDtor : CIR_ArrayInitDestroy<"array.dtor"> {
2276+
let summary = "Destroy array elements with C++ dtors";
2277+
let description = [{
2278+
Destroy each array element using the same C++ destructor. This
2279+
operation has one region, with one single block. The block has an
2280+
incoming argument for the current array element to destruct.
2281+
2282+
Example:
2283+
2284+
```mlir
2285+
cir.array.dtor(%0 : !cir.ptr<!cir.array<!rec_S x 42>>) {
2286+
^bb0(%arg0: !cir.ptr<!rec_S>):
2287+
cir.call @some_dtor(%arg0) : (!cir.ptr<!rec_S>) -> ()
2288+
cir.yield
2289+
}
2290+
```
2291+
}];
2292+
}
2293+
22752294
//===----------------------------------------------------------------------===//
22762295
// VecCreate
22772296
//===----------------------------------------------------------------------===//
@@ -2911,6 +2930,28 @@ def CIR_BitCtzOp : CIR_BitZeroCountOpBase<"ctz",
29112930
}];
29122931
}
29132932

2933+
def CIR_BitFfsOp : CIR_BitOpBase<"ffs", CIR_SIntOfWidths<[32, 64]>> {
2934+
let summary = "Get the position of the least significant 1-bit in input";
2935+
let description = [{
2936+
Compute the 1-based position of the least significant 1-bit of the input.
2937+
2938+
The input integer must be a signed integer. The `cir.ffs` operation returns
2939+
one plus the index of the least significant 1-bit of the input signed
2940+
integer. If the input integer is 0, `cir.ffs` yields 0.
2941+
2942+
Example:
2943+
2944+
```mlir
2945+
!s32i = !cir.int<s, 32>
2946+
2947+
// %0 = 0x0010_1000
2948+
%0 = cir.const #cir.int<40> : !s32i
2949+
// #1 will be 4 since the 4th least significant bit is 1.
2950+
%1 = cir.ffs %0 : !s32i
2951+
```
2952+
}];
2953+
}
2954+
29142955
def CIR_BitParityOp : CIR_BitOpBase<"parity", CIR_UIntOfWidths<[32, 64]>> {
29152956
let summary = "Get the parity of input";
29162957
let description = [{

0 commit comments

Comments
 (0)