[llvm] 8daf23d - [Scalar] Use llvm::make_early_inc_range (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 5 23:53:28 PDT 2022
Author: Kazu Hirata
Date: 2022-06-05T23:53:18-07:00
New Revision: 8daf23d364009f8699298c1c60800ebd7ba0cf6e
URL: https://github.com/llvm/llvm-project/commit/8daf23d364009f8699298c1c60800ebd7ba0cf6e
DIFF: https://github.com/llvm/llvm-project/commit/8daf23d364009f8699298c1c60800ebd7ba0cf6e.diff
LOG: [Scalar] Use llvm::make_early_inc_range (NFC)
Added:
Modified:
llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
index 3128c0f8418b5..d67a314906134 100644
--- a/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp
@@ -766,28 +766,25 @@ class LowerMatrixIntrinsics {
// If we have a TT matmul, lift the transpose. We may be able to fold into
// consuming multiply.
for (BasicBlock &BB : Func) {
- for (BasicBlock::iterator II = BB.begin(); II != BB.end();) {
- Instruction *I = &*II;
- // We may remove I.
- ++II;
+ for (Instruction &I : llvm::make_early_inc_range(BB)) {
Value *A, *B, *AT, *BT;
ConstantInt *R, *K, *C;
// A^t * B ^t -> (B * A)^t
- if (match(&*I, m_Intrinsic<Intrinsic::matrix_multiply>(
- m_Value(A), m_Value(B), m_ConstantInt(R),
- m_ConstantInt(K), m_ConstantInt(C))) &&
+ if (match(&I, m_Intrinsic<Intrinsic::matrix_multiply>(
+ m_Value(A), m_Value(B), m_ConstantInt(R),
+ m_ConstantInt(K), m_ConstantInt(C))) &&
match(A, m_Intrinsic<Intrinsic::matrix_transpose>(m_Value(AT))) &&
match(B, m_Intrinsic<Intrinsic::matrix_transpose>(m_Value((BT))))) {
- IRBuilder<> IB(&*I);
+ IRBuilder<> IB(&I);
MatrixBuilder Builder(IB);
Value *M = Builder.CreateMatrixMultiply(
BT, AT, C->getZExtValue(), K->getZExtValue(), R->getZExtValue());
setShapeInfo(M, {C, R});
Instruction *NewInst = Builder.CreateMatrixTranspose(
M, C->getZExtValue(), R->getZExtValue());
- ReplaceAllUsesWith(*I, NewInst);
- if (I->use_empty())
- I->eraseFromParent();
+ ReplaceAllUsesWith(I, NewInst);
+ if (I.use_empty())
+ I.eraseFromParent();
if (A->use_empty())
cast<Instruction>(A)->eraseFromParent();
if (A != B && B->use_empty())
More information about the llvm-commits
mailing list