Skip to content

Commit

Permalink
Fix integration tests on main
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Feb 5, 2024
1 parent 9ff56bc commit d70efae
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3353,6 +3353,25 @@ class AdjointGenerator
}
}
}
if (size == 1 && !isa<ConstantInt>(new_size)) {
for (auto ptr : {orig_dst, orig_src}) {
vd = TR.query(ptr).Data0().ShiftIndices(DL, 0, -1, 0);
if (vd.isKnownPastPointer()) {
ConcreteType mv(BaseType::Unknown);
size_t minInt = 0xFFFFFFFF;
for (const auto &pair : vd.getMapping()) {
if (pair.first.size() != 1)
continue;
if (minInt < pair.first[0])
continue;
minInt = pair.first[0];
mv = pair.second;
}
vd.insert({(int)minInt}, mv);
goto known;
}
}
}
if (errorIfNoType)
EmitWarning("CannotDeduceType", MTI, "failed to deduce type of copy ",
MTI);
Expand All @@ -3368,6 +3387,7 @@ class AdjointGenerator
&TR.analyzer, nullptr, wrap(&BuilderZ));
} else {
ss << "\n";
ss << *gutils->oldFunc << "\n";
TR.dump(ss);
EmitFailure("CannotDeduceType", MTI.getDebugLoc(), &MTI, ss.str());
}
Expand Down
2 changes: 1 addition & 1 deletion enzyme/test/Integration/ReverseMode/forrealloc.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clang -std=c11 -O0 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -S | %lli -
// RUN: %clang -std=c11 -O1 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -S | %lli -
// RUN: %clang -std=c11 -O2 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -S | %lli -
// RUN: %clang -std=c11 -O2 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -S -enzyme-loose-types | %lli -
// RUN: %clang -std=c11 -O3 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -S | %lli -
// RUN: %clang -std=c11 -O0 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -enzyme-inline=1 -S | %lli -
// RUN: %clang -std=c11 -O1 %s -S -emit-llvm -o - | %opt - %OPloadEnzyme %enzyme -enzyme-inline=1 -S | %lli -
Expand Down

0 comments on commit d70efae

Please sign in to comment.