diff --git a/enzyme/Enzyme/FunctionUtils.cpp b/enzyme/Enzyme/FunctionUtils.cpp index 703e0d833a7..15430184ef2 100644 --- a/enzyme/Enzyme/FunctionUtils.cpp +++ b/enzyme/Enzyme/FunctionUtils.cpp @@ -1047,6 +1047,7 @@ static void SimplifyMPIQueries(Function &NewF, FunctionAnalysisManager &FAM) { B.SetInsertPoint(res); if (auto PT = dyn_cast(storePointer->getType())) { + (void *)PT; #if LLVM_VERSION_MAJOR < 17 #if LLVM_VERSION_MAJOR >= 15 if (PT->getContext().supportsTypedPointers()) { @@ -4659,7 +4660,8 @@ std::optional fixSparse_inner(Instruction *cur, llvm::Function &F, legal = false; auto L = LI.getLoopFor(PN->getParent()); if (legal && L && L->getLoopPreheader() && - L->getCanonicalInductionVariable()) { + L->getCanonicalInductionVariable() && + L->getHeader() == PN->getParent()) { auto ph_idx = PN->getBasicBlockIndex(L->getLoopPreheader()); if (isa(PN->getIncomingValue(ph_idx))) { lhsOps[ph_idx] =