Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
flang/unittests/Optimizer/Builder/Runtime/RuntimeCallTestBase.h
Show First 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | static inline void checkCallOpFromResultBox(mlir::Value result, | ||||||||||||||||||||||||||||
const auto &u = result.user_begin(); | const auto &u = result.user_begin(); | ||||||||||||||||||||||||||||
if (mlir::isa<fir::CallOp>(*u)) | if (mlir::isa<fir::CallOp>(*u)) | ||||||||||||||||||||||||||||
return checkCallOp(*u, fctName, nbArgs, addLocArgs); | return checkCallOp(*u, fctName, nbArgs, addLocArgs); | ||||||||||||||||||||||||||||
auto convOp = mlir::dyn_cast<fir::ConvertOp>(*u); | auto convOp = mlir::dyn_cast<fir::ConvertOp>(*u); | ||||||||||||||||||||||||||||
EXPECT_NE(nullptr, convOp); | EXPECT_NE(nullptr, convOp); | ||||||||||||||||||||||||||||
checkCallOpFromResultBox(convOp.getResult(), fctName, nbArgs, addLocArgs); | checkCallOpFromResultBox(convOp.getResult(), fctName, nbArgs, addLocArgs); | ||||||||||||||||||||||||||||
} | } | ||||||||||||||||||||||||||||
/// Check the operations in \p block for a `fir::CallOp` operation where the | |||||||||||||||||||||||||||||
/// function being called shares its function name with \p fctName and the | |||||||||||||||||||||||||||||
/// number of arguments is equal to \p nbArgs. Note that this check only cares | |||||||||||||||||||||||||||||
/// if the operation exists, and not the order in when the operation is called. | |||||||||||||||||||||||||||||
awarzynski: Could you refine this a bit?
* "Check the operations in \p block for containing a `fir… | |||||||||||||||||||||||||||||
Is this comment better? josh.mottley.arm: Is this comment better? | |||||||||||||||||||||||||||||
/// This results in exiting the test as soon as the first correct instance of | |||||||||||||||||||||||||||||
/// `fir::CallOp` is found). | |||||||||||||||||||||||||||||
static inline void checkBlockForCallOp( | |||||||||||||||||||||||||||||
mlir::Block *block, llvm::StringRef fctName, unsigned nbArgs) { | |||||||||||||||||||||||||||||
assert(block && "mlir::Block given is a nullptr"); | |||||||||||||||||||||||||||||
for (auto &op : block->getOperations()) { | |||||||||||||||||||||||||||||
if (auto callOp = mlir::dyn_cast<fir::CallOp>(op)) { | |||||||||||||||||||||||||||||
if (fctName == callOp.callee()->getRootReference().getValue()) { | |||||||||||||||||||||||||||||
EXPECT_EQ(nbArgs, callOp.args().size()); | |||||||||||||||||||||||||||||
return; | |||||||||||||||||||||||||||||
} | |||||||||||||||||||||||||||||
} | |||||||||||||||||||||||||||||
} | |||||||||||||||||||||||||||||
FAIL() << "No calls to " << fctName << " were found!"; | |||||||||||||||||||||||||||||
} | |||||||||||||||||||||||||||||
A bit more context:
awarzynski: A bit more context:
* ` EXPECT_TRUE(block);` --> I would move this to where the block is… | |||||||||||||||||||||||||||||
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RUNTIMECALLTESTBASE_H | #endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RUNTIMECALLTESTBASE_H |
Could you refine this a bit?