[llvm-bugs] [Bug 42046] New: [DAG] DAGTypeLegalizer::GenWidenVectorTruncStores - possible copy+paste typo

via llvm-bugs llvm-bugs at lists.llvm.org
Tue May 28 06:51:21 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42046

            Bug ID: 42046
           Summary: [DAG] DAGTypeLegalizer::GenWidenVectorTruncStores -
                    possible copy+paste typo
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at ndave.org, spatel+llvm at rotateright.com

unsigned NumElts = StVT.getVectorNumElements();
  SDValue EOp = DAG.getNode(
      ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
      DAG.getConstant(0, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
  StChain.push_back(DAG.getTruncStore(Chain, dl, EOp, BasePtr,
                                      ST->getPointerInfo(), StEltVT, Align,
                                      MMOFlags, AAInfo));
  unsigned Offset = Increment;
  for (unsigned i=1; i < NumElts; ++i, Offset += Increment) {
    SDValue NewBasePtr = DAG.getObjectPtrOffset(dl, BasePtr, Offset);
    SDValue EOp = DAG.getNode(
        ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
        DAG.getConstant(0, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
    StChain.push_back(DAG.getTruncStore(
        Chain, dl, EOp, NewBasePtr, ST->getPointerInfo().getWithOffset(Offset),
        StEltVT, MinAlign(Align, Offset), MMOFlags, AAInfo));
  }

The ISD::EXTRACT_VECTOR_ELT in the loop is repeatedly extracting the 0'th
vector element - shouldn't it be be the i'th element index?

According to http://lab.llvm.org:8080/coverage/coverage-reports/llvm/coverage
this code isn't tested at all.

I only noticed this because 'SDValue EOp' was causing a Wshadow warning in
cppcheck.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190528/31e0ece4/attachment.html>


More information about the llvm-bugs mailing list