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