diff --git a/enzyme/Enzyme/ActivityAnalysis.cpp b/enzyme/Enzyme/ActivityAnalysis.cpp index 24866ed2d763..58f0428132fa 100644 --- a/enzyme/Enzyme/ActivityAnalysis.cpp +++ b/enzyme/Enzyme/ActivityAnalysis.cpp @@ -1206,7 +1206,7 @@ bool ActivityAnalyzer::isConstantValue(TypeResults &TR, Value *Val) { << " potentiallyActiveLoad=" << potentiallyActiveLoad << " potentialStore=" << potentialStore << "\n"; if (potentiallyActiveLoad && potentialStore) { - activeLoadAndStore:; + activeLoadAndStore:; insertAllFrom(TR, *Hypothesis, Val); // TODO have insertall dependence on this if (TmpOrig != Val) diff --git a/enzyme/Enzyme/EnzymeLogic.cpp b/enzyme/Enzyme/EnzymeLogic.cpp index 6ba1164f0e0c..c8a7364a69bb 100644 --- a/enzyme/Enzyme/EnzymeLogic.cpp +++ b/enzyme/Enzyme/EnzymeLogic.cpp @@ -191,10 +191,10 @@ struct CacheAnalysis { } } else if (isa(obj)) { // No change to modref if alloca - } else if (isa(obj)) { + } else if (auto GV = dyn_cast(obj)) { // In the absense of more fine-grained global info, assume object is // written to in a subseqent call unless this is "topLevel"; - if (!topLevel) { + if (!topLevel && !GV->isConstant()) { mustcache = true; } } else if (auto sli = dyn_cast(obj)) {