From 02660b07f3367bf8b9457426939094366f9f58b9 Mon Sep 17 00:00:00 2001 From: Billy Moses Date: Tue, 31 Dec 2024 18:06:41 -0500 Subject: [PATCH] Improve cast ft error --- enzyme/Enzyme/AdjointGenerator.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/enzyme/Enzyme/AdjointGenerator.h b/enzyme/Enzyme/AdjointGenerator.h index 96b8494302e..08ada7c44a8 100644 --- a/enzyme/Enzyme/AdjointGenerator.h +++ b/enzyme/Enzyme/AdjointGenerator.h @@ -1380,7 +1380,8 @@ class AdjointGenerator : public llvm::InstVisitor { ss << "Cannot deduce adding type (cast) of " << I; EmitNoTypeError(str, I, gutils, Builder2); } - assert(FT); + + if (FT) { auto rule = [&](Value *dif) { if (I.getOpcode() == CastInst::CastOps::FPTrunc || @@ -1404,7 +1405,8 @@ class AdjointGenerator : public llvm::InstVisitor { Value *dif = diffe(&I, Builder2); Value *diff = applyChainRule(op0->getType(), Builder2, rule, dif); - addToDiffe(orig_op0, diff, Builder2, FT); + addToDiffe(orig_op0, diff, Builder2, FT); + } } Type *diffTy = gutils->getShadowType(I.getType());