From 8e48f416ad5f952d7421e3d4076565230e499770 Mon Sep 17 00:00:00 2001 From: Bill Seurer Date: Wed, 22 Feb 2017 16:27:33 +0000 Subject: [DAGCombiner] revert r295336 r295336 causes a bootstrapped clang to fail for many compilations on powerpc BE. See http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/2315 for example. Reverting as per the developer's request. llvm-svn: 295849 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index f8e18e22f65..091aba35f46 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -4446,8 +4446,6 @@ const Optional calculateByteProvider(SDValue Op, unsigned Index, : calculateByteProvider(Op->getOperand(0), Index - ByteShift, Depth + 1); } - case ISD::ANY_EXTEND: - case ISD::SIGN_EXTEND: case ISD::ZERO_EXTEND: { SDValue NarrowOp = Op->getOperand(0); unsigned NarrowBitWidth = NarrowOp.getScalarValueSizeInBits(); @@ -4455,32 +4453,22 @@ const Optional calculateByteProvider(SDValue Op, unsigned Index, return None; uint64_t NarrowByteWidth = NarrowBitWidth / 8; - if (Index >= NarrowByteWidth) - return Op.getOpcode() == ISD::ZERO_EXTEND - ? Optional(ByteProvider::getConstantZero()) - : None; - else - return calculateByteProvider(NarrowOp, Index, Depth + 1); + return Index >= NarrowByteWidth + ? ByteProvider::getConstantZero() + : calculateByteProvider(NarrowOp, Index, Depth + 1); } case ISD::BSWAP: return calculateByteProvider(Op->getOperand(0), ByteWidth - Index - 1, Depth + 1); case ISD::LOAD: { auto L = cast(Op.getNode()); - if (L->isVolatile() || L->isIndexed()) - return None; - unsigned NarrowBitWidth = L->getMemoryVT().getSizeInBits(); - if (NarrowBitWidth % 8 != 0) + // TODO: support ext loads + if (L->isVolatile() || L->isIndexed() || + L->getExtensionType() != ISD::NON_EXTLOAD) return None; - uint64_t NarrowByteWidth = NarrowBitWidth / 8; - if (Index >= NarrowByteWidth) - return L->getExtensionType() == ISD::ZEXTLOAD - ? Optional(ByteProvider::getConstantZero()) - : None; - else - return ByteProvider::getMemory(L, Index); + return ByteProvider::getMemory(L, Index); } } @@ -4560,6 +4548,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) { LoadSDNode *L = P->Load; assert(L->hasNUsesOfValue(1, 0) && !L->isVolatile() && !L->isIndexed() && + (L->getExtensionType() == ISD::NON_EXTLOAD) && "Must be enforced by calculateByteProvider"); assert(L->getOffset().isUndef() && "Unindexed load must have undef offset"); -- cgit v1.2.3