Skip to content

Commit

Permalink
Ensure we call genProduceReg for the embedded mask node (#103024)
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding authored Jun 4, 2024
1 parent 909db28 commit c1d6262
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/coreclr/jit/hwintrinsiccodegenxarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
CORINFO_InstructionSet isa = HWIntrinsicInfo::lookupIsa(intrinsicId);
HWIntrinsicCategory category = HWIntrinsicInfo::lookupCategory(intrinsicId);
size_t numArgs = node->GetOperandCount();
GenTree* embMaskNode = nullptr;
GenTree* embMaskOp = nullptr;

// We need to validate that other phases of the compiler haven't introduced unsupported intrinsics
Expand Down Expand Up @@ -233,6 +234,9 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
op2->ClearContained();
op2->SetRegNum(targetReg);

// Track the original mask node so we can call genProduceReg
embMaskNode = node;

// Fixup all the already initialized variables
node = op2->AsHWIntrinsic();
intrinsicId = node->GetHWIntrinsicId();
Expand Down Expand Up @@ -696,13 +700,27 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node)
// Handle an extra operand we need to consume so that
// embedded masking can work without making the overall
// logic significantly more complex.

assert(embMaskNode != nullptr);
genConsumeReg(embMaskOp);
}

genProduceReg(node);

if (embMaskNode != nullptr)
{
// Similarly to the mask operand, we need to handle the
// mask node to ensure everything works correctly, particularly
// lifetimes and spilling if required. Doing it this way avoids
// needing to duplicate all our existing handling.

assert(embMaskOp != nullptr);
genProduceReg(embMaskNode);
}
return;
}

assert(embMaskNode == nullptr);
assert(embMaskOp == nullptr);

switch (isa)
Expand Down

0 comments on commit c1d6262

Please sign in to comment.