@@ -115,22 +115,22 @@ static bool isValidElementType(Type *Ty) {
115
115
!Ty->isPPC_FP128Ty ();
116
116
}
117
117
118
- // / \returns the parent basic block if all of the instructions in \p VL
119
- // / are in the same block or null otherwise.
120
- static BasicBlock * getSameBlock (ArrayRef<Value *> VL) {
118
+ // / \returns true if all of the instructions in \p VL are in the same block or
119
+ // / false otherwise.
120
+ static bool allSameBlock (ArrayRef<Value *> VL) {
121
121
Instruction *I0 = dyn_cast<Instruction>(VL[0 ]);
122
122
if (!I0)
123
- return nullptr ;
123
+ return false ;
124
124
BasicBlock *BB = I0->getParent ();
125
125
for (int i = 1 , e = VL.size (); i < e; i++) {
126
126
Instruction *I = dyn_cast<Instruction>(VL[i]);
127
127
if (!I)
128
- return nullptr ;
128
+ return false ;
129
129
130
130
if (BB != I->getParent ())
131
- return nullptr ;
131
+ return false ;
132
132
}
133
- return BB ;
133
+ return true ;
134
134
}
135
135
136
136
// / \returns True if all of the values in \p VL are constants.
@@ -224,15 +224,15 @@ static void propagateIRFlags(Value *I, ArrayRef<Value *> VL) {
224
224
}
225
225
}
226
226
227
- // / \returns The type that all of the values in \p VL have or null if there
228
- // / are different types .
229
- static Type* getSameType (ArrayRef<Value *> VL) {
227
+ // / \returns true if all of the values in \p VL have the same type or false
228
+ // / otherwise .
229
+ static bool allSameType (ArrayRef<Value *> VL) {
230
230
Type *Ty = VL[0 ]->getType ();
231
231
for (int i = 1 , e = VL.size (); i < e; i++)
232
232
if (VL[i]->getType () != Ty)
233
- return nullptr ;
233
+ return false ;
234
234
235
- return Ty ;
235
+ return true ;
236
236
}
237
237
238
238
// / \returns True if Extract{Value,Element} instruction extracts element Idx.
@@ -921,7 +921,7 @@ void BoUpSLP::buildTree(ArrayRef<Value *> Roots,
921
921
ArrayRef<Value *> UserIgnoreLst) {
922
922
deleteTree ();
923
923
UserIgnoreList = UserIgnoreLst;
924
- if (!getSameType (Roots))
924
+ if (!allSameType (Roots))
925
925
return ;
926
926
buildTree_rec (Roots, 0 );
927
927
@@ -975,9 +975,8 @@ void BoUpSLP::buildTree(ArrayRef<Value *> Roots,
975
975
976
976
977
977
void BoUpSLP::buildTree_rec (ArrayRef<Value *> VL, unsigned Depth) {
978
- bool SameTy = allConstant (VL) || getSameType (VL); (void )SameTy;
979
978
bool isAltShuffle = false ;
980
- assert (SameTy && " Invalid types!" );
979
+ assert (( allConstant (VL) || allSameType (VL)) && " Invalid types!" );
981
980
982
981
if (Depth == RecursionMaxDepth) {
983
982
DEBUG (dbgs () << " SLP: Gathering due to max recursion depth.\n " );
@@ -1010,7 +1009,7 @@ void BoUpSLP::buildTree_rec(ArrayRef<Value *> VL, unsigned Depth) {
1010
1009
}
1011
1010
1012
1011
// If all of the operands are identical or constant we have a simple solution.
1013
- if (allConstant (VL) || isSplat (VL) || !getSameBlock (VL) || !Opcode) {
1012
+ if (allConstant (VL) || isSplat (VL) || !allSameBlock (VL) || !Opcode) {
1014
1013
DEBUG (dbgs () << " SLP: Gathering due to C,S,B,O. \n " );
1015
1014
newTreeEntry (VL, false );
1016
1015
return ;
@@ -1585,7 +1584,7 @@ int BoUpSLP::getEntryCost(TreeEntry *E) {
1585
1584
return getGatherCost (E->Scalars );
1586
1585
}
1587
1586
unsigned Opcode = getSameOpcode (VL);
1588
- assert (Opcode && getSameType (VL) && getSameBlock (VL) && " Invalid VL" );
1587
+ assert (Opcode && allSameType (VL) && allSameBlock (VL) && " Invalid VL" );
1589
1588
Instruction *VL0 = cast<Instruction>(VL[0 ]);
1590
1589
switch (Opcode) {
1591
1590
case Instruction::PHI: {
0 commit comments