Skip to content

Commit 93baa01

Browse files
authored
[LegalizeVectorTypes] Preserve original MemoryOperand and MemVT when widening fixed vector load to vp_load. (llvm#109473)
Previously we were building a new memoperand with the size of the widened VT. This was causing a failure in our downstream with non-power of 2 vectorization. Alias analysis allowed rescheduling a 3 element vector load past 2 out of 3 scalar stores that overwrite what it was supposed to read. Alias analysis considers it undefined behavior to read more than the size of the underlying object. There is an exception if the underying objects is sufficiently aligned, but that doesn't apply in my failing case.
1 parent 78ae2de commit 93baa01

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5857,11 +5857,10 @@ SDValue DAGTypeLegalizer::WidenVecRes_LOAD(SDNode *N) {
58575857
SDValue Mask = DAG.getAllOnesConstant(DL, WideMaskVT);
58585858
SDValue EVL = DAG.getElementCount(DL, TLI.getVPExplicitVectorLengthTy(),
58595859
LdVT.getVectorElementCount());
5860-
const auto *MMO = LD->getMemOperand();
58615860
SDValue NewLoad =
5862-
DAG.getLoadVP(WideVT, DL, LD->getChain(), LD->getBasePtr(), Mask, EVL,
5863-
MMO->getPointerInfo(), MMO->getAlign(), MMO->getFlags(),
5864-
MMO->getAAInfo());
5861+
DAG.getLoadVP(LD->getAddressingMode(), ISD::NON_EXTLOAD, WideVT, DL,
5862+
LD->getChain(), LD->getBasePtr(), LD->getOffset(), Mask,
5863+
EVL, LD->getMemoryVT(), LD->getMemOperand());
58655864

58665865
// Modified the chain - switch anything that used the old chain to use
58675866
// the new one.

0 commit comments

Comments
 (0)