Skip to content

Commit cf7b24e

Browse files
authored
Loose Type Analysis for Floating Point Add (rust-lang#828)
* Loose type analysis for float add
1 parent 5a6e056 commit cf7b24e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

enzyme/Enzyme/GradientUtils.h

+8
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,14 @@ class DiffeGradientUtils final : public GradientUtils {
21862186
assert(dif->getType() == old->getType());
21872187
Value *res = nullptr;
21882188
if (old->getType()->isIntOrIntVectorTy()) {
2189+
if (!addingType) {
2190+
if (looseTypeAnalysis) {
2191+
if (old->getType()->isIntegerTy(64))
2192+
addingType = Type::getDoubleTy(old->getContext());
2193+
else if (old->getType()->isIntegerTy(32))
2194+
addingType = Type::getFloatTy(old->getContext());
2195+
}
2196+
}
21892197
if (!addingType) {
21902198
llvm::errs() << "module: " << *oldFunc->getParent() << "\n";
21912199
llvm::errs() << "oldFunc: " << *oldFunc << "\n";

0 commit comments

Comments
 (0)