Skip to content

Commit eb83c43

Browse files
authored
[Matrix] Don't update Changed based on Visit* return value (NFC). (#142417)
Visit* are always modifying the IR, remove the boolean result. Depends on #142416. PR: #142417
1 parent f7a3a5c commit eb83c43

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

llvm/lib/Transforms/Scalar/LowerMatrixIntrinsics.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,13 +1062,16 @@ class LowerMatrixIntrinsics {
10621062
Value *Op1;
10631063
Value *Op2;
10641064
if (auto *BinOp = dyn_cast<BinaryOperator>(Inst))
1065-
Changed |= VisitBinaryOperator(BinOp);
1066-
if (auto *UnOp = dyn_cast<UnaryOperator>(Inst))
1067-
Changed |= VisitUnaryOperator(UnOp);
1068-
if (match(Inst, m_Load(m_Value(Op1))))
1069-
Changed |= VisitLoad(cast<LoadInst>(Inst), Op1, Builder);
1065+
VisitBinaryOperator(BinOp);
1066+
else if (auto *UnOp = dyn_cast<UnaryOperator>(Inst))
1067+
VisitUnaryOperator(UnOp);
1068+
else if (match(Inst, m_Load(m_Value(Op1))))
1069+
VisitLoad(cast<LoadInst>(Inst), Op1, Builder);
10701070
else if (match(Inst, m_Store(m_Value(Op1), m_Value(Op2))))
1071-
Changed |= VisitStore(cast<StoreInst>(Inst), Op1, Op2, Builder);
1071+
VisitStore(cast<StoreInst>(Inst), Op1, Op2, Builder);
1072+
else
1073+
continue;
1074+
Changed = true;
10721075
}
10731076

10741077
if (ORE) {
@@ -2105,29 +2108,27 @@ class LowerMatrixIntrinsics {
21052108
}
21062109

21072110
/// Lower load instructions, if shape information is available.
2108-
bool VisitLoad(LoadInst *Inst, Value *Ptr, IRBuilder<> &Builder) {
2111+
void VisitLoad(LoadInst *Inst, Value *Ptr, IRBuilder<> &Builder) {
21092112
auto I = ShapeMap.find(Inst);
21102113
assert(I != ShapeMap.end() &&
21112114
"must only visit instructions with shape info");
21122115
LowerLoad(Inst, Ptr, Inst->getAlign(),
21132116
Builder.getInt64(I->second.getStride()), Inst->isVolatile(),
21142117
I->second);
2115-
return true;
21162118
}
21172119

2118-
bool VisitStore(StoreInst *Inst, Value *StoredVal, Value *Ptr,
2120+
void VisitStore(StoreInst *Inst, Value *StoredVal, Value *Ptr,
21192121
IRBuilder<> &Builder) {
21202122
auto I = ShapeMap.find(Inst);
21212123
assert(I != ShapeMap.end() &&
21222124
"must only visit instructions with shape info");
21232125
LowerStore(Inst, StoredVal, Ptr, Inst->getAlign(),
21242126
Builder.getInt64(I->second.getStride()), Inst->isVolatile(),
21252127
I->second);
2126-
return true;
21272128
}
21282129

21292130
/// Lower binary operators, if shape information is available.
2130-
bool VisitBinaryOperator(BinaryOperator *Inst) {
2131+
void VisitBinaryOperator(BinaryOperator *Inst) {
21312132
auto I = ShapeMap.find(Inst);
21322133
assert(I != ShapeMap.end() &&
21332134
"must only visit instructions with shape info");
@@ -2155,11 +2156,10 @@ class LowerMatrixIntrinsics {
21552156
Result.addNumComputeOps(getNumOps(Result.getVectorTy()) *
21562157
Result.getNumVectors()),
21572158
Builder);
2158-
return true;
21592159
}
21602160

21612161
/// Lower unary operators, if shape information is available.
2162-
bool VisitUnaryOperator(UnaryOperator *Inst) {
2162+
void VisitUnaryOperator(UnaryOperator *Inst) {
21632163
auto I = ShapeMap.find(Inst);
21642164
assert(I != ShapeMap.end() &&
21652165
"must only visit instructions with shape info");
@@ -2191,7 +2191,6 @@ class LowerMatrixIntrinsics {
21912191
Result.addNumComputeOps(getNumOps(Result.getVectorTy()) *
21922192
Result.getNumVectors()),
21932193
Builder);
2194-
return true;
21952194
}
21962195

21972196
/// Helper to linearize a matrix expression tree into a string. Currently

0 commit comments

Comments
 (0)