From 893448a3e41d8032c9ac4f036f7e7a2a34d397c4 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Wed, 10 Jul 2019 16:14:26 +0000 Subject: [PATCH] [X86] EltsFromConsecutiveLoads - ensure element reg/store sizes are the same size. NFCI. This renames the type so it doesn't sound like its based off the load size - as we're moving towards supporting combining loads of different sizes. llvm-svn: 365655 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index de556ed..c5f1234 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -7562,8 +7562,10 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef Elts, const TargetLowering &TLI = DAG.getTargetLoweringInfo(); int FirstLoadedElt = LoadMask.countTrailingZeros(); SDValue EltBase = peekThroughBitcasts(Elts[FirstLoadedElt]); + EVT EltBaseVT = EltBase.getValueType(); + assert(EltBaseVT.getSizeInBits() == EltBaseVT.getStoreSizeInBits() && + "Register/Memory size mismatch"); LoadSDNode *LDBase = Loads[FirstLoadedElt]; - EVT LDBaseVT = EltBase.getValueType(); assert(LDBase && "Did not find base load for merging consecutive loads"); // Consecutive loads can contain UNDEFS but not ZERO elements. @@ -7650,7 +7652,7 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef Elts, } } - unsigned BaseSize = LDBaseVT.getStoreSizeInBits(); + unsigned BaseSize = EltBaseVT.getStoreSizeInBits(); int LoadSize = (1 + LastLoadedElt - FirstLoadedElt) * BaseSize; // If the upper half of a ymm/zmm load is undef then just load the lower half. @@ -7702,7 +7704,7 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef Elts, continue; bool Match = true; - SmallVector RepeatedLoads(SubElems, DAG.getUNDEF(LDBaseVT)); + SmallVector RepeatedLoads(SubElems, DAG.getUNDEF(EltBaseVT)); for (unsigned i = 0; i != NumElems && Match; ++i) { if (!LoadMask[i]) continue; -- 2.7.4