Skip to content

Commit 035d55d

Browse files
author
z1.cciauto
committed
merge main into amd-staging
2 parents 63907cc + ac16520 commit 035d55d

File tree

52 files changed

+592
-641
lines changed

Some content is hidden

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

52 files changed

+592
-641
lines changed

bolt/lib/Target/RISCV/RISCVMCPlusBuilder.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
247247
Inst.clear();
248248
Inst.addOperand(MCOperand::createExpr(RISCVMCExpr::create(
249249
MCSymbolRefExpr::create(Target, MCSymbolRefExpr::VK_None, *Ctx),
250-
RISCVMCExpr::VK_CALL, *Ctx)));
250+
ELF::R_RISCV_CALL_PLT, *Ctx)));
251251
}
252252

253253
void createCall(MCInst &Inst, const MCSymbol *Target,
@@ -435,19 +435,19 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
435435
case ELF::R_RISCV_TLS_GD_HI20:
436436
// The GOT is reused so no need to create GOT relocations
437437
case ELF::R_RISCV_PCREL_HI20:
438-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_HI, Ctx);
438+
return RISCVMCExpr::create(Expr, ELF::R_RISCV_PCREL_HI20, Ctx);
439439
case ELF::R_RISCV_PCREL_LO12_I:
440440
case ELF::R_RISCV_PCREL_LO12_S:
441441
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_PCREL_LO, Ctx);
442442
case ELF::R_RISCV_HI20:
443-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_HI, Ctx);
443+
return RISCVMCExpr::create(Expr, ELF::R_RISCV_HI20, Ctx);
444444
case ELF::R_RISCV_LO12_I:
445445
case ELF::R_RISCV_LO12_S:
446446
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_LO, Ctx);
447447
case ELF::R_RISCV_CALL:
448-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_CALL, Ctx);
448+
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
449449
case ELF::R_RISCV_CALL_PLT:
450-
return RISCVMCExpr::create(Expr, RISCVMCExpr::VK_CALL_PLT, Ctx);
450+
return RISCVMCExpr::create(Expr, ELF::R_RISCV_CALL_PLT, Ctx);
451451
}
452452
}
453453

@@ -472,8 +472,7 @@ class RISCVMCPlusBuilder : public MCPlusBuilder {
472472
switch (cast<RISCVMCExpr>(ImmExpr)->getSpecifier()) {
473473
default:
474474
return false;
475-
case RISCVMCExpr::VK_CALL:
476-
case RISCVMCExpr::VK_CALL_PLT:
475+
case ELF::R_RISCV_CALL_PLT:
477476
return true;
478477
}
479478
}

clang/lib/CodeGen/CGHLSLBuiltins.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -412,24 +412,28 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
412412
ArrayRef<Value *>{Op0, Op1}, nullptr, "hlsl.dot");
413413
}
414414
case Builtin::BI__builtin_hlsl_dot4add_i8packed: {
415-
Value *A = EmitScalarExpr(E->getArg(0));
416-
Value *B = EmitScalarExpr(E->getArg(1));
417-
Value *C = EmitScalarExpr(E->getArg(2));
415+
Value *X = EmitScalarExpr(E->getArg(0));
416+
Value *Y = EmitScalarExpr(E->getArg(1));
417+
Value *Acc = EmitScalarExpr(E->getArg(2));
418418

419419
Intrinsic::ID ID = CGM.getHLSLRuntime().getDot4AddI8PackedIntrinsic();
420+
// Note that the argument order disagrees between the builtin and the
421+
// intrinsic here.
420422
return Builder.CreateIntrinsic(
421-
/*ReturnType=*/C->getType(), ID, ArrayRef<Value *>{A, B, C}, nullptr,
422-
"hlsl.dot4add.i8packed");
423+
/*ReturnType=*/Acc->getType(), ID, ArrayRef<Value *>{Acc, X, Y},
424+
nullptr, "hlsl.dot4add.i8packed");
423425
}
424426
case Builtin::BI__builtin_hlsl_dot4add_u8packed: {
425-
Value *A = EmitScalarExpr(E->getArg(0));
426-
Value *B = EmitScalarExpr(E->getArg(1));
427-
Value *C = EmitScalarExpr(E->getArg(2));
427+
Value *X = EmitScalarExpr(E->getArg(0));
428+
Value *Y = EmitScalarExpr(E->getArg(1));
429+
Value *Acc = EmitScalarExpr(E->getArg(2));
428430

429431
Intrinsic::ID ID = CGM.getHLSLRuntime().getDot4AddU8PackedIntrinsic();
432+
// Note that the argument order disagrees between the builtin and the
433+
// intrinsic here.
430434
return Builder.CreateIntrinsic(
431-
/*ReturnType=*/C->getType(), ID, ArrayRef<Value *>{A, B, C}, nullptr,
432-
"hlsl.dot4add.u8packed");
435+
/*ReturnType=*/Acc->getType(), ID, ArrayRef<Value *>{Acc, X, Y},
436+
nullptr, "hlsl.dot4add.u8packed");
433437
}
434438
case Builtin::BI__builtin_hlsl_elementwise_firstbithigh: {
435439
Value *X = EmitScalarExpr(E->getArg(0));
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
// RUN: %clang_cc1 -finclude-default-header -triple \
2-
// RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \
3-
// RUN: FileCheck %s -DTARGET=dx
4-
// RUN: %clang_cc1 -finclude-default-header -triple \
5-
// RUN: spirv-pc-vulkan-compute %s -emit-llvm -disable-llvm-passes -o - | \
6-
// RUN: FileCheck %s -DTARGET=spv
1+
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.4-compute %s -emit-llvm -o - | FileCheck %s -DTARGET=dx
2+
// RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s -DTARGET=spv
73

84
// Test basic lowering to runtime function call.
95

106
// CHECK-LABEL: test
11-
int test(uint a, uint b, int c) {
12-
// CHECK: %[[RET:.*]] = call [[TY:i32]] @llvm.[[TARGET]].dot4add.i8packed([[TY]] %[[#]], [[TY]] %[[#]], [[TY]] %[[#]])
13-
// CHECK: ret [[TY]] %[[RET]]
14-
return dot4add_i8packed(a, b, c);
7+
int test(uint x, uint y, int acc) {
8+
// CHECK: [[X_ADDR:%.*]] = alloca i32, align 4
9+
// CHECK: [[Y_ADDR:%.*]] = alloca i32, align 4
10+
// CHECK: [[ACC_ADDR:%.*]] = alloca i32, align 4
11+
// CHECK: store i32 %x, ptr [[X_ADDR]], align 4
12+
// CHECK: store i32 %y, ptr [[Y_ADDR]], align 4
13+
// CHECK: store i32 %acc, ptr [[ACC_ADDR]], align 4
14+
// CHECK: [[X0:%.*]] = load i32, ptr [[X_ADDR]], align 4
15+
// CHECK: [[Y0:%.*]] = load i32, ptr [[Y_ADDR]], align 4
16+
// CHECK: [[ACC0:%.*]] = load i32, ptr [[ACC_ADDR]], align 4
17+
// CHECK: call i32 @llvm.[[TARGET]].dot4add.i8packed(i32 [[ACC0]], i32 [[X0]], i32 [[Y0]])
18+
return dot4add_i8packed(x, y, acc);
1519
}
1620

17-
// CHECK: declare [[TY]] @llvm.[[TARGET]].dot4add.i8packed([[TY]], [[TY]], [[TY]])
21+
[numthreads(1,1,1)]
22+
void main() {
23+
test(0, 0, 0);
24+
}
Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
2-
// RUN: %clang_cc1 -finclude-default-header -triple \
3-
// RUN: dxil-pc-shadermodel6.3-compute %s -emit-llvm -disable-llvm-passes -o - | \
4-
// RUN: FileCheck %s -DTARGET=dx
5-
// RUN: %clang_cc1 -finclude-default-header -triple \
6-
// RUN: spirv-pc-vulkan-compute %s -emit-llvm -disable-llvm-passes -o - | \
7-
// RUN: FileCheck %s -DTARGET=spv
1+
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.4-compute %s -emit-llvm -o - | FileCheck %s -DTARGET=dx
2+
// RUN: %clang_cc1 -finclude-default-header -triple spirv-pc-vulkan-compute %s -emit-llvm -o - | FileCheck %s -DTARGET=spv
83

94
// Test basic lowering to runtime function call.
105

11-
// CHECK-LABEL: define {{.*}}test
12-
uint test(uint a, uint b, uint c) {
13-
// CHECK: %[[RET:.*]] = call [[TY:i32]] @llvm.[[TARGET]].dot4add.u8packed([[TY]] %[[#]], [[TY]] %[[#]], [[TY]] %[[#]])
14-
// CHECK: ret [[TY]] %[[RET]]
15-
return dot4add_u8packed(a, b, c);
6+
// CHECK-LABEL: test
7+
int test(uint x, uint y, int acc) {
8+
// CHECK: [[X_ADDR:%.*]] = alloca i32, align 4
9+
// CHECK: [[Y_ADDR:%.*]] = alloca i32, align 4
10+
// CHECK: [[ACC_ADDR:%.*]] = alloca i32, align 4
11+
// CHECK: store i32 %x, ptr [[X_ADDR]], align 4
12+
// CHECK: store i32 %y, ptr [[Y_ADDR]], align 4
13+
// CHECK: store i32 %acc, ptr [[ACC_ADDR]], align 4
14+
// CHECK: [[X0:%.*]] = load i32, ptr [[X_ADDR]], align 4
15+
// CHECK: [[Y0:%.*]] = load i32, ptr [[Y_ADDR]], align 4
16+
// CHECK: [[ACC0:%.*]] = load i32, ptr [[ACC_ADDR]], align 4
17+
// CHECK: call i32 @llvm.[[TARGET]].dot4add.u8packed(i32 [[ACC0]], i32 [[X0]], i32 [[Y0]])
18+
return dot4add_u8packed(x, y, acc);
1619
}
1720

18-
// CHECK: declare [[TY]] @llvm.[[TARGET]].dot4add.u8packed([[TY]], [[TY]], [[TY]])
21+
[numthreads(1,1,1)]
22+
void main() {
23+
test(0, 0, 0);
24+
}

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3346,9 +3346,9 @@ bool CommandInterpreter::SaveTranscript(
33463346
CommandReturnObject &result, std::optional<std::string> output_file) {
33473347
if (output_file == std::nullopt || output_file->empty()) {
33483348
std::string now = llvm::to_string(std::chrono::system_clock::now());
3349-
std::replace(now.begin(), now.end(), ' ', '_');
3349+
llvm::replace(now, ' ', '_');
33503350
// Can't have file name with colons on Windows
3351-
std::replace(now.begin(), now.end(), ':', '-');
3351+
llvm::replace(now, ':', '-');
33523352
const std::string file_name = "lldb_session_" + now + ".log";
33533353

33543354
FileSpec save_location = GetSaveSessionDirectory();

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ TokenVerifier::TokenVerifier(std::string body) {
251251
// We only care about tokens and not their original source locations. If we
252252
// move the whole expression to only be in one line we can simplify the
253253
// following code that extracts the token contents.
254-
std::replace(body.begin(), body.end(), '\n', ' ');
255-
std::replace(body.begin(), body.end(), '\r', ' ');
254+
llvm::replace(body, '\n', ' ');
255+
llvm::replace(body, '\r', ' ');
256256

257257
FileSystemOptions file_opts;
258258
FileManager file_mgr(file_opts,

lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,9 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
237237
// ScriptInterpreter. For now, we just replace dots with
238238
// underscores, but if we ever support anything other than
239239
// Python we will need to rework this
240-
std::replace(module_basename.begin(), module_basename.end(), '.',
241-
'_');
242-
std::replace(module_basename.begin(), module_basename.end(), ' ',
243-
'_');
244-
std::replace(module_basename.begin(), module_basename.end(), '-',
245-
'_');
240+
llvm::replace(module_basename, '.', '_');
241+
llvm::replace(module_basename, ' ', '_');
242+
llvm::replace(module_basename, '-', '_');
246243
ScriptInterpreter *script_interpreter =
247244
target->GetDebugger().GetScriptInterpreter();
248245
if (script_interpreter &&

lldb/source/Utility/FileSpec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void Denormalize(llvm::SmallVectorImpl<char> &path, FileSpec::Style style) {
6060
if (PathStyleIsPosix(style))
6161
return;
6262

63-
std::replace(path.begin(), path.end(), '/', '\\');
63+
llvm::replace(path, '/', '\\');
6464
}
6565

6666
} // end anonymous namespace
@@ -186,7 +186,7 @@ void FileSpec::SetFile(llvm::StringRef pathname, Style style) {
186186

187187
// Normalize back slashes to forward slashes
188188
if (m_style == Style::windows)
189-
std::replace(resolved.begin(), resolved.end(), '\\', '/');
189+
llvm::replace(resolved, '\\', '/');
190190

191191
if (resolved.empty()) {
192192
// If we have no path after normalization set the path to the current

lldb/utils/TableGen/LLDBOptionDefEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void emitOptions(std::string Command, ArrayRef<const Record *> Records,
150150
std::vector<CommandOption> Options(Records.begin(), Records.end());
151151

152152
std::string ID = Command;
153-
std::replace(ID.begin(), ID.end(), ' ', '_');
153+
llvm::replace(ID, ' ', '_');
154154
// Generate the macro that the user needs to define before including the
155155
// *.inc file.
156156
std::string NeededMacro = "LLDB_OPTIONS_" + ID;

lldb/utils/TableGen/LLDBPropertyDefEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static void emityProperties(std::string PropertyName,
131131
// Generate the macro that the user needs to define before including the
132132
// *.inc file.
133133
std::string NeededMacro = "LLDB_PROPERTIES_" + PropertyName;
134-
std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
134+
llvm::replace(NeededMacro, ' ', '_');
135135

136136
// All options are in one file, so we need put them behind macros and ask the
137137
// user to define the macro for the options that are needed.
@@ -154,7 +154,7 @@ static void emitPropertyEnum(std::string PropertyName,
154154
// Generate the macro that the user needs to define before including the
155155
// *.inc file.
156156
std::string NeededMacro = "LLDB_PROPERTIES_" + PropertyName;
157-
std::replace(NeededMacro.begin(), NeededMacro.end(), ' ', '_');
157+
llvm::replace(NeededMacro, ' ', '_');
158158

159159
// All options are in one file, so we need put them behind macros and ask the
160160
// user to define the macro for the options that are needed.

0 commit comments

Comments
 (0)