diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-02-10 17:42:15 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2019-02-10 17:42:15 +0000 |
| commit | c5744d4d69da4588f7dc0fd36fada86a02f64220 (patch) | |
| tree | 92ab07773040cef45f8398ac410033ba812eccd4 /llvm/lib/CodeGen/SelectionDAG | |
| parent | 5a82a788a28e3b255d4b8448e338e5d3566a2010 (diff) | |
| download | bcm5719-llvm-c5744d4d69da4588f7dc0fd36fada86a02f64220.tar.gz bcm5719-llvm-c5744d4d69da4588f7dc0fd36fada86a02f64220.zip | |
[DAG] Add optional AllowUndefs to isNullOrNullSplat
No change in default behaviour (AllowUndefs = false)
llvm-svn: 353646
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index be867b24ba6..d242d3c159a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -7128,11 +7128,7 @@ SDValue DAGCombiner::visitFunnelShift(SDNode *N) { return IsFSHL ? N0 : N1; auto IsUndefOrZero = [](SDValue V) { - if (V.isUndef()) - return true; - if (ConstantSDNode *Cst = isConstOrConstSplat(V, /*AllowUndefs*/true)) - return Cst->getAPIntValue() == 0; - return false; + return V.isUndef() || isNullOrNullSplat(V, /*AllowUndefs*/ true); }; if (ConstantSDNode *Cst = isConstOrConstSplat(N2)) { diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 2e92f9582be..9b00a550e33 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -8622,9 +8622,9 @@ ConstantFPSDNode *llvm::isConstOrConstSplatFP(SDValue N, bool AllowUndefs) { return nullptr; } -bool llvm::isNullOrNullSplat(SDValue N) { +bool llvm::isNullOrNullSplat(SDValue N, bool AllowUndefs) { // TODO: may want to use peekThroughBitcast() here. - ConstantSDNode *C = isConstOrConstSplat(N); + ConstantSDNode *C = isConstOrConstSplat(N, AllowUndefs); return C && C->isNullValue(); } |

