@@ -1248,9 +1248,13 @@ class ICmpInst: public CmpInst {
1248
1248
return isEquality (getPredicate ());
1249
1249
}
1250
1250
1251
+ // / @returns true if the predicate is commutative
1252
+ // / Determine if this relation is commutative.
1253
+ static bool isCommutative (Predicate P) { return isEquality (P); }
1254
+
1251
1255
// / @returns true if the predicate of this ICmpInst is commutative
1252
1256
// / Determine if this relation is commutative.
1253
- bool isCommutative () const { return isEquality ( ); }
1257
+ bool isCommutative () const { return isCommutative ( getPredicate () ); }
1254
1258
1255
1259
// / Return true if the predicate is relational (not EQ or NE).
1256
1260
// /
@@ -1369,7 +1373,7 @@ class FCmpInst: public CmpInst {
1369
1373
AssertOK ();
1370
1374
}
1371
1375
1372
- // / @returns true if the predicate of this instruction is EQ or NE.
1376
+ // / @returns true if the predicate is EQ or NE.
1373
1377
// / Determine if this is an equality predicate.
1374
1378
static bool isEquality (Predicate Pred) {
1375
1379
return Pred == FCMP_OEQ || Pred == FCMP_ONE || Pred == FCMP_UEQ ||
@@ -1380,16 +1384,17 @@ class FCmpInst: public CmpInst {
1380
1384
// / Determine if this is an equality predicate.
1381
1385
bool isEquality () const { return isEquality (getPredicate ()); }
1382
1386
1383
- // / @returns true if the predicate of this instruction is commutative.
1387
+ // / @returns true if the predicate is commutative.
1384
1388
// / Determine if this is a commutative predicate.
1385
- bool isCommutative () const {
1386
- return isEquality () ||
1387
- getPredicate () == FCMP_FALSE ||
1388
- getPredicate () == FCMP_TRUE ||
1389
- getPredicate () == FCMP_ORD ||
1390
- getPredicate () == FCMP_UNO;
1389
+ static bool isCommutative (Predicate Pred) {
1390
+ return isEquality (Pred) || Pred == FCMP_FALSE || Pred == FCMP_TRUE ||
1391
+ Pred == FCMP_ORD || Pred == FCMP_UNO;
1391
1392
}
1392
1393
1394
+ // / @returns true if the predicate of this instruction is commutative.
1395
+ // / Determine if this is a commutative predicate.
1396
+ bool isCommutative () const { return isCommutative (getPredicate ()); }
1397
+
1393
1398
// / @returns true if the predicate is relational (not EQ or NE).
1394
1399
// / Determine if this a relational predicate.
1395
1400
bool isRelational () const { return !isEquality (); }
0 commit comments