Skip to content

Commit 506431a

Browse files
committed
VisitCallInst can't fail either
1 parent 4499f9c commit 506431a

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,15 +1058,14 @@ class LowerMatrixIntrinsics {
10581058

10591059
const ShapeInfo &SI = ShapeMap.at(Inst);
10601060

1061-
if (CallInst *CInst = dyn_cast<CallInst>(Inst))
1062-
Changed |= tryVisitCallInst(CInst);
1063-
10641061
Value *Op1;
10651062
Value *Op2;
10661063
if (auto *BinOp = dyn_cast<BinaryOperator>(Inst))
10671064
VisitBinaryOperator(BinOp, SI);
10681065
else if (auto *UnOp = dyn_cast<UnaryOperator>(Inst))
10691066
VisitUnaryOperator(UnOp, SI);
1067+
else if (CallInst *CInst = dyn_cast<CallInst>(Inst))
1068+
VisitCallInst(CInst);
10701069
else if (match(Inst, m_Load(m_Value(Op1))))
10711070
VisitLoad(cast<LoadInst>(Inst), SI, Op1, Builder);
10721071
else if (match(Inst, m_Store(m_Value(Op1), m_Value(Op2))))
@@ -1111,10 +1110,9 @@ class LowerMatrixIntrinsics {
11111110
return Changed;
11121111
}
11131112

1114-
/// Replace intrinsic calls
1115-
bool tryVisitCallInst(CallInst *Inst) {
1116-
if (!Inst->getCalledFunction() || !Inst->getCalledFunction()->isIntrinsic())
1117-
return false;
1113+
/// Replace intrinsic calls.
1114+
void VisitCallInst(CallInst *Inst) {
1115+
assert(Inst->getCalledFunction() && Inst->getCalledFunction()->isIntrinsic());
11181116

11191117
switch (Inst->getCalledFunction()->getIntrinsicID()) {
11201118
case Intrinsic::matrix_multiply:
@@ -1130,9 +1128,8 @@ class LowerMatrixIntrinsics {
11301128
LowerColumnMajorStore(Inst);
11311129
break;
11321130
default:
1133-
return false;
1131+
llvm_unreachable("only intrinsics supporting shape info should be seen here");
11341132
}
1135-
return true;
11361133
}
11371134

11381135
/// Compute the alignment for a column/row \p Idx with \p Stride between them.

0 commit comments

Comments
 (0)