Skip to content

Commit d908d4d

Browse files
Merge branch 'llvm:main' into cfi-show
2 parents 93fe935 + 40d8af8 commit d908d4d

File tree

265 files changed

+6050
-1363
lines changed

Some content is hidden

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

265 files changed

+6050
-1363
lines changed

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2216,7 +2216,8 @@ class MCPlusBuilder {
22162216
}
22172217

22182218
/// Print each annotation attached to \p Inst.
2219-
void printAnnotations(const MCInst &Inst, raw_ostream &OS) const;
2219+
void printAnnotations(const MCInst &Inst, raw_ostream &OS,
2220+
bool PrintMemData = false) const;
22202221

22212222
/// Remove annotation with a given \p Index.
22222223
///

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2044,7 +2044,7 @@ void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
20442044
if (MCSymbol *Label = MIB->getInstLabel(Instruction))
20452045
OS << " # Label: " << *Label;
20462046

2047-
MIB->printAnnotations(Instruction, OS);
2047+
MIB->printAnnotations(Instruction, OS, PrintMemData || opts::PrintMemData);
20482048

20492049
if (opts::PrintDebugInfo)
20502050
printDebugInfo(OS, Instruction, Function, DwCtx.get());

bolt/lib/Core/MCPlusBuilder.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ void MCPlusBuilder::stripAnnotations(MCInst &Inst, bool KeepTC) const {
378378
setTailCall(Inst);
379379
}
380380

381-
void MCPlusBuilder::printAnnotations(const MCInst &Inst,
382-
raw_ostream &OS) const {
381+
void MCPlusBuilder::printAnnotations(const MCInst &Inst, raw_ostream &OS,
382+
bool PrintMemData) const {
383383
std::optional<unsigned> FirstAnnotationOp = getFirstAnnotationOpIndex(Inst);
384384
if (!FirstAnnotationOp)
385385
return;
@@ -390,7 +390,11 @@ void MCPlusBuilder::printAnnotations(const MCInst &Inst,
390390
const int64_t Value = extractAnnotationValue(Imm);
391391
const auto *Annotation = reinterpret_cast<const MCAnnotation *>(Value);
392392
if (Index >= MCAnnotation::kGeneric) {
393-
OS << " # " << AnnotationNames[Index - MCAnnotation::kGeneric] << ": ";
393+
std::string AnnotationName =
394+
AnnotationNames[Index - MCAnnotation::kGeneric];
395+
if (!PrintMemData && AnnotationName == "MemoryAccessProfile")
396+
continue;
397+
OS << " # " << AnnotationName << ": ";
394398
Annotation->print(OS);
395399
}
396400
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Check that --print-mem-data option works properly in llvm-bolt
2+
3+
# RUN: split-file %s %t
4+
# RUN: %clang %cflags -fPIC -pie %t/main.s -o %t.exe -nostdlib -Wl,-q
5+
# RUN: llvm-bolt %t.exe -o %t.bolt --print-mem-data=true --print-cfg \
6+
# RUN: --data %t/fdata | FileCheck %s -check-prefix=CHECK-PRINT
7+
# RUN: llvm-bolt %t.exe -o %t.bolt --print-cfg \
8+
# RUN: --data %t/fdata | FileCheck %s -check-prefix=CHECK-DEFAULT
9+
10+
# CHECK-PRINT: ldr w2, [x1], #0x4 # MemoryAccessProfile: 7 total counts :
11+
# CHECK-PRINT-NEXT: { 0x123: 1 },
12+
# CHECK-PRINT-NEXT: { 0x456: 2 },
13+
# CHECK-PRINT-NEXT: { 0xabc: 4 }
14+
# CHECK-DEFAULT-NOT: MemoryAccessProfile
15+
16+
#--- main.s
17+
.text
18+
.align 4
19+
.global main
20+
.type main, %function
21+
main:
22+
sub sp, sp, #48
23+
add x1, sp, 8
24+
add x3, sp, 48
25+
mov w0, 0
26+
.L2:
27+
ldr w2, [x1], 4
28+
add w0, w0, w2
29+
cmp x1, x3
30+
bne .L2
31+
add sp, sp, 48
32+
ret
33+
.size main, .-main
34+
35+
# The three memory access data generated by the load at
36+
# offset 0x10 in the main.
37+
#--- fdata
38+
4 main 10 4 otherSym 123 1
39+
4 main 10 4 otherSym 456 2
40+
4 main 10 4 otherSym abc 4

clang-tools-extra/clang-tidy/.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Checks: >
1616
performance-*,
1717
-performance-enum-size,
1818
-performance-no-int-to-ptr,
19-
-performance-type-promotion-in-math-fn,
2019
-performance-unnecessary-value-param,
2120
readability-*,
2221
-readability-avoid-nested-conditional-operator,

clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ void StructPackAlignCheck::check(const MatchFinder::MatchResult &Result) {
7676
CharUnits CurrSize = Result.Context->getASTRecordLayout(Struct).getSize();
7777
CharUnits MinByteSize =
7878
CharUnits::fromQuantity(std::max<clang::CharUnits::QuantityType>(
79-
ceil(static_cast<float>(TotalBitSize) / CharSize), 1));
79+
std::ceil(static_cast<float>(TotalBitSize) / CharSize), 1));
8080
CharUnits MaxAlign = CharUnits::fromQuantity(
81-
ceil((float)Struct->getMaxAlignment() / CharSize));
81+
std::ceil((float)Struct->getMaxAlignment() / CharSize));
8282
CharUnits CurrAlign =
8383
Result.Context->getASTRecordLayout(Struct).getAlignment();
8484
CharUnits NewAlign = computeRecommendedAlignment(MinByteSize);

clang-tools-extra/clang-tidy/altera/UnrollLoopsCheck.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,18 +208,20 @@ bool UnrollLoopsCheck::hasLargeNumIterations(const Stmt *Statement,
208208
return true;
209209
switch (Op->getOpcode()) {
210210
case (BO_AddAssign):
211-
Iterations = ceil(float(EndValue - InitValue) / ConstantValue);
211+
Iterations = std::ceil(float(EndValue - InitValue) / ConstantValue);
212212
break;
213213
case (BO_SubAssign):
214-
Iterations = ceil(float(InitValue - EndValue) / ConstantValue);
214+
Iterations = std::ceil(float(InitValue - EndValue) / ConstantValue);
215215
break;
216216
case (BO_MulAssign):
217-
Iterations = 1 + (log((double)EndValue) - log((double)InitValue)) /
218-
log((double)ConstantValue);
217+
Iterations =
218+
1 + (std::log((double)EndValue) - std::log((double)InitValue)) /
219+
std::log((double)ConstantValue);
219220
break;
220221
case (BO_DivAssign):
221-
Iterations = 1 + (log((double)InitValue) - log((double)EndValue)) /
222-
log((double)ConstantValue);
222+
Iterations =
223+
1 + (std::log((double)InitValue) - std::log((double)EndValue)) /
224+
std::log((double)ConstantValue);
223225
break;
224226
default:
225227
// All other operators are not handled; assume large bounds.

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5079,6 +5079,113 @@ the configuration (without a prefix: ``Auto``).
50795079

50805080
For example: TESTSUITE
50815081

5082+
.. _NumericLiteralCase:
5083+
5084+
**NumericLiteralCase** (``NumericLiteralCaseStyle``) :versionbadge:`clang-format 22` :ref:`<NumericLiteralCase>`
5085+
Capitalization style for numeric literals.
5086+
5087+
Nested configuration flags:
5088+
5089+
Separate control for each numeric literal component.
5090+
5091+
For example, the config below will leave exponent letters alone, reformat
5092+
hexadecimal digits in lowercase, reformat numeric literal prefixes in
5093+
uppercase, and reformat suffixes in lowercase.
5094+
5095+
.. code-block:: c++
5096+
5097+
NumericLiteralCase:
5098+
ExponentLetter: Leave
5099+
HexDigit: Lower
5100+
Prefix: Upper
5101+
Suffix: Lower
5102+
5103+
* ``NumericLiteralComponentStyle ExponentLetter``
5104+
Format floating point exponent separator letter case.
5105+
5106+
.. code-block:: c++
5107+
5108+
float a = 6.02e23 + 1.0E10; // Leave
5109+
float a = 6.02E23 + 1.0E10; // Upper
5110+
float a = 6.02e23 + 1.0e10; // Lower
5111+
5112+
Possible values:
5113+
5114+
* ``NLCS_Leave`` (in configuration: ``Leave``)
5115+
Leave this component of the literal as is.
5116+
5117+
* ``NLCS_Upper`` (in configuration: ``Upper``)
5118+
Format this component with uppercase characters.
5119+
5120+
* ``NLCS_Lower`` (in configuration: ``Lower``)
5121+
Format this component with lowercase characters.
5122+
5123+
5124+
* ``NumericLiteralComponentStyle HexDigit``
5125+
Format hexadecimal digit case.
5126+
5127+
.. code-block:: c++
5128+
5129+
a = 0xaBcDeF; // Leave
5130+
a = 0xABCDEF; // Upper
5131+
a = 0xabcdef; // Lower
5132+
5133+
Possible values:
5134+
5135+
* ``NLCS_Leave`` (in configuration: ``Leave``)
5136+
Leave this component of the literal as is.
5137+
5138+
* ``NLCS_Upper`` (in configuration: ``Upper``)
5139+
Format this component with uppercase characters.
5140+
5141+
* ``NLCS_Lower`` (in configuration: ``Lower``)
5142+
Format this component with lowercase characters.
5143+
5144+
5145+
* ``NumericLiteralComponentStyle Prefix``
5146+
Format integer prefix case.
5147+
5148+
.. code-block:: c++
5149+
5150+
a = 0XF0 | 0b1; // Leave
5151+
a = 0XF0 | 0B1; // Upper
5152+
a = 0xF0 | 0b1; // Lower
5153+
5154+
Possible values:
5155+
5156+
* ``NLCS_Leave`` (in configuration: ``Leave``)
5157+
Leave this component of the literal as is.
5158+
5159+
* ``NLCS_Upper`` (in configuration: ``Upper``)
5160+
Format this component with uppercase characters.
5161+
5162+
* ``NLCS_Lower`` (in configuration: ``Lower``)
5163+
Format this component with lowercase characters.
5164+
5165+
5166+
* ``NumericLiteralComponentStyle Suffix``
5167+
Format suffix case. This option excludes case-sensitive reserved
5168+
suffixes, such as ``min`` in C++.
5169+
5170+
.. code-block:: c++
5171+
5172+
a = 1uLL; // Leave
5173+
a = 1ULL; // Upper
5174+
a = 1ull; // Lower
5175+
5176+
Possible values:
5177+
5178+
* ``NLCS_Leave`` (in configuration: ``Leave``)
5179+
Leave this component of the literal as is.
5180+
5181+
* ``NLCS_Upper`` (in configuration: ``Upper``)
5182+
Format this component with uppercase characters.
5183+
5184+
* ``NLCS_Lower`` (in configuration: ``Lower``)
5185+
Format this component with lowercase characters.
5186+
5187+
5188+
50825189
.. _ObjCBinPackProtocolList:
50835190

50845191
**ObjCBinPackProtocolList** (``BinPackStyle``) :versionbadge:`clang-format 7` :ref:`<ObjCBinPackProtocolList>`

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ AST Matchers
468468
clang-format
469469
------------
470470
- Add ``SpaceInEmptyBraces`` option and set it to ``Always`` for WebKit style.
471+
- Add ``NumericLiteralCase`` option for enforcing character case in numeric
472+
literals.
471473

472474
libclang
473475
--------

clang/include/clang/Basic/arm_sme.td

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,10 @@ let SMETargetGuard = "sme2p1" in {
156156
////////////////////////////////////////////////////////////////////////////////
157157
// SME - Counting elements in a streaming vector
158158

159-
multiclass ZACount<string n_suffix> {
160-
def NAME : SInst<"sv" # n_suffix, "nv", "", MergeNone,
161-
"aarch64_sme_" # n_suffix,
162-
[IsOverloadNone, IsStreamingCompatible]>;
163-
}
164-
165-
defm SVCNTSB : ZACount<"cntsb">;
166-
defm SVCNTSH : ZACount<"cntsh">;
167-
defm SVCNTSW : ZACount<"cntsw">;
168-
defm SVCNTSD : ZACount<"cntsd">;
159+
def SVCNTSB : SInst<"svcntsb", "nv", "", MergeNone, "", [IsOverloadNone, IsStreamingCompatible]>;
160+
def SVCNTSH : SInst<"svcntsh", "nv", "", MergeNone, "", [IsOverloadNone, IsStreamingCompatible]>;
161+
def SVCNTSW : SInst<"svcntsw", "nv", "", MergeNone, "", [IsOverloadNone, IsStreamingCompatible]>;
162+
def SVCNTSD : SInst<"svcntsd", "nv", "", MergeNone, "aarch64_sme_cntsd", [IsOverloadNone, IsStreamingCompatible]>;
169163

170164
////////////////////////////////////////////////////////////////////////////////
171165
// SME - ADDHA/ADDVA

0 commit comments

Comments
 (0)