Skip to content

Commit

Permalink
[VectorLegalizer] Remove broken code in ExpandStore.
Browse files Browse the repository at this point in the history
The code that is supposed to "Round odd types to the next pow of two" seems
broken and as well completely unused (untested). It also seems that
ExpandStore really shouldn't ever change the memory VT, which this in fact
does.

As a first step in fixing the broken handling of vector stores (of irregular
types, e.g. an i1 vector), this code is removed. For discussion, see
https://bugs.llvm.org/show_bug.cgi?id=35520.

Review: Eli Friedman

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322275 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
JonPsson committed Jan 11, 2018
1 parent c33edc6 commit 9901953
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,34 +663,6 @@ SDValue VectorLegalizer::ExpandLoad(SDValue Op) {
SDValue VectorLegalizer::ExpandStore(SDValue Op) {
StoreSDNode *ST = cast<StoreSDNode>(Op.getNode());

EVT StVT = ST->getMemoryVT();
EVT MemSclVT = StVT.getScalarType();
unsigned ScalarSize = MemSclVT.getSizeInBits();

// Round odd types to the next pow of two.
if (!isPowerOf2_32(ScalarSize)) {
// FIXME: This is completely broken and inconsistent with ExpandLoad
// handling.

// For sub-byte element sizes, this ends up with 0 stride between elements,
// so the same element just gets re-written to the same location. There seem
// to be tests explicitly testing for this broken behavior though. tests
// for this broken behavior.

LLVMContext &Ctx = *DAG.getContext();

EVT NewMemVT
= EVT::getVectorVT(Ctx,
MemSclVT.getIntegerVT(Ctx, NextPowerOf2(ScalarSize)),
StVT.getVectorNumElements());

SDValue NewVectorStore = DAG.getTruncStore(
ST->getChain(), SDLoc(Op), ST->getValue(), ST->getBasePtr(),
ST->getPointerInfo(), NewMemVT, ST->getAlignment(),
ST->getMemOperand()->getFlags(), ST->getAAInfo());
ST = cast<StoreSDNode>(NewVectorStore.getNode());
}

SDValue TF = TLI.scalarizeVectorStore(ST, DAG);
AddLegalizedOperand(Op, TF);
return TF;
Expand Down

0 comments on commit 9901953

Please sign in to comment.