Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces deprecated CreateGlobalStringPtr with CreateGlobalString #2217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions enzyme/Enzyme/TraceGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void TraceGenerator::visitFunction(Function &F) {
continue;

auto arg = fn->arg_begin() + i;
auto name = Builder.CreateGlobalStringPtr(arg->getName());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the new function available in LLVM15? If not, can this be version gated (e.g. with

#if LLVM_VERSION_MAJOR >= 16
 auto name = Builder.CreateGlobalString(arg->getName());
#else
  auto name = Builder.CreateGlobalStringPtr(arg->getName());
#endif

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this API was deprecated in LLVM 15 too, so the test failures are genuine (my bad for only running the C++ tests...). Will try to find some time to look into it soon.

auto name = Builder.CreateGlobalString(arg->getName());

auto Outlined = [](IRBuilder<> &OutlineBuilder, TraceUtils *OutlineTutils,
ArrayRef<Value *> Arguments) {
Expand Down Expand Up @@ -348,7 +348,7 @@ void TraceGenerator::handleArbitraryCall(CallInst &call, CallInst *new_call) {
}
case ProbProgMode::Trace: {
auto trace = tutils->CreateTrace(Builder);
auto address = Builder.CreateGlobalStringPtr(
auto address = Builder.CreateGlobalString(
(call.getName() + "." + called->getName()).str());

SmallVector<Value *, 2> args_and_trace(args);
Expand All @@ -363,7 +363,7 @@ void TraceGenerator::handleArbitraryCall(CallInst &call, CallInst *new_call) {
}
case ProbProgMode::Condition: {
auto trace = tutils->CreateTrace(Builder);
auto address = Builder.CreateGlobalStringPtr(
auto address = Builder.CreateGlobalString(
(call.getName() + "." + called->getName()).str());

Instruction *hasCall =
Expand Down
10 changes: 5 additions & 5 deletions enzyme/tools/enzyme-tblgen/enzyme-tblgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2350,18 +2350,18 @@ static void emitDerivatives(const RecordKeeper &recordKeeper, raw_ostream &os,
<< " }\n"
<< " }\n"
<< " Value *moduleNameValue = "
"Builder2.CreateGlobalStringPtr(moduleName);\n"
"Builder2.CreateGlobalString(moduleName);\n"
<< " Value *functionNameValue = "
"Builder2.CreateGlobalStringPtr(functionName + \" (\" +"
"Builder2.CreateGlobalString(functionName + \" (\" +"
"std::to_string(funcIdx) + \")\");\n"
<< " Value *blockNameValue = "
"Builder2.CreateGlobalStringPtr(blockName + \" (\" +"
"Builder2.CreateGlobalString(blockName + \" (\" +"
"std::to_string(blockIdx) + \")\");\n"
<< " Value *opcodeNameValue = "
"Builder2.CreateGlobalStringPtr(opcodeName + \" (\" "
"Builder2.CreateGlobalString(opcodeName + \" (\" "
"+std::to_string(instIdx) + \")\");\n"
<< " Value *calleeNameValue = "
"Builder2.CreateGlobalStringPtr(calleeName);\n"
"Builder2.CreateGlobalString(calleeName);\n"
<< " Builder2.CreateCall(logFunc, {origValue, "
"errValue, opcodeNameValue, calleeNameValue, moduleNameValue, "
"functionNameValue, blockNameValue});\n"
Expand Down
Loading