aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-gpu-loader/amdhsa.cpp4
-rw-r--r--llvm/tools/llvm-gpu-loader/llvm-gpu-loader.h4
-rw-r--r--llvm/tools/llvm-gpu-loader/nvptx.cpp4
-rw-r--r--llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp6
-rw-r--r--llvm/tools/llvm-profgen/ProfiledBinary.cpp21
-rw-r--r--llvm/tools/llvm-profgen/ProfiledBinary.h16
6 files changed, 25 insertions, 30 deletions
diff --git a/llvm/tools/llvm-gpu-loader/amdhsa.cpp b/llvm/tools/llvm-gpu-loader/amdhsa.cpp
index be1b6b7..5715058 100644
--- a/llvm/tools/llvm-gpu-loader/amdhsa.cpp
+++ b/llvm/tools/llvm-gpu-loader/amdhsa.cpp
@@ -192,7 +192,7 @@ hsa_status_t launch_kernel(hsa_agent_t dev_agent, hsa_executable_t executable,
// Initialize all the arguments (explicit and implicit) to zero, then set the
// explicit arguments to the values created above.
std::memset(args, 0, args_size);
- std::memcpy(args, &kernel_args, sizeof(args_t));
+ std::memcpy(args, &kernel_args, std::is_empty_v<args_t> ? 0 : sizeof(args_t));
// Initialize the necessary implicit arguments to the proper values.
int dims = 1 + (params.num_blocks_y * params.num_threads_y != 1) +
@@ -563,7 +563,7 @@ int load_amdhsa(int argc, const char **argv, const char **envp, void *image,
// Save the return value and perform basic clean-up.
int ret = *static_cast<int *>(host_ret);
- end_args_t fini_args = {ret};
+ end_args_t fini_args = {};
if (hsa_status_t err = launch_kernel(
dev_agent, executable, kernargs_pool, coarsegrained_pool, queue,
server, single_threaded_params, "_end.kd", fini_args,
diff --git a/llvm/tools/llvm-gpu-loader/llvm-gpu-loader.h b/llvm/tools/llvm-gpu-loader/llvm-gpu-loader.h
index ed34d0b..08861c2 100644
--- a/llvm/tools/llvm-gpu-loader/llvm-gpu-loader.h
+++ b/llvm/tools/llvm-gpu-loader/llvm-gpu-loader.h
@@ -41,9 +41,7 @@ struct start_args_t {
};
/// The arguments to the '_end' kernel.
-struct end_args_t {
- int argc;
-};
+struct end_args_t {};
/// Generic interface to load the \p image and launch execution of the _start
/// kernel on the target device. Copies \p argc and \p argv to the device.
diff --git a/llvm/tools/llvm-gpu-loader/nvptx.cpp b/llvm/tools/llvm-gpu-loader/nvptx.cpp
index 781a045..82b4552 100644
--- a/llvm/tools/llvm-gpu-loader/nvptx.cpp
+++ b/llvm/tools/llvm-gpu-loader/nvptx.cpp
@@ -177,7 +177,7 @@ CUresult launch_kernel(CUmodule binary, CUstream stream, rpc::Server &server,
handle_error(err);
// Set up the arguments to the '_start' kernel on the GPU.
- uint64_t args_size = sizeof(args_t);
+ uint64_t args_size = std::is_empty_v<args_t> ? 0 : sizeof(args_t);
void *args_config[] = {CU_LAUNCH_PARAM_BUFFER_POINTER, &kernel_args,
CU_LAUNCH_PARAM_BUFFER_SIZE, &args_size,
CU_LAUNCH_PARAM_END};
@@ -342,7 +342,7 @@ int load_nvptx(int argc, const char **argv, const char **envp, void *image,
if (CUresult err = cuStreamSynchronize(stream))
handle_error(err);
- end_args_t fini_args = {host_ret};
+ end_args_t fini_args = {};
if (CUresult err =
launch_kernel(binary, stream, server, single_threaded_params, "_end",
fini_args, print_resource_usage))
diff --git a/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp b/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
index dca64af..fa56d0d 100644
--- a/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
+++ b/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp
@@ -182,8 +182,8 @@ int AssembleOneInput(const uint8_t *Data, size_t Size) {
const unsigned OutputAsmVariant = 0;
std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo());
- MCInstPrinter *IP = TheTarget->createMCInstPrinter(Triple(TripleName), OutputAsmVariant,
- *MAI, *MCII, *MRI);
+ std::unique_ptr<MCInstPrinter> IP(TheTarget->createMCInstPrinter(
+ Triple(TripleName), OutputAsmVariant, *MAI, *MCII, *MRI));
if (!IP) {
errs()
<< "error: unable to create instruction printer for target triple '"
@@ -204,7 +204,7 @@ int AssembleOneInput(const uint8_t *Data, size_t Size) {
std::unique_ptr<MCStreamer> Str;
if (FileType == OFT_AssemblyFile) {
- Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
+ Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), std::move(IP),
std::move(CE), std::move(MAB)));
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index 6865e36..94728ce 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -250,14 +250,12 @@ void ProfiledBinary::load() {
DisassembleFunctionSet.insert_range(DisassembleFunctions);
- if (auto *ELFObj = dyn_cast<ELFObjectFileBase>(Obj)) {
- checkPseudoProbe(ELFObj);
- if (UsePseudoProbes)
- populateElfSymbolAddressList(ELFObj);
+ checkPseudoProbe(Obj);
+ if (UsePseudoProbes)
+ populateSymbolAddressList(Obj);
- if (ShowDisassemblyOnly)
- decodePseudoProbe(ELFObj);
- }
+ if (ShowDisassemblyOnly)
+ decodePseudoProbe(Obj);
// Disassemble the text sections.
disassemble(Obj);
@@ -417,7 +415,7 @@ void ProfiledBinary::setPreferredTextSegmentAddresses(const ObjectFile *Obj) {
llvm_unreachable("invalid object format");
}
-void ProfiledBinary::checkPseudoProbe(const ELFObjectFileBase *Obj) {
+void ProfiledBinary::checkPseudoProbe(const ObjectFile *Obj) {
if (UseDwarfCorrelation)
return;
@@ -440,7 +438,7 @@ void ProfiledBinary::checkPseudoProbe(const ELFObjectFileBase *Obj) {
UsePseudoProbes = HasProbeDescSection && HasPseudoProbeSection;
}
-void ProfiledBinary::decodePseudoProbe(const ELFObjectFileBase *Obj) {
+void ProfiledBinary::decodePseudoProbe(const ObjectFile *Obj) {
if (!UsePseudoProbes)
return;
@@ -511,7 +509,7 @@ void ProfiledBinary::decodePseudoProbe(const ELFObjectFileBase *Obj) {
void ProfiledBinary::decodePseudoProbe() {
OwningBinary<Binary> OBinary = unwrapOrError(createBinary(Path), Path);
Binary &ExeBinary = *OBinary.getBinary();
- auto *Obj = cast<ELFObjectFileBase>(&ExeBinary);
+ auto *Obj = cast<ObjectFile>(&ExeBinary);
decodePseudoProbe(Obj);
}
@@ -809,8 +807,7 @@ void ProfiledBinary::checkUseFSDiscriminator(
}
}
-void ProfiledBinary::populateElfSymbolAddressList(
- const ELFObjectFileBase *Obj) {
+void ProfiledBinary::populateSymbolAddressList(const ObjectFile *Obj) {
// Create a mapping from virtual address to symbol GUID and the other way
// around.
StringRef FileName = Obj->getFileName();
diff --git a/llvm/tools/llvm-profgen/ProfiledBinary.h b/llvm/tools/llvm-profgen/ProfiledBinary.h
index e82fbab..5a814b7 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.h
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.h
@@ -228,19 +228,19 @@ class ProfiledBinary {
// A list of binary functions that have samples.
std::unordered_set<const BinaryFunction *> ProfiledFunctions;
- // GUID to Elf symbol start address map
+ // GUID to symbol start address map
DenseMap<uint64_t, uint64_t> SymbolStartAddrs;
// These maps are for temporary use of warning diagnosis.
DenseSet<int64_t> AddrsWithMultipleSymbols;
DenseSet<std::pair<uint64_t, uint64_t>> AddrsWithInvalidInstruction;
- // Start address to Elf symbol GUID map
+ // Start address to symbol GUID map
std::unordered_multimap<uint64_t, uint64_t> StartAddrToSymMap;
// An ordered map of mapping function's start address to function range
- // relevant info. Currently to determine if the offset of ELF is the start of
- // a real function, we leverage the function range info from DWARF.
+ // relevant info. Currently to determine if the offset of ELF/COFF is the
+ // start of a real function, we leverage the function range info from DWARF.
std::map<uint64_t, FuncRange> StartAddrToFuncRangeMap;
// Address to context location map. Used to expand the context.
@@ -335,9 +335,9 @@ class ProfiledBinary {
void setPreferredTextSegmentAddresses(const object::COFFObjectFile *Obj,
StringRef FileName);
- void checkPseudoProbe(const object::ELFObjectFileBase *Obj);
+ void checkPseudoProbe(const object::ObjectFile *Obj);
- void decodePseudoProbe(const object::ELFObjectFileBase *Obj);
+ void decodePseudoProbe(const object::ObjectFile *Obj);
void checkUseFSDiscriminator(
const object::ObjectFile *Obj,
@@ -353,8 +353,8 @@ class ProfiledBinary {
// Load debug info from DWARF unit.
void loadSymbolsFromDWARFUnit(DWARFUnit &CompilationUnit);
- // Create elf symbol to its start address mapping.
- void populateElfSymbolAddressList(const object::ELFObjectFileBase *O);
+ // Create symbol to its start address mapping.
+ void populateSymbolAddressList(const object::ObjectFile *O);
// A function may be spilt into multiple non-continuous address ranges. We use
// this to set whether start a function range is the real entry of the