Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions enzyme/Enzyme/FunctionUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8038,6 +8038,11 @@ void replaceToDense(llvm::CallBase *CI, bool replaceAll, llvm::Function *F,
continue;
}
if (auto SI = dyn_cast<StoreInst>(U)) {
if (SI->getValueOperand() == val) {
EmitFailure("IllegalSparse", SI->getDebugLoc(), SI,
" result of __enzyme_todense was captured (e.g. stored into memory and not directly loaded from or stored into) ", *SI);
continue;
}
assert(SI->getValueOperand() != val);
auto diff = toInt(B, replacements[SI->getPointerOperand()]);
SmallVector<Value *, 2> args;
Expand Down
1 change: 1 addition & 0 deletions enzyme/test/Integration/Sparse/ringspring.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This should work on LLVM 7, 8, 9, however in CI the version of clang installed on Ubuntu 18.04 cannot load
// a clang plugin properly without segfaulting on exit. This is fine on Ubuntu 20.04 or later LLVM versions...
// RUN: if [ %llvmver -ge 12 ]; then %clang++ -fno-exceptions -ffast-math -mllvm -enable-load-pre=0 -std=c++11 -O0 %s -S -emit-llvm -o - %loadClangEnzyme -mllvm -enzyme-auto-sparsity=1 | %lli - ; fi
// RUN: if [ %llvmver -ge 12 ]; then %clang++ -fno-exceptions -ffast-math -mllvm -enable-load-pre=0 -std=c++11 -O1 %s -S -emit-llvm -o - %loadClangEnzyme -mllvm -enzyme-auto-sparsity=1 | %lli - ; fi
// RUN: if [ %llvmver -ge 12 ]; then %clang++ -fno-exceptions -ffast-math -mllvm -enable-load-pre=0 -std=c++11 -O2 %s -S -emit-llvm -o - %loadClangEnzyme -mllvm -enzyme-auto-sparsity=1 | %lli - ; fi
// RUN: if [ %llvmver -ge 12 ]; then %clang++ -fno-exceptions -ffast-math -mllvm -enable-load-pre=0 -std=c++11 -O3 %s -S -emit-llvm -o - %loadClangEnzyme -mllvm -enzyme-auto-sparsity=1 | %lli - ; fi
Expand Down
Loading