Skip to content

Commit 777c96e

Browse files
committed
Recompute of constant global variables
1 parent b3685b5 commit 777c96e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

enzyme/Enzyme/ActivityAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ bool ActivityAnalyzer::isConstantValue(TypeResults &TR, Value *Val) {
12061206
<< " potentiallyActiveLoad=" << potentiallyActiveLoad
12071207
<< " potentialStore=" << potentialStore << "\n";
12081208
if (potentiallyActiveLoad && potentialStore) {
1209-
activeLoadAndStore:;
1209+
activeLoadAndStore:;
12101210
insertAllFrom(TR, *Hypothesis, Val);
12111211
// TODO have insertall dependence on this
12121212
if (TmpOrig != Val)

enzyme/Enzyme/EnzymeLogic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,10 @@ struct CacheAnalysis {
191191
}
192192
} else if (isa<AllocaInst>(obj)) {
193193
// No change to modref if alloca
194-
} else if (isa<GlobalVariable>(obj)) {
194+
} else if (auto GV = dyn_cast<GlobalVariable>(obj)) {
195195
// In the absense of more fine-grained global info, assume object is
196196
// written to in a subseqent call unless this is "topLevel";
197-
if (!topLevel) {
197+
if (!topLevel && !GV->isConstant()) {
198198
mustcache = true;
199199
}
200200
} else if (auto sli = dyn_cast<LoadInst>(obj)) {

0 commit comments

Comments
 (0)