@@ -44,7 +44,7 @@ struct LoweringPreparePass : public LoweringPrepareBase<LoweringPreparePass> {
4444 clang::ASTContext *astCtx;
4545
4646 // / Tracks current module.
47- mlir::ModuleOp theModule ;
47+ mlir::ModuleOp mlirModule ;
4848
4949 void setASTContext (clang::ASTContext *c) { astCtx = c; }
5050};
@@ -55,7 +55,7 @@ cir::FuncOp LoweringPreparePass::buildRuntimeFunction(
5555 mlir::OpBuilder &builder, llvm::StringRef name, mlir::Location loc,
5656 cir::FuncType type, cir::GlobalLinkageKind linkage) {
5757 cir::FuncOp f = dyn_cast_or_null<FuncOp>(SymbolTable::lookupNearestSymbolFrom (
58- theModule , StringAttr::get (theModule ->getContext (), name)));
58+ mlirModule , StringAttr::get (mlirModule ->getContext (), name)));
5959 if (!f) {
6060 f = builder.create <cir::FuncOp>(loc, name, type);
6161 f.setLinkageAttr (
@@ -167,10 +167,12 @@ static mlir::Value buildComplexBinOpLibCall(
167167
168168 cir::FuncType libFuncTy = cir::FuncType::get (libFuncInputTypes, ty);
169169
170+ // Inserting a declaration for the runtime function to be used in Complex
171+ // multiplication and division when needed
170172 cir::FuncOp libFunc;
171173 {
172174 mlir::OpBuilder::InsertionGuard ipGuard{builder};
173- builder.setInsertionPointToStart (pass.theModule .getBody ());
175+ builder.setInsertionPointToStart (pass.mlirModule .getBody ());
174176 libFunc = pass.buildRuntimeFunction (builder, libFuncName, loc, libFuncTy);
175177 }
176178
@@ -228,6 +230,8 @@ static mlir::Value lowerComplexMul(LoweringPreparePass &pass,
228230 rangeKind == cir::ComplexRangeKind::Promoted)
229231 return algebraicResult;
230232
233+ assert (!cir::MissingFeatures::fastMathFlags ());
234+
231235 // Check whether the real part and the imaginary part of the result are both
232236 // NaN. If so, emit a library call to compute the multiplication instead.
233237 // We check a value against NaN by comparing the value against itself.
@@ -416,9 +420,8 @@ void LoweringPreparePass::runOnOp(mlir::Operation *op) {
416420
417421void LoweringPreparePass::runOnOperation () {
418422 mlir::Operation *op = getOperation ();
419- if (isa<::mlir::ModuleOp>(op)) {
420- theModule = cast<::mlir::ModuleOp>(op);
421- }
423+ if (isa<::mlir::ModuleOp>(op))
424+ mlirModule = cast<::mlir::ModuleOp>(op);
422425
423426 llvm::SmallVector<mlir::Operation *> opsToTransform;
424427
0 commit comments