diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -1292,7 +1292,13 @@ bool writeMem() const { return MMO->isStore(); } /// Returns alignment and volatility of the memory access - unsigned getOriginalAlignment() const { return MMO->getBaseAlign().value(); } + Align getOriginalAlign() const { return MMO->getBaseAlign(); } + Align getAlign() const { return MMO->getAlign(); } + LLVM_ATTRIBUTE_DEPRECATED(unsigned getOriginalAlignment() const, + "Use getOriginalAlign() instead") { + return MMO->getBaseAlign().value(); + } + // FIXME: Remove once transition to getAlign is over. unsigned getAlignment() const { return MMO->getAlign().value(); } /// Return the SubclassData value, without HasDebugValue. This contains an diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -337,7 +337,7 @@ N->getValueType(0).getVectorElementType(), SDLoc(N), N->getChain(), N->getBasePtr(), DAG.getUNDEF(N->getBasePtr().getValueType()), N->getPointerInfo(), N->getMemoryVT().getVectorElementType(), - N->getOriginalAlignment(), N->getMemOperand()->getFlags(), + N->getOriginalAlign().value(), N->getMemOperand()->getFlags(), N->getAAInfo()); // Legalize the chain result - switch anything that used the old chain to @@ -755,8 +755,8 @@ return DAG.getStore(N->getChain(), dl, GetScalarizedVector(N->getOperand(1)), N->getBasePtr(), N->getPointerInfo(), - N->getOriginalAlignment(), N->getMemOperand()->getFlags(), - N->getAAInfo()); + N->getOriginalAlign().value(), + N->getMemOperand()->getFlags(), N->getAAInfo()); } /// If the value to round is a vector that needs to be scalarized, it must be @@ -1509,7 +1509,7 @@ SDValue Ptr = LD->getBasePtr(); SDValue Offset = DAG.getUNDEF(Ptr.getValueType()); EVT MemoryVT = LD->getMemoryVT(); - unsigned Alignment = LD->getOriginalAlignment(); + Align Alignment = LD->getOriginalAlign(); MachineMemOperand::Flags MMOFlags = LD->getMemOperand()->getFlags(); AAMDNodes AAInfo = LD->getAAInfo(); @@ -1525,13 +1525,14 @@ } Lo = DAG.getLoad(ISD::UNINDEXED, ExtType, LoVT, dl, Ch, Ptr, Offset, - LD->getPointerInfo(), LoMemVT, Alignment, MMOFlags, AAInfo); + LD->getPointerInfo(), LoMemVT, Alignment.value(), MMOFlags, + AAInfo); unsigned IncrementSize = LoMemVT.getSizeInBits()/8; Ptr = DAG.getObjectPtrOffset(dl, Ptr, IncrementSize); Hi = DAG.getLoad(ISD::UNINDEXED, ExtType, HiVT, dl, Ch, Ptr, Offset, LD->getPointerInfo().getWithOffset(IncrementSize), HiMemVT, - Alignment, MMOFlags, AAInfo); + Alignment.value(), MMOFlags, AAInfo); // Build a factor node to remember that this load is independent of the // other one. @@ -1556,7 +1557,7 @@ assert(Offset.isUndef() && "Unexpected indexed masked load offset"); SDValue Mask = MLD->getMask(); SDValue PassThru = MLD->getPassThru(); - unsigned Alignment = MLD->getOriginalAlignment(); + Align Alignment = MLD->getOriginalAlign(); ISD::LoadExtType ExtType = MLD->getExtensionType(); // Split Mask operand @@ -1580,10 +1581,9 @@ else std::tie(PassThruLo, PassThruHi) = DAG.SplitVector(PassThru, dl); - MachineMemOperand *MMO = DAG.getMachineFunction(). - getMachineMemOperand(MLD->getPointerInfo(), - MachineMemOperand::MOLoad, LoMemVT.getStoreSize(), - Alignment, MLD->getAAInfo(), MLD->getRanges()); + MachineMemOperand *MMO = DAG.getMachineFunction().getMachineMemOperand( + MLD->getPointerInfo(), MachineMemOperand::MOLoad, LoMemVT.getStoreSize(), + Alignment.value(), MLD->getAAInfo(), MLD->getRanges()); Lo = DAG.getMaskedLoad(LoVT, dl, Ch, Ptr, Offset, MaskLo, PassThruLo, LoMemVT, MMO, MLD->getAddressingMode(), ExtType, @@ -1595,7 +1595,7 @@ MMO = DAG.getMachineFunction().getMachineMemOperand( MLD->getPointerInfo().getWithOffset(HiOffset), MachineMemOperand::MOLoad, - HiMemVT.getStoreSize(), Alignment, MLD->getAAInfo(), + HiMemVT.getStoreSize(), Alignment.value(), MLD->getAAInfo(), MLD->getRanges()); Hi = DAG.getMaskedLoad(HiVT, dl, Ch, Ptr, Offset, MaskHi, PassThruHi, HiMemVT, @@ -1625,7 +1625,7 @@ SDValue PassThru = MGT->getPassThru(); SDValue Index = MGT->getIndex(); SDValue Scale = MGT->getScale(); - unsigned Alignment = MGT->getOriginalAlignment(); + Align Alignment = MGT->getOriginalAlign(); // Split Mask operand SDValue MaskLo, MaskHi; @@ -1652,7 +1652,7 @@ MachineMemOperand *MMO = DAG.getMachineFunction().getMachineMemOperand( MGT->getPointerInfo(), MachineMemOperand::MOLoad, - MemoryLocation::UnknownSize, Alignment, MGT->getAAInfo(), + MemoryLocation::UnknownSize, Alignment.value(), MGT->getAAInfo(), MGT->getRanges()); SDValue OpsLo[] = {Ch, PassThruLo, MaskLo, Ptr, IndexLo, Scale}; @@ -2255,7 +2255,7 @@ SDValue Scale = MGT->getScale(); SDValue Mask = MGT->getMask(); SDValue PassThru = MGT->getPassThru(); - unsigned Alignment = MGT->getOriginalAlignment(); + Align Alignment = MGT->getOriginalAlign(); SDValue MaskLo, MaskHi; if (getTypeAction(Mask.getValueType()) == TargetLowering::TypeSplitVector) @@ -2280,20 +2280,17 @@ else std::tie(IndexLo, IndexHi) = DAG.SplitVector(Index, dl); - MachineMemOperand *MMO = DAG.getMachineFunction(). - getMachineMemOperand(MGT->getPointerInfo(), - MachineMemOperand::MOLoad, LoMemVT.getStoreSize(), - Alignment, MGT->getAAInfo(), MGT->getRanges()); + MachineMemOperand *MMO = DAG.getMachineFunction().getMachineMemOperand( + MGT->getPointerInfo(), MachineMemOperand::MOLoad, LoMemVT.getStoreSize(), + Alignment.value(), MGT->getAAInfo(), MGT->getRanges()); SDValue OpsLo[] = {Ch, PassThruLo, MaskLo, Ptr, IndexLo, Scale}; SDValue Lo = DAG.getMaskedGather(DAG.getVTList(LoVT, MVT::Other), LoVT, dl, OpsLo, MMO, MGT->getIndexType()); - MMO = DAG.getMachineFunction(). - getMachineMemOperand(MGT->getPointerInfo(), - MachineMemOperand::MOLoad, HiMemVT.getStoreSize(), - Alignment, MGT->getAAInfo(), - MGT->getRanges()); + MMO = DAG.getMachineFunction().getMachineMemOperand( + MGT->getPointerInfo(), MachineMemOperand::MOLoad, HiMemVT.getStoreSize(), + Alignment.value(), MGT->getAAInfo(), MGT->getRanges()); SDValue OpsHi[] = {Ch, PassThruHi, MaskHi, Ptr, IndexHi, Scale}; SDValue Hi = DAG.getMaskedGather(DAG.getVTList(HiVT, MVT::Other), HiVT, dl, @@ -2324,7 +2321,7 @@ SDValue Mask = N->getMask(); SDValue Data = N->getValue(); EVT MemoryVT = N->getMemoryVT(); - unsigned Alignment = N->getOriginalAlignment(); + Align Alignment = N->getOriginalAlign(); SDLoc DL(N); EVT LoMemVT, HiMemVT; @@ -2349,10 +2346,9 @@ } SDValue Lo, Hi; - MachineMemOperand *MMO = DAG.getMachineFunction(). - getMachineMemOperand(N->getPointerInfo(), - MachineMemOperand::MOStore, LoMemVT.getStoreSize(), - Alignment, N->getAAInfo(), N->getRanges()); + MachineMemOperand *MMO = DAG.getMachineFunction().getMachineMemOperand( + N->getPointerInfo(), MachineMemOperand::MOStore, LoMemVT.getStoreSize(), + Alignment.value(), N->getAAInfo(), N->getRanges()); Lo = DAG.getMaskedStore(Ch, DL, DataLo, Ptr, Offset, MaskLo, LoMemVT, MMO, N->getAddressingMode(), N->isTruncatingStore(), @@ -2364,7 +2360,7 @@ MMO = DAG.getMachineFunction().getMachineMemOperand( N->getPointerInfo().getWithOffset(HiOffset), MachineMemOperand::MOStore, - HiMemVT.getStoreSize(), Alignment, N->getAAInfo(), + HiMemVT.getStoreSize(), Alignment.value(), N->getAAInfo(), N->getRanges()); Hi = DAG.getMaskedStore(Ch, DL, DataHi, Ptr, Offset, MaskHi, HiMemVT, MMO, @@ -2384,7 +2380,7 @@ SDValue Index = N->getIndex(); SDValue Scale = N->getScale(); SDValue Data = N->getValue(); - unsigned Alignment = N->getOriginalAlignment(); + Align Alignment = N->getOriginalAlign(); SDLoc DL(N); // Split all operands @@ -2416,7 +2412,8 @@ SDValue Lo; MachineMemOperand *MMO = DAG.getMachineFunction().getMachineMemOperand( N->getPointerInfo(), MachineMemOperand::MOStore, - MemoryLocation::UnknownSize, Alignment, N->getAAInfo(), N->getRanges()); + MemoryLocation::UnknownSize, Alignment.value(), N->getAAInfo(), + N->getRanges()); SDValue OpsLo[] = {Ch, DataLo, MaskLo, Ptr, IndexLo, Scale}; Lo = DAG.getMaskedScatter(DAG.getVTList(MVT::Other), DataLo.getValueType(), @@ -2439,7 +2436,7 @@ SDValue Ch = N->getChain(); SDValue Ptr = N->getBasePtr(); EVT MemoryVT = N->getMemoryVT(); - unsigned Alignment = N->getOriginalAlignment(); + Align Alignment = N->getOriginalAlign(); MachineMemOperand::Flags MMOFlags = N->getMemOperand()->getFlags(); AAMDNodes AAInfo = N->getAAInfo(); SDValue Lo, Hi; @@ -2456,10 +2453,10 @@ if (isTruncating) Lo = DAG.getTruncStore(Ch, DL, Lo, Ptr, N->getPointerInfo(), LoMemVT, - Alignment, MMOFlags, AAInfo); + Alignment.value(), MMOFlags, AAInfo); else - Lo = DAG.getStore(Ch, DL, Lo, Ptr, N->getPointerInfo(), Alignment, MMOFlags, - AAInfo); + Lo = DAG.getStore(Ch, DL, Lo, Ptr, N->getPointerInfo(), Alignment.value(), + MMOFlags, AAInfo); // Increment the pointer to the other half. Ptr = DAG.getObjectPtrOffset(DL, Ptr, IncrementSize); @@ -2467,11 +2464,11 @@ if (isTruncating) Hi = DAG.getTruncStore(Ch, DL, Hi, Ptr, N->getPointerInfo().getWithOffset(IncrementSize), - HiMemVT, Alignment, MMOFlags, AAInfo); + HiMemVT, Alignment.value(), MMOFlags, AAInfo); else Hi = DAG.getStore(Ch, DL, Hi, Ptr, N->getPointerInfo().getWithOffset(IncrementSize), - Alignment, MMOFlags, AAInfo); + Alignment.value(), MMOFlags, AAInfo); return DAG.getNode(ISD::TokenFactor, DL, MVT::Other, Lo, Hi); } diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp --- a/llvm/lib/Target/ARM/ARMISelLowering.cpp +++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp @@ -13924,7 +13924,7 @@ // Details about the old store SDValue Ch = St->getChain(); SDValue BasePtr = St->getBasePtr(); - unsigned Alignment = St->getOriginalAlignment(); + Align Alignment = St->getOriginalAlign(); MachineMemOperand::Flags MMOFlags = St->getMemOperand()->getFlags(); AAMDNodes AAInfo = St->getAAInfo(); @@ -13941,7 +13941,7 @@ DAG.getConstant(i * NumElements, DL, MVT::i32)); SDValue Store = DAG.getTruncStore( Ch, DL, Extract, NewPtr, St->getPointerInfo().getWithOffset(NewOffset), - NewToVT, Alignment, MMOFlags, AAInfo); + NewToVT, Alignment.value(), MMOFlags, AAInfo); Stores.push_back(Store); } return DAG.getNode(ISD::TokenFactor, DL, MVT::Other, Stores); @@ -14586,7 +14586,7 @@ // Details about the old load SDValue Ch = LD->getChain(); SDValue BasePtr = LD->getBasePtr(); - unsigned Alignment = LD->getOriginalAlignment(); + Align Alignment = LD->getOriginalAlign(); MachineMemOperand::Flags MMOFlags = LD->getMemOperand()->getFlags(); AAMDNodes AAInfo = LD->getAAInfo(); @@ -14602,13 +14602,13 @@ // is good enough, as legalisation will take it from there. They are either // already legal or they will be split further into something that is // legal. - SDValue NewLoad1 = - DAG.getLoad(ISD::UNINDEXED, NewExtType, NewToVT, DL, Ch, BasePtr, Offset, - LD->getPointerInfo(), NewFromVT, Alignment, MMOFlags, AAInfo); + SDValue NewLoad1 = DAG.getLoad( + ISD::UNINDEXED, NewExtType, NewToVT, DL, Ch, BasePtr, Offset, + LD->getPointerInfo(), NewFromVT, Alignment.value(), MMOFlags, AAInfo); SDValue NewLoad2 = DAG.getLoad(ISD::UNINDEXED, NewExtType, NewToVT, DL, Ch, NewPtr, Offset, LD->getPointerInfo().getWithOffset(NewOffset), NewFromVT, - Alignment, MMOFlags, AAInfo); + Alignment.value(), MMOFlags, AAInfo); SDValue NewChain = DAG.getNode(ISD::TokenFactor, DL, MVT::Other, SDValue(NewLoad1.getNode(), 1),