From 744ede0c8525271cb7e977f91ff601e794f9c3ec Mon Sep 17 00:00:00 2001 From: Matin Raayai <30674652+matinraayai@users.noreply.github.com> Date: Tue, 27 Feb 2024 00:56:50 -0500 Subject: [PATCH] Fixed incorrect usage of llvm::Function::splice. (#1751) * Fixed incorrect usage of llvm::Function::splice. * Put an #ifdef to take into account the LLVM version when using llvm::Function::splice. * fix format --------- Co-authored-by: William S. Moses --- enzyme/Enzyme/Enzyme.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/enzyme/Enzyme/Enzyme.cpp b/enzyme/Enzyme/Enzyme.cpp index 055b6f394842..47e9f2bba91f 100644 --- a/enzyme/Enzyme/Enzyme.cpp +++ b/enzyme/Enzyme/Enzyme.cpp @@ -2110,8 +2110,12 @@ class EnzymeBase { // Move the truncated body into the original function F.deleteBody(); +#if LLVM_VERSION_MAJOR >= 16 + F.splice(F.begin(), TruncatedFunc); +#else F.getBasicBlockList().splice(F.begin(), TruncatedFunc->getBasicBlockList()); +#endif RemapFunction(F, Mapping, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); TruncatedFunc->deleteBody();