Skip to content

Commit 215efb2

Browse files
committed
Fix NVPTX logic bug
1 parent 24f49dc commit 215efb2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ static cl::opt<bool> DisableRequireStructuredCFG(
5959
"unexpected regressions happen."),
6060
cl::init(false), cl::Hidden);
6161

62+
static cl::opt<bool> UseShortPointersOpt(
63+
"nvptx-short-ptr",
64+
cl::desc(
65+
"Use 32-bit pointers for accessing const/local/shared address spaces."),
66+
cl::init(false), cl::Hidden);
67+
6268
// byval arguments in NVPTX are special. We're only allowed to read from them
6369
// using a special instruction, and if we ever need to write to them or take an
6470
// address, we must make a local copy and use it, instead.
@@ -112,12 +118,6 @@ extern "C" LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializeNVPTXTarget() {
112118
initializeNVPTXPrologEpilogPassPass(PR);
113119
}
114120

115-
static cl::opt<bool> NVPTXUseShortPointers(
116-
"nvptx-short-ptr",
117-
cl::desc(
118-
"Use 32-bit pointers for accessing const/local/shared address spaces."),
119-
cl::init(false), cl::Hidden);
120-
121121
NVPTXTargetMachine::NVPTXTargetMachine(const Target &T, const Triple &TT,
122122
StringRef CPU, StringRef FS,
123123
const TargetOptions &Options,
@@ -127,7 +127,7 @@ NVPTXTargetMachine::NVPTXTargetMachine(const Target &T, const Triple &TT,
127127
// The pic relocation model is used regardless of what the client has
128128
// specified, as it is the only relocation model currently supported.
129129
: CodeGenTargetMachineImpl(
130-
T, TT.computeDataLayout(NVPTXUseShortPointers ? "" : "shortptr"), TT,
130+
T, TT.computeDataLayout(UseShortPointersOpt ? "shortptr" : ""), TT,
131131
CPU, FS, Options, Reloc::PIC_,
132132
getEffectiveCodeModel(CM, CodeModel::Small), OL),
133133
is64bit(is64bit), TLOF(std::make_unique<NVPTXTargetObjectFile>()),

0 commit comments

Comments
 (0)