Skip to content

Commit 154fe4d

Browse files
authored
Merge branch 'main' into fix-volatile-test
2 parents 5f42542 + 7e71db8 commit 154fe4d

File tree

125 files changed

+4298
-811
lines changed

Some content is hidden

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

125 files changed

+4298
-811
lines changed

bolt/lib/Passes/PatchEntries.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,10 @@ Error PatchEntries::runOnFunctions(BinaryContext &BC) {
9898
});
9999

100100
if (!Success) {
101-
// We can't change output layout for AArch64 due to LongJmp pass
102-
if (BC.isAArch64()) {
103-
if (opts::ForcePatch) {
104-
BC.errs() << "BOLT-ERROR: unable to patch entries in " << Function
105-
<< "\n";
106-
return createFatalBOLTError("");
107-
}
108-
109-
continue;
110-
}
111-
112101
// If the original function entries cannot be patched, then we cannot
113102
// safely emit new function body.
114103
BC.errs() << "BOLT-WARNING: failed to patch entries in " << Function
115-
<< ". The function will not be optimized.\n";
104+
<< ". The function will not be optimized\n";
116105
Function.setIgnored();
117106
continue;
118107
}

bolt/lib/Rewrite/BinaryPassManager.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,10 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
497497
// memory profiling data.
498498
Manager.registerPass(std::make_unique<ReorderData>());
499499

500+
// Patch original function entries
501+
if (BC.HasRelocations)
502+
Manager.registerPass(std::make_unique<PatchEntries>());
503+
500504
if (BC.isAArch64()) {
501505
Manager.registerPass(
502506
std::make_unique<ADRRelaxationPass>(PrintAdrRelaxation));
@@ -524,10 +528,6 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) {
524528
// Assign each function an output section.
525529
Manager.registerPass(std::make_unique<AssignSections>());
526530

527-
// Patch original function entries
528-
if (BC.HasRelocations)
529-
Manager.registerPass(std::make_unique<PatchEntries>());
530-
531531
// This pass turns tail calls into jumps which makes them invisible to
532532
// function reordering. It's unsafe to use any CFG or instruction analysis
533533
// after this point.

clang/bindings/python/clang/cindex.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,11 +2980,7 @@ def availability(self):
29802980

29812981
@property
29822982
def briefComment(self):
2983-
if conf.function_exists("clang_getCompletionBriefComment"):
2984-
return _CXString.from_result(
2985-
conf.lib.clang_getCompletionBriefComment(self.obj)
2986-
)
2987-
return ""
2983+
return _CXString.from_result(conf.lib.clang_getCompletionBriefComment(self.obj))
29882984

29892985
def __repr__(self):
29902986
return (
@@ -4264,14 +4260,6 @@ def get_cindex_library(self) -> CDLL:
42644260

42654261
return library
42664262

4267-
def function_exists(self, name: str) -> bool:
4268-
try:
4269-
getattr(self.lib, name)
4270-
except AttributeError:
4271-
return False
4272-
4273-
return True
4274-
42754263

42764264
conf = Config()
42774265

clang/bindings/python/tests/cindex/test_cursor.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,3 +1035,18 @@ def test_specialized_template(self):
10351035
self.assertNotEqual(foos[0], foos[1])
10361036
self.assertEqual(foos[0], prime_foo)
10371037
self.assertIsNone(tu.cursor.specialized_template)
1038+
1039+
def test_equality(self):
1040+
tu = get_tu(CHILDREN_TEST, lang="cpp")
1041+
cursor1 = get_cursor(tu, "s0")
1042+
cursor1_2 = get_cursor(tu, "s0")
1043+
cursor2 = get_cursor(tu, "f0")
1044+
1045+
self.assertIsNotNone(cursor1)
1046+
self.assertIsNotNone(cursor1_2)
1047+
self.assertIsNotNone(cursor2)
1048+
1049+
self.assertEqual(cursor1, cursor1)
1050+
self.assertEqual(cursor1, cursor1_2)
1051+
self.assertNotEqual(cursor1, cursor2)
1052+
self.assertNotEqual(cursor1, "foo")

clang/bindings/python/tests/cindex/test_location.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23

34
from clang.cindex import (
45
Config,
@@ -16,6 +17,8 @@
1617

1718
from .util import get_cursor, get_tu
1819

20+
INPUTS_DIR = Path(__file__).parent / "INPUTS"
21+
1922
BASE_INPUT = "int one;\nint two;\n"
2023

2124

@@ -151,3 +154,21 @@ def test_operator_lt(self):
151154
assert l_t1_12 < l_t2_13 < l_t1_14
152155
assert not l_t2_13 < l_t1_12
153156
assert not l_t1_14 < l_t2_13
157+
158+
def test_equality(self):
159+
path = INPUTS_DIR / "testfile.c"
160+
path_a = INPUTS_DIR / "a.inc"
161+
tu = TranslationUnit.from_source(path)
162+
main_file = File.from_name(tu, path)
163+
a_file = File.from_name(tu, path_a)
164+
165+
location1 = SourceLocation.from_position(tu, main_file, 1, 3)
166+
location2 = SourceLocation.from_position(tu, main_file, 2, 2)
167+
location1_2 = SourceLocation.from_position(tu, main_file, 1, 3)
168+
file2_location1 = SourceLocation.from_position(tu, a_file, 1, 3)
169+
170+
self.assertEqual(location1, location1)
171+
self.assertEqual(location1, location1_2)
172+
self.assertNotEqual(location1, location2)
173+
self.assertNotEqual(location1, file2_location1)
174+
self.assertNotEqual(location1, "foo")

clang/bindings/python/tests/cindex/test_source_range.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
from pathlib import Path
23

34
from clang.cindex import Config, SourceLocation, SourceRange, TranslationUnit
45

@@ -9,6 +10,8 @@
910

1011
from .util import get_tu
1112

13+
INPUTS_DIR = Path(__file__).parent / "INPUTS"
14+
1215

1316
def create_range(tu, line1, column1, line2, column2):
1417
return SourceRange.from_locations(
@@ -83,3 +86,16 @@ def test_contains(self):
8386
r_curly = create_range(tu2, 1, 11, 3, 1)
8487
l_f2 = SourceLocation.from_position(tu2, tu2.get_file("./numbers.inc"), 4, 1)
8588
assert l_f2 in r_curly
89+
90+
def test_equality(self):
91+
path = INPUTS_DIR / "testfile.c"
92+
tu = TranslationUnit.from_source(path)
93+
94+
r1 = create_range(tu, 1, 1, 2, 2)
95+
r2 = create_range(tu, 1, 2, 2, 2)
96+
r1_2 = create_range(tu, 1, 1, 2, 2)
97+
98+
self.assertEqual(r1, r1)
99+
self.assertEqual(r1, r1_2)
100+
self.assertNotEqual(r1, r2)
101+
self.assertNotEqual(r1, "foo")

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ New Compiler Flags
281281
The feature has `existed <https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program>`_)
282282
for a while and this is just a user facing option.
283283

284-
- New option ``-ftime-report-json`` added which outputs the same timing data as `-ftime-report` but formatted as JSON.
284+
- New option ``-ftime-report-json`` added which outputs the same timing data as ``-ftime-report`` but formatted as JSON.
285285

286286
Deprecated Compiler Flags
287287
-------------------------

clang/include/clang/Basic/OffloadArch.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ enum class OffloadArch {
101101
AMDGCNSPIRV,
102102
Generic, // A processor model named 'generic' if the target backend defines a
103103
// public one.
104+
// Intel CPUs
105+
GRANITERAPIDS,
106+
// Intel GPUs
107+
BMG_G21,
104108
LAST,
105109

106110
CudaDefault = OffloadArch::SM_52,
@@ -116,6 +120,18 @@ static inline bool IsAMDOffloadArch(OffloadArch A) {
116120
return A >= OffloadArch::GFX600 && A < OffloadArch::Generic;
117121
}
118122

123+
static inline bool IsIntelCPUOffloadArch(OffloadArch Arch) {
124+
return Arch >= OffloadArch::GRANITERAPIDS && Arch < OffloadArch::BMG_G21;
125+
}
126+
127+
static inline bool IsIntelGPUOffloadArch(OffloadArch Arch) {
128+
return Arch >= OffloadArch::BMG_G21 && Arch < OffloadArch::LAST;
129+
}
130+
131+
static inline bool IsIntelOffloadArch(OffloadArch Arch) {
132+
return IsIntelCPUOffloadArch(Arch) || IsIntelGPUOffloadArch(Arch);
133+
}
134+
119135
const char *OffloadArchToString(OffloadArch A);
120136
const char *OffloadArchToVirtualArchString(OffloadArch A);
121137

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,14 @@ class CIRBaseBuilderTy : public mlir::OpBuilder {
215215
//===--------------------------------------------------------------------===//
216216

217217
cir::CallOp createCallOp(mlir::Location loc, mlir::SymbolRefAttr callee,
218-
mlir::Type returnType) {
219-
auto op = create<cir::CallOp>(loc, callee, returnType);
220-
return op;
218+
mlir::Type returnType, mlir::ValueRange operands) {
219+
return create<cir::CallOp>(loc, callee, returnType, operands);
221220
}
222221

223-
cir::CallOp createCallOp(mlir::Location loc, cir::FuncOp callee) {
222+
cir::CallOp createCallOp(mlir::Location loc, cir::FuncOp callee,
223+
mlir::ValueRange operands) {
224224
return createCallOp(loc, mlir::SymbolRefAttr::get(callee),
225-
callee.getFunctionType().getReturnType());
225+
callee.getFunctionType().getReturnType(), operands);
226226
}
227227

228228
//===--------------------------------------------------------------------===//

clang/include/clang/CIR/Dialect/IR/CIRDialect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "clang/CIR/Dialect/IR/CIROpsEnums.h"
3232
#include "clang/CIR/Interfaces/CIRLoopOpInterface.h"
3333
#include "clang/CIR/Interfaces/CIROpInterfaces.h"
34+
#include "clang/CIR/MissingFeatures.h"
3435

3536
namespace mlir {
3637
namespace OpTrait {

0 commit comments

Comments
 (0)