From cd2136502e29660ab4b51d686d0a28a134edf4e9 Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Sun, 29 Sep 2024 00:08:13 -0400 Subject: [PATCH] Fix subnull --- enzyme/Enzyme/GradientUtils.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/enzyme/Enzyme/GradientUtils.cpp b/enzyme/Enzyme/GradientUtils.cpp index 7f8cb482e4a..b61d93bffcf 100644 --- a/enzyme/Enzyme/GradientUtils.cpp +++ b/enzyme/Enzyme/GradientUtils.cpp @@ -5743,10 +5743,12 @@ Value *GradientUtils::invertPointerM(Value *const oval, IRBuilder<> &BuilderM, Value *ivops[2] = {nullptr, nullptr}; for (int i = 0; i < 2; i++) { auto op = arg->getOperand(i); + bool subnull = nullShadow; if (!runtimeActivity && !isa(op)) { - + auto vd = TR.query(op); + if (!TR.anyFloat(op)) + subnull = false; if (isConstantValue(op)) { - auto vd = TR.query(op); if (TR.anyPointer(op) && vd[{-1, -1}] != BaseType::Integer) { if (!isa(op) && !isa(op)) { std::string str; @@ -5764,7 +5766,7 @@ Value *GradientUtils::invertPointerM(Value *const oval, IRBuilder<> &BuilderM, } } if (!ivops[i]) { - ivops[i] = invertPointerM(op, bb, nullShadow); + ivops[i] = invertPointerM(op, bb, subnull); } }