Skip to content

Commit

Permalink
Fix subnull
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Sep 29, 2024
1 parent 680d8bc commit cd21365
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<InsertValueInst>(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<UndefValue>(op) && !isa<ConstantPointerNull>(op)) {
std::string str;
Expand All @@ -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);
}
}

Expand Down

0 comments on commit cd21365

Please sign in to comment.