Skip to content

Commit

Permalink
Add loose type fallback for adding type of cast (#1494)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Oct 20, 2023
1 parent bb00501 commit 4b8ca67
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion enzyme/Enzyme/AdjointGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -1306,10 +1306,28 @@ class AdjointGenerator
7) /
8;
Type *FT = TR.addingType(size, orig_op0);
if (!FT && looseTypeAnalysis) {
if (auto ET = I.getSrcTy()->getScalarType())
if (ET->isFPOrFPVectorTy()) {
FT = ET;
EmitWarning("CannotDeduceType", I,
"failed to deduce adding type of cast ", I,
" assumed ", FT, " from src");
}
}
if (!FT && looseTypeAnalysis) {
if (auto ET = I.getDestTy()->getScalarType())
if (ET->isFPOrFPVectorTy()) {
FT = ET;
EmitWarning("CannotDeduceType", I,
"failed to deduce adding type of cast ", I,
" assumed ", FT, " from dst");
}
}
if (!FT) {
std::string str;
raw_string_ostream ss(str);
ss << "Cannot deduce adding type of " << I;
ss << "Cannot deduce adding type (cast) of " << I;
if (CustomErrorHandler) {
CustomErrorHandler(ss.str().c_str(), wrap(&I), ErrorType::NoType,
&TR.analyzer, nullptr, wrap(&Builder2));
Expand Down

0 comments on commit 4b8ca67

Please sign in to comment.