[PATCH] D87708: [DAG] DAGTypeLegalizer::GenWidenVectorTruncStores - ensure correct extraction index (PR42046)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 10:25:42 PDT 2020


RKSimon created this revision.
RKSimon added reviewers: spatel, efriedma, craig.topper.
Herald added subscribers: arphaman, hiraditya.
Herald added a project: LLVM.
RKSimon requested review of this revision.

Fix the copy+paste type that results in the 0'th element being stored repeatedly - this was only noticed because the

This is by inspection - as was mentioned on the ticket, this code isn't active at all in the tests and I've not been able to get it to fire. An alternative if just to replace GenWidenVectorTruncStores with an unreachable and see if anyone complains......


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87708

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -5262,11 +5262,11 @@
       DAG.getTruncStore(Chain, dl, EOp, BasePtr, ST->getPointerInfo(), StEltVT,
                         ST->getOriginalAlign(), MMOFlags, AAInfo));
   unsigned Offset = Increment;
-  for (unsigned i=1; i < NumElts; ++i, Offset += Increment) {
+  for (unsigned Idx = 1; Idx < NumElts; ++Idx, Offset += Increment) {
     SDValue NewBasePtr =
         DAG.getObjectPtrOffset(dl, BasePtr, TypeSize::Fixed(Offset));
     SDValue EOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, ValEltVT, ValOp,
-                              DAG.getVectorIdxConstant(0, dl));
+                              DAG.getVectorIdxConstant(Idx, dl));
     StChain.push_back(DAG.getTruncStore(
         Chain, dl, EOp, NewBasePtr, ST->getPointerInfo().getWithOffset(Offset),
         StEltVT, ST->getOriginalAlign(), MMOFlags, AAInfo));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87708.291965.patch
Type: text/x-patch
Size: 1076 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200915/0ac9030c/attachment.bin>


More information about the llvm-commits mailing list