Skip to content

Commit c25ee3a

Browse files
committed
fixup
1 parent 5a4637b commit c25ee3a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

enzyme/Enzyme/TypeAnalysis/TypeAnalysis.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,6 +1211,24 @@ void TypeAnalyzer::updateAnalysis(Value *Val, TypeTree Data, Value *Origin) {
12111211
auto &DL = fntypeinfo.Function->getParent()->getDataLayout();
12121212
auto RegSize = (DL.getTypeSizeInBits(Val->getType()) + 7) / 8;
12131213
Data.CanonicalizeInPlace(RegSize, DL);
1214+
1215+
if (auto GV = dyn_cast<GlobalVariable>(Val)) {
1216+
if (!isa<StructType>(GV->getValueType()) ||
1217+
!cast<StructType>(GV->getValueType())->isOpaque()) {
1218+
auto allocSize = (DL.getTypeSizeInBits(GV->getValueType()) + 7) / 8;
1219+
if (EnzymePrintType) {
1220+
llvm::errs() << " pre global update input " << Data.str()
1221+
<< " for global of size " << allocSize << "\n";
1222+
}
1223+
Data = Data.Lookup(allocSize, DL)
1224+
.Only(-1, dyn_cast_or_null<Instruction>(Origin));
1225+
if (EnzymePrintType) {
1226+
llvm::errs() << " post global update input " << Data.str()
1227+
<< " for global of size " << allocSize << "\n";
1228+
}
1229+
}
1230+
}
1231+
12141232
bool Changed =
12151233
analysis[Val].checkedOrIn(Data, /*PointerIntSame*/ false, LegalOr);
12161234

0 commit comments

Comments
 (0)