Skip to content

Commit

Permalink
fix(compiler): Fixing warnings spotted by gcc-13
Browse files Browse the repository at this point in the history
  • Loading branch information
BourgerieQuentin committed Oct 23, 2024
1 parent 07dec48 commit b2df0d4
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,12 +624,13 @@ getSqMANP(mlir::tensor::ExpandShapeOp op,
static std::optional<llvm::APInt>
getSqMANP(mlir::concretelang::FHELinalg::SumOp op,
llvm::ArrayRef<const MANPLattice *> operandMANPs) {
llvm::APInt result = llvm::APInt(1, 1, false);

auto inputType = op.getOperand().getType().dyn_cast<mlir::TensorType>();

uint64_t numberOfElementsInTheInput = inputType.getNumElements();
if (numberOfElementsInTheInput == 0) {
return llvm::APInt{1, 1, false};
return result;
}

uint64_t numberOfElementsAddedTogetherInEachOutputCell = 1;
Expand Down Expand Up @@ -659,9 +660,8 @@ getSqMANP(mlir::concretelang::FHELinalg::SumOp op,
"Missing squared Minimal Arithmetic Noise Padding for encrypted "
"operands");

llvm::APInt operandMANP = operandMANPs[0]->getValue().getMANP().value();

return APIntWidthExtendUMul(noiseMultiplier, operandMANP);
result = operandMANPs[0]->getValue().getMANP().value();
return APIntWidthExtendUMul(noiseMultiplier, result);
}

static std::optional<llvm::APInt>
Expand Down Expand Up @@ -755,10 +755,11 @@ class MANPAnalysis
debug(debug) {}

void setToEntryState(MANPLattice *lattice) override {
auto baseMANP = llvm::APInt(1, 1);
if (isEncryptedFunctionParameter(lattice->getPoint())) {
// Set minimal MANP for encrypted function arguments
propagateIfChanged(lattice, lattice->join(MANPLatticeValue{
std::optional{llvm::APInt(1, 1)}}));
propagateIfChanged(
lattice, lattice->join(MANPLatticeValue{std::optional{baseMANP}}));
}
// In case of block arguments used in the block of a linalg.genric
// operation: map the MANP values of the operands into the block arguments
Expand All @@ -781,8 +782,8 @@ class MANPAnalysis
operandRange = genericOp.getOutputs();
}
auto v = operandRange[argIndex];
auto manp = this->getLatticeElement(v)->getValue().getMANP().value_or(
llvm::APInt(1, 1));
auto manp =
this->getLatticeElement(v)->getValue().getMANP().value_or(baseMANP);
propagateIfChanged(lattice, lattice->join(MANPLatticeValue{manp}));
}
} else {
Expand Down

0 comments on commit b2df0d4

Please sign in to comment.