Skip to content

Commit

Permalink
fix llvm 14/15 build (rust-lang#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgymnich authored Feb 23, 2023
1 parent 7265291 commit 3e1e2d0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11480,7 +11480,7 @@ class AdjointGenerator
if (!noFree && !EnzymeGlobalActivity) {
bool mayActiveFree = false;
#if LLVM_VERSION_MAJOR >= 14
for (unsigned i = 0; i < orig->arg_size(); ++i)
for (unsigned i = 0; i < call.arg_size(); ++i)
#else
for (unsigned i = 0; i < call.getNumArgOperands(); ++i)
#endif
Expand Down Expand Up @@ -11606,7 +11606,7 @@ class AdjointGenerator
std::map<int, Attribute> structAttrs;

#if LLVM_VERSION_MAJOR >= 14
for (unsigned i = 0; i < orig->arg_size(); ++i)
for (unsigned i = 0; i < call.arg_size(); ++i)
#else
for (unsigned i = 0; i < call.getNumArgOperands(); ++i)
#endif
Expand Down Expand Up @@ -11642,7 +11642,7 @@ class AdjointGenerator
writeOnlyNoCapture = false;
}
#if LLVM_VERSION_MAJOR >= 14
if (!orig->onlyWritesMemory(i))
if (!call.onlyWritesMemory(i))
#else
if (!(call.dataOperandHasImpliedAttr(i + 1, Attribute::WriteOnly) ||
call.dataOperandHasImpliedAttr(i + 1, Attribute::ReadNone) ||
Expand Down Expand Up @@ -11879,7 +11879,7 @@ class AdjointGenerator
}

#if LLVM_VERSION_MAJOR >= 14
for (unsigned i = 0; i < orig->arg_size(); ++i)
for (unsigned i = 0; i < call.arg_size(); ++i)
#else
for (unsigned i = 0; i < call.getNumArgOperands(); ++i)
#endif
Expand Down Expand Up @@ -11919,7 +11919,7 @@ class AdjointGenerator
writeOnlyNoCapture = false;
}
#if LLVM_VERSION_MAJOR >= 14
if (!orig->onlyWritesMemory(i))
if (!call.onlyWritesMemory(i))
#else
if (!(call.dataOperandHasImpliedAttr(i + 1, Attribute::WriteOnly) ||
call.dataOperandHasImpliedAttr(i + 1, Attribute::ReadNone) ||
Expand Down Expand Up @@ -12023,7 +12023,7 @@ class AdjointGenerator
BundleTypes.push_back(ValueType::Both);
if (called) {
#if LLVM_VERSION_MAJOR >= 14
if (orig->arg_size() !=
if (call.arg_size() !=
cast<Function>(called)->getFunctionType()->getNumParams())
#else
if (call.getNumArgOperands() !=
Expand Down Expand Up @@ -12095,13 +12095,13 @@ class AdjointGenerator
ft = F->getFunctionType();
else {
#if LLVM_VERSION_MAJOR >= 15
if (orig->getContext().supportsTypedPointers()) {
if (call.getContext().supportsTypedPointers()) {
#endif
ft =
cast<FunctionType>(callval->getType()->getPointerElementType());
#if LLVM_VERSION_MAJOR >= 15
} else {
ft = orig->getFunctionType();
ft = call.getFunctionType();
}
#endif
}
Expand Down Expand Up @@ -12630,7 +12630,7 @@ class AdjointGenerator
}

#if LLVM_VERSION_MAJOR >= 14
for (unsigned i = 0; i < orig->arg_size(); ++i)
for (unsigned i = 0; i < call.arg_size(); ++i)
#else
for (unsigned i = 0; i < call.getNumArgOperands(); ++i)
#endif
Expand Down

0 comments on commit 3e1e2d0

Please sign in to comment.