Skip to content

Commit 93ca0b7

Browse files
authored
Fix LLVM 14 build (rust-lang#630)
1 parent b4208f6 commit 93ca0b7

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/enzyme-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
llvm: ["7", "8", "9", "10", "11", "12", "13"] #, "14"]
13+
llvm: ["7", "8", "9", "10", "11", "12", "13", "14"]
1414
build: ["Release", "Debug"] # "RelWithDebInfo"
1515
os: [ubuntu-20.04, ubuntu-18.04] #self-hosted]
1616

enzyme/Enzyme/Enzyme.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,11 +792,19 @@ class Enzyme : public ModulePass {
792792
element = Builder.CreateBitCast(
793793
element, PointerType::get(Type::getInt8Ty(CI->getContext()),
794794
elementPtrTy->getAddressSpace()));
795+
#if LLVM_VERSION_MAJOR >= 7
796+
element = Builder.CreateGEP(
797+
Type::getInt8Ty(CI->getContext()), element,
798+
Builder.CreateMul(
799+
batchOffset[i - 1],
800+
ConstantInt::get(batchOffset[i - 1]->getType(), v)));
801+
#else
795802
element = Builder.CreateGEP(
796803
element,
797804
Builder.CreateMul(
798805
batchOffset[i - 1],
799806
ConstantInt::get(batchOffset[i - 1]->getType(), v)));
807+
#endif
800808
element = Builder.CreateBitCast(element, elementPtrTy);
801809
} else {
802810
return false;

0 commit comments

Comments
 (0)