Skip to content

Commit

Permalink
Fixed incorrect usage of llvm::Function::splice. (#1751)
Browse files Browse the repository at this point in the history
* 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 <gh@wsmoses.com>
  • Loading branch information
matinraayai and wsmoses authored Feb 27, 2024
1 parent 3e2de5d commit 744ede0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions enzyme/Enzyme/Enzyme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 744ede0

Please sign in to comment.