Skip to content

Commit 49e18a5

Browse files
author
git apple-llvm automerger
committed
Merge commit '6ecc67fb3223' from llvm.org/main into next
2 parents f8ae482 + 6ecc67f commit 49e18a5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# RUN: not llvm-exegesis -mtriple=riscv64-unknown-linux-gnu -mode=latency --benchmark-phase=assemble-measured-code -opcode-name=ADD 2>&1 | FileCheck %s
2+
3+
# CHECK: llvm-exegesis error: A CPU must be explicitly specified when cross compiling. To see all possible options for riscv64-unknown-linux-gnu triple use -mcpu=help

llvm/tools/llvm-exegesis/lib/LlvmState.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,17 @@ Expected<LLVMState> LLVMState::Create(std::string TripleName,
4242
// Update Triple with the updated triple from the target lookup.
4343
TripleName = TheTriple.str();
4444

45-
if (CpuName == "native")
45+
if (CpuName == "native") {
46+
// case for cross generating, when native arch and target mismatch
47+
if ((Triple(sys::getProcessTriple()).getArch() !=
48+
Triple(TripleName).getArch()))
49+
return make_error<StringError>(
50+
"A CPU must be explicitly specified when cross compiling. To see all "
51+
"possible options for " +
52+
TripleName + " triple use -mcpu=help",
53+
inconvertibleErrorCode());
4654
CpuName = std::string(sys::getHostCPUName());
55+
}
4756

4857
std::unique_ptr<MCSubtargetInfo> STI(
4958
TheTarget->createMCSubtargetInfo(TripleName, CpuName, ""));

0 commit comments

Comments
 (0)