fix
diff --git a/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp b/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp index 961ea43..4a39e3f 100644 --- a/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp +++ b/enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp
@@ -1033,34 +1033,36 @@ assert(Origin); if (auto OI = dyn_cast<Instruction>(Origin)) { if (OI->getParent() != I->getParent()) { - if (!EnzymeStrictAliasing) { - if (!PDT.dominates(OI->getParent(), I->getParent())) { - bool allocationWithAllUsersInBlock = false; - if (auto AI = dyn_cast<AllocaInst>(I)) { - allocationWithAllUsersInBlock = true; - for (auto U : AI->users()) { - auto P = cast<Instruction>(U)->getParent(); - if (P == OI->getParent()) - continue; - if (PDT.dominates(OI->getParent(), P)) - continue; - allocationWithAllUsersInBlock = false; - break; + if (!EnzymeStrictAliasing) { + if (!PDT.dominates(OI->getParent(), I->getParent())) { + bool allocationWithAllUsersInBlock = false; + if (auto AI = dyn_cast<AllocaInst>(I)) { + allocationWithAllUsersInBlock = true; + for (auto U : AI->users()) { + auto P = cast<Instruction>(U)->getParent(); + if (P == OI->getParent()) + continue; + if (PDT.dominates(OI->getParent(), P)) + continue; + allocationWithAllUsersInBlock = false; + break; + } + } + if (!allocationWithAllUsersInBlock) { + if (EnzymePrintType) { + llvm::errs() << " skipping update into "; + I->print(llvm::errs(), *MST); + llvm::errs() << " of " << Data.str() << " from "; + OI->print(llvm::errs(), *MST); + llvm::errs() << "\n"; + } + return; } } - if (!allocationWithAllUsersInBlock) { - if (EnzymePrintType) { - llvm::errs() << " skipping update into "; - I->print(llvm::errs(), *MST); - llvm::errs() << " of " << Data.str() << " from "; - OI->print(llvm::errs(), *MST); - llvm::errs() << "\n"; - } - return; - } - } - } else { - if (OI->getParent()->hasNPredecessors(1) && hasMetadata(OI->getParent()->getTerminator(), "enzyme_notypeprop")) { + } else { + if (OI->getParent()->hasNPredecessors(1) && + hasMetadata(OI->getParent()->getTerminator(), + "enzyme_notypeprop")) { if (EnzymePrintType) { llvm::errs() << " skipping update into "; I->print(llvm::errs(), *MST); @@ -1072,25 +1074,27 @@ } } } - } + } } else if (auto Arg = dyn_cast<Argument>(Val)) { assert(fntypeinfo.Function == Arg->getParent()); if (auto OI = dyn_cast<Instruction>(Origin)) { auto I = &*fntypeinfo.Function->getEntryBlock().begin(); if (OI->getParent() != I->getParent()) { - if (!EnzymeStrictAliasing) { - if (!PDT.dominates(OI->getParent(), I->getParent())) { - if (EnzymePrintType) { - llvm::errs() << " skipping update into "; - Arg->print(llvm::errs(), *MST); - llvm::errs() << " of " << Data.str() << " from "; - OI->print(llvm::errs(), *MST); - llvm::errs() << "\n"; + if (!EnzymeStrictAliasing) { + if (!PDT.dominates(OI->getParent(), I->getParent())) { + if (EnzymePrintType) { + llvm::errs() << " skipping update into "; + Arg->print(llvm::errs(), *MST); + llvm::errs() << " of " << Data.str() << " from "; + OI->print(llvm::errs(), *MST); + llvm::errs() << "\n"; + } + return; } - return; - } - } else { - if (OI->getParent()->hasNPredecessors(1) && hasMetadata(OI->getParent()->getTerminator(), "enzyme_notypeprop")) { + } else { + if (OI->getParent()->hasNPredecessors(1) && + hasMetadata(OI->getParent()->getTerminator(), + "enzyme_notypeprop")) { if (EnzymePrintType) { llvm::errs() << " skipping update into "; I->print(llvm::errs(), *MST); @@ -1100,7 +1104,7 @@ } return; } - } + } } } }