From 3e1e2d0a14f7b27e5ae9b1a16f4c28b0ba9b25e7 Mon Sep 17 00:00:00 2001 From: Tim Gymnich Date: Wed, 22 Feb 2023 23:39:52 -0700 Subject: [PATCH] fix llvm 14/15 build (#1004) --- enzyme/Enzyme/AdjointGenerator.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/enzyme/Enzyme/AdjointGenerator.h b/enzyme/Enzyme/AdjointGenerator.h index 3d8373d9897a9..a64fe6896db0b 100644 --- a/enzyme/Enzyme/AdjointGenerator.h +++ b/enzyme/Enzyme/AdjointGenerator.h @@ -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 @@ -11606,7 +11606,7 @@ class AdjointGenerator std::map 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 @@ -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) || @@ -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 @@ -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) || @@ -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(called)->getFunctionType()->getNumParams()) #else if (call.getNumArgOperands() != @@ -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(callval->getType()->getPointerElementType()); #if LLVM_VERSION_MAJOR >= 15 } else { - ft = orig->getFunctionType(); + ft = call.getFunctionType(); } #endif } @@ -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