Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/include/llvm/Target/TargetMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ class TargetMachine {
return DL.getPointerSize(DL.getAllocaAddrSpace());
}

bool hasCheriCapabilities() const { return DL.hasCheriCapabilities(); }

/// Reset the target options based on the function's attributes.
// FIXME: Remove TargetOptions that affect per-function code generation
// from TargetMachine.
Expand Down
8 changes: 4 additions & 4 deletions llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,10 @@ bool RISCVPassConfig::addPreISel() {
addPass(createBarrierNoopPass());
}

bool isCheriot =
TM->getTargetTriple().getSubArch() == Triple::RISCV32SubArch_cheriot_v1;
if ((TM->getOptLevel() != CodeGenOptLevel::None && !isCheriot &&
EnableGlobalMerge == cl::BOU_UNSET) ||
// XXX: GlobalMerge is undesirable on CHERI, as it makes the bounds on globals
// excessively loose.
if ((TM->getOptLevel() != CodeGenOptLevel::None &&
!TM->hasCheriCapabilities() && EnableGlobalMerge == cl::BOU_UNSET) ||
EnableGlobalMerge == cl::BOU_TRUE) {
// FIXME: Like AArch64, we disable extern global merging by default due to
// concerns it might regress some workloads. Unlike AArch64, we don't
Expand Down