Skip to content

Commit a786402

Browse files
committed
Address comments and rename to AllowTruncation to match isConstOrConstSplat
1 parent 9f6caac commit a786402

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3262,15 +3262,15 @@ namespace ISD {
32623262
bool matchUnaryPredicateImpl(SDValue Op,
32633263
std::function<bool(ConstNodeType *)> Match,
32643264
bool AllowUndefs = false,
3265-
bool AllowTrunc = false);
3265+
bool AllowTruncation = false);
32663266

32673267
/// Hook for matching ConstantSDNode predicate
32683268
inline bool matchUnaryPredicate(SDValue Op,
32693269
std::function<bool(ConstantSDNode *)> Match,
32703270
bool AllowUndefs = false,
3271-
bool AllowTrunc = false) {
3271+
bool AllowTruncation = false) {
32723272
return matchUnaryPredicateImpl<ConstantSDNode>(Op, Match, AllowUndefs,
3273-
AllowTrunc);
3273+
AllowTruncation);
32743274
}
32753275

32763276
/// Hook for matching ConstantFPSDNode predicate

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ bool ISD::isFreezeUndef(const SDNode *N) {
363363
template <typename ConstNodeType>
364364
bool ISD::matchUnaryPredicateImpl(SDValue Op,
365365
std::function<bool(ConstNodeType *)> Match,
366-
bool AllowUndefs, bool AllowTrunc) {
366+
bool AllowUndefs, bool AllowTruncation) {
367367
// FIXME: Add support for scalar UNDEF cases?
368368
if (auto *C = dyn_cast<ConstNodeType>(Op))
369369
return Match(C);
@@ -382,7 +382,8 @@ bool ISD::matchUnaryPredicateImpl(SDValue Op,
382382
}
383383

384384
auto *Cst = dyn_cast<ConstNodeType>(Op.getOperand(i));
385-
if (!Cst || (!AllowTrunc && Cst->getValueType(0) != SVT) || !Match(Cst))
385+
if (!Cst || (!AllowTruncation && Cst->getValueType(0) != SVT) ||
386+
!Match(Cst))
386387
return false;
387388
}
388389
return true;

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7971,7 +7971,7 @@ static bool isNonZeroModBitWidthOrUndef(SDValue Z, unsigned BW) {
79717971
return ISD::matchUnaryPredicate(
79727972
Z,
79737973
[=](ConstantSDNode *C) { return !C || C->getAPIntValue().urem(BW) != 0; },
7974-
true, true);
7974+
/*AllowUndef=*/true, /*AllowTruncation=*/true);
79757975
}
79767976

79777977
static SDValue expandVPFunnelShift(SDNode *Node, SelectionDAG &DAG) {

0 commit comments

Comments
 (0)