@@ -158,16 +158,15 @@ static bool isPotentialLastLoopValue(llvm::Value *val,
158158 return false ;
159159}
160160
161- GradientUtils::GradientUtils (EnzymeLogic &Logic, Function *newFunc_,
162- Function *oldFunc_, TargetLibraryInfo &TLI_,
163- TypeAnalysis &TA_, TypeResults TR_,
164- ValueToValueMapTy &invertedPointers_,
165- const SmallPtrSetImpl<Value *> &constantvalues_,
166- const SmallPtrSetImpl<Value *> &activevals_,
167- DIFFE_TYPE ReturnActivity,
168- ArrayRef<DIFFE_TYPE> ArgDiffeTypes_,
169- ValueToValueMapTy &originalToNewFn_,
170- DerivativeMode mode, unsigned width, bool omp)
161+ GradientUtils::GradientUtils (
162+ EnzymeLogic &Logic, Function *newFunc_, Function *oldFunc_,
163+ TargetLibraryInfo &TLI_, TypeAnalysis &TA_, TypeResults TR_,
164+ ValueToValueMapTy &invertedPointers_,
165+ const SmallPtrSetImpl<Value *> &constantvalues_,
166+ const SmallPtrSetImpl<Value *> &activevals_, DIFFE_TYPE ReturnActivity,
167+ ArrayRef<DIFFE_TYPE> ArgDiffeTypes_,
168+ llvm::ValueMap<const llvm::Value *, AssertingReplacingVH> &originalToNewFn_,
169+ DerivativeMode mode, unsigned width, bool omp)
171170 : CacheUtility(TLI_, newFunc_), Logic(Logic), mode(mode), oldFunc(oldFunc_),
172171 invertedPointers(),
173172 OrigDT(Logic.PPC.FAM.getResult<llvm::DominatorTreeAnalysis>(*oldFunc_)),
@@ -592,7 +591,8 @@ BasicBlock *GradientUtils::getOriginalFromNew(const BasicBlock *newinst) const {
592591 assert (newinst->getParent () == newFunc);
593592 auto found = newToOriginalFn.find (newinst);
594593 assert (found != newToOriginalFn.end ());
595- return cast<BasicBlock>(found->second );
594+ Value *res = found->second ;
595+ return cast<BasicBlock>(res);
596596}
597597
598598Value *GradientUtils::isOriginal (const Value *newinst) const {
@@ -4327,7 +4327,7 @@ GradientUtils *GradientUtils::CreateFromClone(
43274327 SmallPtrSet<Instruction *, 4 > constants;
43284328 SmallPtrSet<Instruction *, 20 > nonconstant;
43294329 SmallPtrSet<Value *, 2 > returnvals;
4330- ValueToValueMapTy originalToNew;
4330+ llvm::ValueMap< const llvm::Value *, AssertingReplacingVH> originalToNew;
43314331
43324332 SmallPtrSet<Value *, 4 > constant_values;
43334333 SmallPtrSet<Value *, 4 > nonconstant_values;
0 commit comments