From: wren romano <2998727+wrengr@users.noreply.github.com> Date: Fri, 24 Mar 2023 21:34:20 +0000 (-0700) Subject: [mlir][sparse] Updating TensorExp ctor to catch unknown TensorExp::Kind X-Git-Tag: upstream/17.0.6~13705 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0280681b6d2a13607af225242835d7ab02717993;p=platform%2Fupstream%2Fllvm.git [mlir][sparse] Updating TensorExp ctor to catch unknown TensorExp::Kind Depends On D146562 Reviewed By: aartbik Differential Revision: https://reviews.llvm.org/D146673 --- diff --git a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp index 9b39fd0..b3ff608 100644 --- a/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp +++ b/mlir/lib/Dialect/SparseTensor/Utils/Merger.cpp @@ -105,14 +105,14 @@ TensorExp::TensorExp(Kind k, unsigned x, ExprId y, Value v, Operation *o) case TensorExp::Kind::kTensor: assert(x != kInvalidId && y == kInvalidId && !v && !o); tensor = x; - break; + return; case TensorExp::Kind::kInvariant: assert(x == kInvalidId && y == kInvalidId && v && !o); - break; + return; case TensorExp::Kind::kLoopVar: assert(x != kInvalidId && y == kInvalidId && !v && !o); loop = x; - break; + return; // Unary operations. case TensorExp::Kind::kAbsF: case TensorExp::Kind::kAbsC: @@ -137,7 +137,7 @@ TensorExp::TensorExp(Kind k, unsigned x, ExprId y, Value v, Operation *o) assert(x != kInvalidId && y == kInvalidId && !v && !o); children.e0 = x; children.e1 = y; - break; + return; case TensorExp::Kind::kTruncF: case TensorExp::Kind::kExtF: case TensorExp::Kind::kCastFS: @@ -152,20 +152,20 @@ TensorExp::TensorExp(Kind k, unsigned x, ExprId y, Value v, Operation *o) assert(x != kInvalidId && y == kInvalidId && v && !o); children.e0 = x; children.e1 = y; - break; + return; case TensorExp::Kind::kBinaryBranch: case TensorExp::Kind::kSelect: assert(x != kInvalidId && y == kInvalidId && !v && o); children.e0 = x; children.e1 = y; - break; + return; case TensorExp::Kind::kUnary: // No assertion on y can be made, as the branching paths involve both // a unary (`mapSet`) and binary (`disjSet`) pathway. assert(x != kInvalidId && !v && o); children.e0 = x; children.e1 = y; - break; + return; // Binary operations. case TensorExp::Kind::kMulF: case TensorExp::Kind::kMulC: @@ -189,14 +189,15 @@ TensorExp::TensorExp(Kind k, unsigned x, ExprId y, Value v, Operation *o) assert(x != kInvalidId && y != kInvalidId && !v && !o); children.e0 = x; children.e1 = y; - break; + return; case TensorExp::Kind::kBinary: case TensorExp::Kind::kReduce: assert(x != kInvalidId && y != kInvalidId && !v && o); children.e0 = x; children.e1 = y; - break; + return; } + llvm_unreachable("unexpected kind"); } LatPoint::LatPoint(const BitVector &bits, ExprId e) : bits(bits), exp(e) {}