48template <OpComparable Op> mlir::FailureOr<bool>
isLocationLess(
const Op &l,
const Op &r) {
49 mlir::Location lhsLoc = l->getLoc(), rhsLoc = r->getLoc();
51 if (llvm::isa<mlir::UnknownLoc>(lhsLoc) || llvm::isa<mlir::UnknownLoc>(rhsLoc)) {
52 return mlir::failure();
55 auto lhsFileLoc = llvm::dyn_cast<mlir::FileLineColLoc>(lhsLoc);
56 auto rhsFileLoc = llvm::dyn_cast<mlir::FileLineColLoc>(rhsLoc);
57 if (lhsFileLoc && rhsFileLoc) {
60 return mlir::failure();