diff options
| author | Craig Topper <craig.topper@intel.com> | 2019-06-02 18:58:46 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@intel.com> | 2019-06-02 18:58:46 +0000 |
| commit | a7bc31ebc6deddc99bcfc4ca15fc6d2573544f1c (patch) | |
| tree | dc146be9e3e2ce8492ba0c0e9b86fe2af52b5dd5 /llvm/lib | |
| parent | 87346a15db59fbbb9828f232e8025dca4e610163 (diff) | |
| download | bcm5719-llvm-a7bc31ebc6deddc99bcfc4ca15fc6d2573544f1c.tar.gz bcm5719-llvm-a7bc31ebc6deddc99bcfc4ca15fc6d2573544f1c.zip | |
[DAGCombiner] Replace masked loads with a zero mask with the passthru value
Similar to what was recently done for gathers in r362015.
llvm-svn: 362337
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 949c14f3ce4..a866dbb250a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -8216,13 +8216,17 @@ SDValue DAGCombiner::visitMGATHER(SDNode *N) { } SDValue DAGCombiner::visitMLOAD(SDNode *N) { - if (Level >= AfterLegalizeTypes) - return SDValue(); - MaskedLoadSDNode *MLD = cast<MaskedLoadSDNode>(N); SDValue Mask = MLD->getMask(); SDLoc DL(N); + // Zap masked loads with a zero mask. + if (ISD::isBuildVectorAllZeros(Mask.getNode())) + return CombineTo(N, MLD->getPassThru(), MLD->getChain()); + + if (Level >= AfterLegalizeTypes) + return SDValue(); + // If the MLOAD result requires splitting and the mask is provided by a // SETCC, then split both nodes and its operands before legalization. This // prevents the type legalizer from unrolling SETCC into scalar comparisons |

