[llvm] [LegalizeVectorTypes] Preserve original MemoryOperand and MemVT when widening fixed vector load to vp_load. (PR #109473)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 20 13:53:45 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/109473
Previously we were building a new memoperand with the size of the widened VT. I haven't figured out why yet, but this was causing a failure in our downstream with non-power of 2 vectorization. Alias analysis to reschedule a 3 element vector load past 2 out of 3 scalar stores that overwrite what it was supposed to read.
I planning to keep debugging it, and maybe come up with a test case once I understand it.
>From acb2f09add1a888ad9a86b307bbda7852b70b80b Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Fri, 20 Sep 2024 11:38:06 -0700
Subject: [PATCH] [LegalizeVectorTypes] Preserve original MemoryOperand and
MemVT when widening fixed vector load to vp_load.
Previously we were building a new memoperand with the size of the
widened VT. I haven't figured out why yet, but this was causing
alias analysis to rechedule a vector load past some stores that
overwrite what it is reading.
I planning to keep debugging it, and maybe come up with a test case
once I understand it.
---
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 482f88e5c86de7..1c466ed0b77997 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -5857,11 +5857,10 @@ SDValue DAGTypeLegalizer::WidenVecRes_LOAD(SDNode *N) {
SDValue Mask = DAG.getAllOnesConstant(DL, WideMaskVT);
SDValue EVL = DAG.getElementCount(DL, TLI.getVPExplicitVectorLengthTy(),
LdVT.getVectorElementCount());
- const auto *MMO = LD->getMemOperand();
SDValue NewLoad =
- DAG.getLoadVP(WideVT, DL, LD->getChain(), LD->getBasePtr(), Mask, EVL,
- MMO->getPointerInfo(), MMO->getAlign(), MMO->getFlags(),
- MMO->getAAInfo());
+ DAG.getLoadVP(LD->getAddressingMode(), ISD::NON_EXTLOAD, WideVT, DL,
+ LD->getChain(), LD->getBasePtr(), LD->getOffset(), Mask,
+ EVL, LD->getMemoryVT(), LD->getMemOperand());
// Modified the chain - switch anything that used the old chain to use
// the new one.
More information about the llvm-commits
mailing list