Skip to content

Commit 5a8d3b3

Browse files
committed
review feedback
1 parent f7fef74 commit 5a8d3b3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2209,8 +2209,8 @@ class LowerMatrixIntrinsics {
22092209
/// Lower uniform shape intrinsics, if shape information is available.
22102210
bool VisitUniformIntrinsic(IntrinsicInst *Inst) {
22112211
auto I = ShapeMap.find(Inst);
2212-
if (I == ShapeMap.end())
2213-
return false;
2212+
assert(I != ShapeMap.end() &&
2213+
"must only visit instructions with shape info");
22142214

22152215
IRBuilder<> Builder(Inst);
22162216
ShapeInfo &Shape = I->second;
@@ -2220,22 +2220,22 @@ class LowerMatrixIntrinsics {
22202220
switch (Inst->getIntrinsicID()) {
22212221
case Intrinsic::abs:
22222222
case Intrinsic::fabs: {
2223-
Value *Op = Inst->getOperand(0);
2224-
2225-
MatrixTy M = getMatrix(Op, Shape, Builder);
2223+
MatrixTy M = getMatrix(Inst->getOperand(0), Shape, Builder);
22262224

22272225
Builder.setFastMathFlags(getFastMathFlags(Inst));
22282226

2229-
for (unsigned I = 0; I < Shape.getNumVectors(); ++I)
2227+
for (auto &Vector : M.vectors())
22302228
switch (Inst->getIntrinsicID()) {
22312229
case Intrinsic::abs:
2232-
Result.addVector(Builder.CreateBinaryIntrinsic(
2233-
Intrinsic::abs, M.getVector(I), Inst->getOperand(1)));
2230+
Result.addVector(Builder.CreateBinaryIntrinsic(Intrinsic::abs, Vector,
2231+
Inst->getOperand(1)));
22342232
break;
22352233
case Intrinsic::fabs:
2236-
Result.addVector(Builder.CreateUnaryIntrinsic(Inst->getIntrinsicID(),
2237-
M.getVector(I)));
2234+
Result.addVector(
2235+
Builder.CreateUnaryIntrinsic(Inst->getIntrinsicID(), Vector));
22382236
break;
2237+
default:
2238+
llvm_unreachable("unexpected intrinsic");
22392239
}
22402240

22412241
finalizeLowering(Inst,

0 commit comments

Comments
 (0)