Skip to content

Commit 47f006e

Browse files
authored
LLVM 14 support (rust-lang#429)
* LLVM 14 support * Start to enable LLVM 7 support * Continuing LLVM 7 * Finish LLVM 7 * Add LLVM 14 test * Fix format * Fix loop bound canonicalization * Correct cache utility
1 parent 5635e96 commit 47f006e

36 files changed

+1011
-348
lines changed

.github/workflows/bcload.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"]
13+
llvm: ["7", "8", "9", "10", "11", "12", "13"] #, "14"]
1414
build: ["Release"] # "RelWithDebInfo"
1515
os: [ubuntu-20.04, ubuntu-18.04]
1616

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
llvm: ["7", "8", "9", "10", "11", "12", "13"]
19+
llvm: ["7", "8", "9", "10", "11", "12", "13"] #, "14"]
2020
build: ["Release", "Debug"] # "RelWithDebInfo"
2121
os: [self-hosted]
2222
timeout-minutes: 120
2323
steps:
2424
- name: add llvm
2525
run: |
2626
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
27-
sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-${{ matrix.llvm }} main" || true
27+
sudo apt-add-repository "deb http://apt.llvm.org/`lsb_release -c | cut -f2`/ llvm-toolchain-`lsb_release -c | cut -f2`-${{ matrix.llvm }} main" || true
2828
sudo apt-get install -y python-pip autoconf cmake gcc g++ libtool gfortran libblas-dev llvm-${{ matrix.llvm }}-dev clang-${{ matrix.llvm }} libeigen3-dev libboost-dev
2929
sudo pip install lit
3030
sudo touch /usr/lib/llvm-${{ matrix.llvm }}/bin/yaml-bench

.github/workflows/ccpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
llvm: ["7", "8", "9", "10", "11", "12", "13"]
19+
llvm: ["7", "8", "9", "10", "11", "12", "13"] #, "14"]
2020
build: ["Release"] # "RelWithDebInfo"
2121
os: [ubuntu-20.04, ubuntu-18.04]
2222

.github/workflows/enzyme-linux.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"]
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/ActivityAnalysis.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,12 @@ bool ActivityAnalyzer::isFunctionArgumentConstant(CallInst *CI, Value *val) {
254254
if (Name == "Faddeeva_erf" || Name == "Faddeeva_erfc" ||
255255
Name == "Faddeeva_erfcx" || Name == "Faddeeva_erfi" ||
256256
Name == "Faddeeva_dawson") {
257-
for (size_t i = 0; i < CI->getNumArgOperands() - 1; i++) {
257+
#if LLVM_VERSION_MAJOR >= 14
258+
for (size_t i = 0; i < CI->arg_size() - 1; i++)
259+
#else
260+
for (size_t i = 0; i < CI->getNumArgOperands() - 1; i++)
261+
#endif
262+
{
258263
if (val == CI->getOperand(i))
259264
return false;
260265
}
@@ -335,7 +340,12 @@ static inline void propagateArgumentInformation(
335340
if (Name == "Faddeeva_erf" || Name == "Faddeeva_erfc" ||
336341
Name == "Faddeeva_erfcx" || Name == "Faddeeva_erfi" ||
337342
Name == "Faddeeva_dawson") {
338-
for (size_t i = 0; i < CI.getNumArgOperands() - 1; i++) {
343+
#if LLVM_VERSION_MAJOR >= 14
344+
for (size_t i = 0; i < CI.arg_size() - 1; i++)
345+
#else
346+
for (size_t i = 0; i < CI.getNumArgOperands() - 1; i++)
347+
#endif
348+
{
339349
propagateFromOperand(CI.getOperand(i));
340350
}
341351
return;
@@ -909,7 +919,9 @@ bool ActivityAnalyzer::isConstantValue(TypeResults &TR, Value *Val) {
909919
return true;
910920
}
911921
}
912-
if (ce->isGEPWithNoNotionalOverIndexing()) {
922+
if (ce->getOpcode() == Instruction::GetElementPtr &&
923+
llvm::all_of(ce->operand_values(),
924+
[&](Value *v) { return isConstantValue(TR, v); })) {
913925
if (isConstantValue(TR, ce->getOperand(0))) {
914926
if (EnzymePrintActivity)
915927
llvm::errs() << " VALUE const cast from gep operand " << *Val << "\n";

0 commit comments

Comments
 (0)