Skip to content

Commit 6693f56

Browse files
committed
clean up condition lookup
1 parent 5a4a6a5 commit 6693f56

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2211,19 +2211,20 @@ class LowerMatrixIntrinsics {
22112211
MatrixTy A = getMatrix(OpA, Shape, Builder);
22122212
MatrixTy B = getMatrix(OpB, Shape, Builder);
22132213

2214+
Value *CondV[2];
22142215
if (isa<FixedVectorType>(Cond->getType())) {
22152216
MatrixTy C = getMatrix(Cond, Shape, Builder);
2216-
for (unsigned I = 0; I < Shape.getNumVectors(); ++I) {
2217-
auto *Sel = Builder.CreateSelect(C.getVector(I), A.getVector(I), B.getVector(I));
2218-
Result.addVector(Sel);
2219-
}
2217+
CondV[0] = C.getVector(0);
2218+
CondV[1] = C.getVector(1);
22202219
} else {
2221-
for (unsigned I = 0; I < Shape.getNumVectors(); ++I) {
2222-
auto *Sel = Builder.CreateSelect(Cond, A.getVector(I), B.getVector(I));
2223-
Result.addVector(Sel);
2224-
}
2220+
CondV[0] = Cond;
2221+
CondV[1] = Cond;
22252222
}
22262223

2224+
for (unsigned I = 0, E = Shape.getNumVectors(); I != E; ++I)
2225+
Result.addVector(
2226+
Builder.CreateSelect(CondV[I], A.getVector(I), B.getVector(I)));
2227+
22272228
finalizeLowering(Inst,
22282229
Result.addNumComputeOps(getNumOps(Result.getVectorTy()) *
22292230
Result.getNumVectors()),

0 commit comments

Comments
 (0)