[llvm] [DAGCombine] Fix multi-use miscompile in load combine (PR #81492)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 16:46:18 PST 2024
================
@@ -9245,6 +9252,14 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
if (!Allowed || !Fast)
return SDValue();
+ // calculatebyteProvider() allows multi-use for vector loads. Ensure that
+ // all uses are in vector element extracts that are part of the pattern.
+ for (LoadSDNode *L : Loads)
+ if (L->getMemoryVT().isVector())
+ for (auto It = L->use_begin(); It != L->use_end(); ++It)
+ if (It.getUse().getResNo() == 0 && !ExtractElements.contains(*It))
+ return SDValue();
+
----------------
topperc wrote:
Shoudl we go ahead and call DAG.makeEquivalentMemoryOrdering instead of ReplaceAllUsesOfValueWith below for maximum safety?
https://github.com/llvm/llvm-project/pull/81492
More information about the llvm-commits
mailing list