diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -662,18 +662,19 @@ SDValue getTargetJumpTable(int JTI, EVT VT, unsigned TargetFlags = 0) { return getJumpTable(JTI, VT, true, TargetFlags); } - SDValue getConstantPool(const Constant *C, EVT VT, unsigned Align = 0, + SDValue getConstantPool(const Constant *C, EVT VT, MaybeAlign Align = None, int Offs = 0, bool isT = false, unsigned TargetFlags = 0); - SDValue getTargetConstantPool(const Constant *C, EVT VT, unsigned Align = 0, - int Offset = 0, unsigned TargetFlags = 0) { + SDValue getTargetConstantPool(const Constant *C, EVT VT, + MaybeAlign Align = None, int Offset = 0, + unsigned TargetFlags = 0) { return getConstantPool(C, VT, Align, Offset, true, TargetFlags); } SDValue getConstantPool(MachineConstantPoolValue *C, EVT VT, - unsigned Align = 0, int Offs = 0, bool isT=false, - unsigned TargetFlags = 0); + MaybeAlign Align = None, int Offs = 0, + bool isT = false, unsigned TargetFlags = 0); SDValue getTargetConstantPool(MachineConstantPoolValue *C, EVT VT, - unsigned Align = 0, int Offset = 0, + MaybeAlign Align = None, int Offset = 0, unsigned TargetFlags = 0) { return getConstantPool(C, VT, Align, Offset, true, TargetFlags); } 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 @@ -1811,23 +1811,23 @@ MachineConstantPoolValue *MachineCPVal; } Val; int Offset; // It's a MachineConstantPoolValue if top bit is set. - unsigned Alignment; // Minimum alignment requirement of CP (not log2 value). + Align Alignment; // Minimum alignment requirement of CP. unsigned TargetFlags; ConstantPoolSDNode(bool isTarget, const Constant *c, EVT VT, int o, - unsigned Align, unsigned TF) - : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0, - DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align), - TargetFlags(TF) { + Align Alignment, unsigned TF) + : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0, + DebugLoc(), getSDVTList(VT)), + Offset(o), Alignment(Alignment), TargetFlags(TF) { assert(Offset >= 0 && "Offset is too large"); Val.ConstVal = c; } - ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, - EVT VT, int o, unsigned Align, unsigned TF) - : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0, - DebugLoc(), getSDVTList(VT)), Offset(o), Alignment(Align), - TargetFlags(TF) { + ConstantPoolSDNode(bool isTarget, MachineConstantPoolValue *v, EVT VT, int o, + Align Alignment, unsigned TF) + : SDNode(isTarget ? ISD::TargetConstantPool : ISD::ConstantPool, 0, + DebugLoc(), getSDVTList(VT)), + Offset(o), Alignment(Alignment), TargetFlags(TF) { assert(Offset >= 0 && "Offset is too large"); Val.MachineCPVal = v; Offset |= 1 << (sizeof(unsigned)*CHAR_BIT-1); @@ -1854,7 +1854,9 @@ // Return the alignment of this constant pool object, which is either 0 (for // default alignment) or the desired value. - unsigned getAlignment() const { return Alignment; } + Align getAlign() const { return Alignment; } + // TODO: Remove once transition to getAlign is over. + unsigned getAlignment() const { return Alignment.value(); } unsigned getTargetFlags() const { return TargetFlags; } Type *getType() const; diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -20853,8 +20853,8 @@ // Create a ConstantArray of the two constants. Constant *CA = ConstantArray::get(ArrayType::get(FPTy, 2), Elts); SDValue CPIdx = DAG.getConstantPool(CA, TLI.getPointerTy(DAG.getDataLayout()), - TD.getPrefTypeAlignment(FPTy)); - unsigned Alignment = cast(CPIdx)->getAlignment(); + TD.getPrefTypeAlign(FPTy)); + Align Alignment = cast(CPIdx)->getAlign(); // Get offsets to the 0 and 1 elements of the array, so we can select between // them. diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -543,7 +543,7 @@ case ISD::ConstantPool: case ISD::TargetConstantPool: { const ConstantPoolSDNode *CP = cast(N); - ID.AddInteger(CP->getAlignment()); + ID.AddInteger(CP->getAlign().value()); ID.AddInteger(CP->getOffset()); if (CP->isMachineConstantPoolEntry()) CP->getMachineCPVal()->addSelectionDAGCSEId(ID); @@ -1471,19 +1471,18 @@ } SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT, - unsigned Alignment, int Offset, - bool isTarget, - unsigned TargetFlags) { + MaybeAlign Alignment, int Offset, + bool isTarget, unsigned TargetFlags) { assert((TargetFlags == 0 || isTarget) && "Cannot set target flags on target-independent globals"); - if (Alignment == 0) + if (!Alignment) Alignment = shouldOptForSize() - ? getDataLayout().getABITypeAlignment(C->getType()) - : getDataLayout().getPrefTypeAlignment(C->getType()); + ? getDataLayout().getABITypeAlign(C->getType()) + : getDataLayout().getPrefTypeAlign(C->getType()); unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; FoldingSetNodeID ID; AddNodeIDNode(ID, Opc, getVTList(VT), None); - ID.AddInteger(Alignment); + ID.AddInteger(Alignment->value()); ID.AddInteger(Offset); ID.AddPointer(C); ID.AddInteger(TargetFlags); @@ -1491,25 +1490,26 @@ if (SDNode *E = FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); - auto *N = newSDNode(isTarget, C, VT, Offset, Alignment, + auto *N = newSDNode(isTarget, C, VT, Offset, *Alignment, TargetFlags); CSEMap.InsertNode(N, IP); InsertNode(N); - return SDValue(N, 0); + SDValue V = SDValue(N, 0); + NewSDValueDbgMsg(V, "Creating new constant pool: ", this); + return V; } SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT, - unsigned Alignment, int Offset, - bool isTarget, - unsigned TargetFlags) { + MaybeAlign Alignment, int Offset, + bool isTarget, unsigned TargetFlags) { assert((TargetFlags == 0 || isTarget) && "Cannot set target flags on target-independent globals"); - if (Alignment == 0) - Alignment = getDataLayout().getPrefTypeAlignment(C->getType()); + if (!Alignment) + Alignment = getDataLayout().getPrefTypeAlign(C->getType()); unsigned Opc = isTarget ? ISD::TargetConstantPool : ISD::ConstantPool; FoldingSetNodeID ID; AddNodeIDNode(ID, Opc, getVTList(VT), None); - ID.AddInteger(Alignment); + ID.AddInteger(Alignment->value()); ID.AddInteger(Offset); C->addSelectionDAGCSEId(ID); ID.AddInteger(TargetFlags); @@ -1517,7 +1517,7 @@ if (SDNode *E = FindNodeOrInsertPos(ID, IP)) return SDValue(E, 0); - auto *N = newSDNode(isTarget, C, VT, Offset, Alignment, + auto *N = newSDNode(isTarget, C, VT, Offset, *Alignment, TargetFlags); CSEMap.InsertNode(N, IP); InsertNode(N); diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -4667,7 +4667,7 @@ SDValue AArch64TargetLowering::getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG, unsigned Flag) const { - return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(), + return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(), N->getOffset(), Flag); } 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 @@ -2355,7 +2355,7 @@ ARMConstantPoolConstant::Create(GV, ARMPCLabelIndex, ARMCP::CPValue, 0); // Get the address of the callee into a register - SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, 4); + SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, Align(4)); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); Callee = DAG.getLoad( PtrVt, dl, DAG.getEntryNode(), CPAddr, @@ -2369,7 +2369,7 @@ ARMConstantPoolSymbol::Create(*DAG.getContext(), Sym, ARMPCLabelIndex, 0); // Get the address of the callee into a register - SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, 4); + SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, Align(4)); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); Callee = DAG.getLoad( PtrVt, dl, DAG.getEntryNode(), CPAddr, @@ -2421,7 +2421,7 @@ ARMConstantPoolValue *CPV = ARMConstantPoolSymbol::Create(*DAG.getContext(), Sym, ARMPCLabelIndex, 4); - SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, 4); + SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVt, Align(4)); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); Callee = DAG.getLoad( PtrVt, dl, DAG.getEntryNode(), CPAddr, @@ -3070,11 +3070,10 @@ } if (CP->isMachineConstantPoolEntry()) - Res = DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, - CP->getAlignment()); + Res = + DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, CP->getAlign()); else - Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, - CP->getAlignment()); + Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign()); return DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Res); } @@ -3093,14 +3092,14 @@ SDValue CPAddr; bool IsPositionIndependent = isPositionIndependent() || Subtarget->isROPI(); if (!IsPositionIndependent) { - CPAddr = DAG.getTargetConstantPool(BA, PtrVT, 4); + CPAddr = DAG.getTargetConstantPool(BA, PtrVT, Align(4)); } else { unsigned PCAdj = Subtarget->isThumb() ? 4 : 8; ARMPCLabelIndex = AFI->createPICLabelUId(); ARMConstantPoolValue *CPV = ARMConstantPoolConstant::Create(BA, ARMPCLabelIndex, ARMCP::CPBlockAddress, PCAdj); - CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); + CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4)); } CPAddr = DAG.getNode(ARMISD::Wrapper, DL, PtrVT, CPAddr); SDValue Result = DAG.getLoad( @@ -3229,8 +3228,9 @@ const auto *GA = cast(Op); auto *CPV = ARMConstantPoolConstant::Create(GA->getGlobal(), ARMCP::SECREL); SDValue Offset = DAG.getLoad( - PtrVT, DL, Chain, DAG.getNode(ARMISD::Wrapper, DL, MVT::i32, - DAG.getTargetConstantPool(CPV, PtrVT, 4)), + PtrVT, DL, Chain, + DAG.getNode(ARMISD::Wrapper, DL, MVT::i32, + DAG.getTargetConstantPool(CPV, PtrVT, Align(4))), MachinePointerInfo::getConstantPool(DAG.getMachineFunction())); return DAG.getNode(ISD::ADD, DL, PtrVT, TLS, Offset); @@ -3249,7 +3249,7 @@ ARMConstantPoolValue *CPV = ARMConstantPoolConstant::Create(GA->getGlobal(), ARMPCLabelIndex, ARMCP::CPValue, PCAdj, ARMCP::TLSGD, true); - SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, 4); + SDValue Argument = DAG.getTargetConstantPool(CPV, PtrVT, Align(4)); Argument = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Argument); Argument = DAG.getLoad( PtrVT, dl, DAG.getEntryNode(), Argument, @@ -3300,7 +3300,7 @@ ARMConstantPoolConstant::Create(GA->getGlobal(), ARMPCLabelIndex, ARMCP::CPValue, PCAdj, ARMCP::GOTTPOFF, true); - Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); + Offset = DAG.getTargetConstantPool(CPV, PtrVT, Align(4)); Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); Offset = DAG.getLoad( PtrVT, dl, Chain, Offset, @@ -3318,7 +3318,7 @@ assert(model == TLSModel::LocalExec); ARMConstantPoolValue *CPV = ARMConstantPoolConstant::Create(GV, ARMCP::TPOFF); - Offset = DAG.getTargetConstantPool(CPV, PtrVT, 4); + Offset = DAG.getTargetConstantPool(CPV, PtrVT, Align(4)); Offset = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, Offset); Offset = DAG.getLoad( PtrVT, dl, Chain, Offset, @@ -3421,11 +3421,11 @@ // that are strings for simplicity. auto *CDAInit = dyn_cast(Init); unsigned Size = DAG.getDataLayout().getTypeAllocSize(Init->getType()); - unsigned Align = DAG.getDataLayout().getPreferredAlignment(GVar); + unsigned PrefAlign = DAG.getDataLayout().getPreferredAlignment(GVar); unsigned RequiredPadding = 4 - (Size % 4); bool PaddingPossible = RequiredPadding == 4 || (CDAInit && CDAInit->isString()); - if (!PaddingPossible || Align > 4 || Size > ConstpoolPromotionMaxSize || + if (!PaddingPossible || PrefAlign > 4 || Size > ConstpoolPromotionMaxSize || Size == 0) return SDValue(); @@ -3464,8 +3464,7 @@ } auto CPVal = ARMConstantPoolConstant::Create(GVar, Init); - SDValue CPAddr = - DAG.getTargetConstantPool(CPVal, PtrVT, /*Align=*/4); + SDValue CPAddr = DAG.getTargetConstantPool(CPVal, PtrVT, Align(4)); if (!AFI->getGlobalsPromotedToConstantPool().count(GVar)) { AFI->markGlobalAsPromotedToConstantPool(GVar); AFI->setPromotedConstpoolIncrease(AFI->getPromotedConstpoolIncrease() + @@ -3535,7 +3534,7 @@ } else { // use literal pool for address constant ARMConstantPoolValue *CPV = ARMConstantPoolConstant::Create(GV, ARMCP::SBREL); - SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); + SDValue CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4)); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); RelAddr = DAG.getLoad( PtrVT, dl, DAG.getEntryNode(), CPAddr, @@ -3555,7 +3554,7 @@ return DAG.getNode(ARMISD::Wrapper, dl, PtrVT, DAG.getTargetGlobalAddress(GV, dl, PtrVT)); } else { - SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, 4); + SDValue CPAddr = DAG.getTargetConstantPool(GV, PtrVT, Align(4)); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); return DAG.getLoad( PtrVT, dl, DAG.getEntryNode(), CPAddr, @@ -3750,7 +3749,7 @@ ARMConstantPoolValue *CPV = ARMConstantPoolConstant::Create(&MF.getFunction(), ARMPCLabelIndex, ARMCP::CPLSDA, PCAdj); - CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, 4); + CPAddr = DAG.getTargetConstantPool(CPV, PtrVT, Align(4)); CPAddr = DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); SDValue Result = DAG.getLoad( PtrVT, dl, DAG.getEntryNode(), CPAddr, diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -1098,19 +1098,20 @@ isVTi1Type = true; } } - unsigned Align = CPN->getAlignment(); + Align Alignment = CPN->getAlign(); bool IsPositionIndependent = isPositionIndependent(); unsigned char TF = IsPositionIndependent ? HexagonII::MO_PCREL : 0; unsigned Offset = 0; SDValue T; if (CPN->isMachineConstantPoolEntry()) - T = DAG.getTargetConstantPool(CPN->getMachineCPVal(), ValTy, Align, Offset, - TF); + T = DAG.getTargetConstantPool(CPN->getMachineCPVal(), ValTy, Alignment, + Offset, TF); else if (isVTi1Type) - T = DAG.getTargetConstantPool(CVal, ValTy, Align, Offset, TF); + T = DAG.getTargetConstantPool(CVal, ValTy, Alignment, Offset, TF); else - T = DAG.getTargetConstantPool(CPN->getConstVal(), ValTy, Align, Offset, TF); + T = DAG.getTargetConstantPool(CPN->getConstVal(), ValTy, Alignment, Offset, + TF); assert(cast(T)->getTargetFlags() == TF && "Inconsistent target flag encountered"); diff --git a/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp b/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp --- a/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp @@ -445,10 +445,11 @@ ArrayRef Tmp((Constant**)Consts.begin(), (Constant**)Consts.end()); Constant *CV = ConstantVector::get(Tmp); - unsigned Align = HwLen; - SDValue CP = LowerConstantPool(DAG.getConstantPool(CV, VecTy, Align), DAG); + Align Alignment(HwLen); + SDValue CP = + LowerConstantPool(DAG.getConstantPool(CV, VecTy, Alignment), DAG); return DAG.getLoad(VecTy, dl, DAG.getEntryNode(), CP, - MachinePointerInfo::getConstantPool(MF), Align); + MachinePointerInfo::getConstantPool(MF), Alignment); } // A special case is a situation where the vector is built entirely from @@ -1090,10 +1091,12 @@ Tmp.push_back(ConstantInt::get(Int8Ty, 1ull << j)); } Constant *CV = ConstantVector::get(Tmp); - unsigned Align = HwLen; - SDValue CP = LowerConstantPool(DAG.getConstantPool(CV, ByteTy, Align), DAG); - SDValue Bytes = DAG.getLoad(ByteTy, dl, DAG.getEntryNode(), CP, - MachinePointerInfo::getConstantPool(MF), Align); + Align Alignment(HwLen); + SDValue CP = + LowerConstantPool(DAG.getConstantPool(CV, ByteTy, Alignment), DAG); + SDValue Bytes = + DAG.getLoad(ByteTy, dl, DAG.getEntryNode(), CP, + MachinePointerInfo::getConstantPool(MF), Alignment); // Select the bytes that correspond to true bits in the vector predicate. SDValue Sel = DAG.getSelect(dl, VecTy, VecQ, DAG.getBitcast(VecTy, Bytes), diff --git a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp --- a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp +++ b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp @@ -1136,7 +1136,7 @@ if (getTargetMachine().getCodeModel() == CodeModel::Small || TLOF->isConstantInSmallSection(DAG.getDataLayout(), C)) { SDValue Small = DAG.getTargetConstantPool( - C, MVT::i32, N->getAlignment(), N->getOffset(), LanaiII::MO_NO_FLAG); + C, MVT::i32, N->getAlign(), N->getOffset(), LanaiII::MO_NO_FLAG); return DAG.getNode(ISD::OR, DL, MVT::i32, DAG.getRegister(Lanai::R0, MVT::i32), DAG.getNode(LanaiISD::SMALL, DL, MVT::i32, Small)); @@ -1144,9 +1144,9 @@ uint8_t OpFlagHi = LanaiII::MO_ABS_HI; uint8_t OpFlagLo = LanaiII::MO_ABS_LO; - SDValue Hi = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(), + SDValue Hi = DAG.getTargetConstantPool(C, MVT::i32, N->getAlign(), N->getOffset(), OpFlagHi); - SDValue Lo = DAG.getTargetConstantPool(C, MVT::i32, N->getAlignment(), + SDValue Lo = DAG.getTargetConstantPool(C, MVT::i32, N->getAlign(), N->getOffset(), OpFlagLo); Hi = DAG.getNode(LanaiISD::HI, DL, MVT::i32, Hi); Lo = DAG.getNode(LanaiISD::LO, DL, MVT::i32, Lo); diff --git a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp --- a/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp +++ b/llvm/lib/Target/MSP430/MSP430ISelDAGToDAG.cpp @@ -263,8 +263,8 @@ MVT::i16, AM.Disp, 0/*AM.SymbolFlags*/); else if (AM.CP) - Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16, - AM.Align, AM.Disp, 0/*AM.SymbolFlags*/); + Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i16, Align(AM.Align), + AM.Disp, 0 /*AM.SymbolFlags*/); else if (AM.ES) Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i16, 0/*AM.SymbolFlags*/); else if (AM.JT != -1) diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -173,7 +173,7 @@ SDValue MipsTargetLowering::getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG, unsigned Flag) const { - return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(), + return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(), N->getOffset(), Flag); } diff --git a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp --- a/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -6736,8 +6736,7 @@ } else if (ConstantPoolSDNode *CP = dyn_cast(ImmOpnd)) { const Constant *C = CP->getConstVal(); - ImmOpnd = CurDAG->getTargetConstantPool(C, MVT::i64, - CP->getAlignment(), + ImmOpnd = CurDAG->getTargetConstantPool(C, MVT::i64, CP->getAlign(), Offset, Flags); } } diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -2817,14 +2817,12 @@ if (Subtarget.isUsingPCRelativeCalls()) { SDLoc DL(CP); EVT Ty = getPointerTy(DAG.getDataLayout()); - SDValue ConstPool = DAG.getTargetConstantPool(C, Ty, - CP->getAlignment(), - CP->getOffset(), - PPCII::MO_PCREL_FLAG); + SDValue ConstPool = DAG.getTargetConstantPool( + C, Ty, CP->getAlign(), CP->getOffset(), PPCII::MO_PCREL_FLAG); return DAG.getNode(PPCISD::MAT_PCREL_ADDR, DL, Ty, ConstPool); } setUsesTOCBasePtr(DAG); - SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0); + SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), 0); return getTOCEntry(DAG, SDLoc(CP), GA); } @@ -2833,15 +2831,15 @@ getLabelAccessInfo(IsPIC, Subtarget, MOHiFlag, MOLoFlag); if (IsPIC && Subtarget.isSVR4ABI()) { - SDValue GA = DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), - PPCII::MO_PIC_FLAG); + SDValue GA = + DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), PPCII::MO_PIC_FLAG); return getTOCEntry(DAG, SDLoc(CP), GA); } SDValue CPIHi = - DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0, MOHiFlag); + DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), 0, MOHiFlag); SDValue CPILo = - DAG.getTargetConstantPool(C, PtrVT, CP->getAlignment(), 0, MOLoFlag); + DAG.getTargetConstantPool(C, PtrVT, CP->getAlign(), 0, MOLoFlag); return LowerLabelRef(CPIHi, CPILo, IsPIC, DAG); } @@ -9052,8 +9050,8 @@ } Constant *CP = ConstantVector::get(CV); - SDValue CPIdx = DAG.getConstantPool(CP, getPointerTy(DAG.getDataLayout()), - 16 /* alignment */); + SDValue CPIdx = + DAG.getConstantPool(CP, getPointerTy(DAG.getDataLayout()), Align(16)); SDValue Ops[] = {DAG.getEntryNode(), CPIdx}; SDVTList VTs = DAG.getVTList({MVT::v4i1, /*chain*/ MVT::Other}); diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -448,7 +448,7 @@ static SDValue getTargetNode(ConstantPoolSDNode *N, SDLoc DL, EVT Ty, SelectionDAG &DAG, unsigned Flags) { - return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlignment(), + return DAG.getTargetConstantPool(N->getConstVal(), Ty, N->getAlign(), N->getOffset(), Flags); } diff --git a/llvm/lib/Target/Sparc/SparcISelLowering.cpp b/llvm/lib/Target/Sparc/SparcISelLowering.cpp --- a/llvm/lib/Target/Sparc/SparcISelLowering.cpp +++ b/llvm/lib/Target/Sparc/SparcISelLowering.cpp @@ -1906,10 +1906,8 @@ GA->getOffset(), TF); if (const ConstantPoolSDNode *CP = dyn_cast(Op)) - return DAG.getTargetConstantPool(CP->getConstVal(), - CP->getValueType(0), - CP->getAlignment(), - CP->getOffset(), TF); + return DAG.getTargetConstantPool(CP->getConstVal(), CP->getValueType(0), + CP->getAlign(), CP->getOffset(), TF); if (const BlockAddressSDNode *BA = dyn_cast(Op)) return DAG.getTargetBlockAddress(BA->getBlockAddress(), diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -3126,7 +3126,7 @@ SystemZConstantPoolValue *CPV = SystemZConstantPoolValue::Create(GV, SystemZCP::TLSGD); - Offset = DAG.getConstantPool(CPV, PtrVT, 8); + Offset = DAG.getConstantPool(CPV, PtrVT, Align(8)); Offset = DAG.getLoad( PtrVT, DL, DAG.getEntryNode(), Offset, MachinePointerInfo::getConstantPool(DAG.getMachineFunction())); @@ -3141,7 +3141,7 @@ SystemZConstantPoolValue *CPV = SystemZConstantPoolValue::Create(GV, SystemZCP::TLSLDM); - Offset = DAG.getConstantPool(CPV, PtrVT, 8); + Offset = DAG.getConstantPool(CPV, PtrVT, Align(8)); Offset = DAG.getLoad( PtrVT, DL, DAG.getEntryNode(), Offset, MachinePointerInfo::getConstantPool(DAG.getMachineFunction())); @@ -3159,7 +3159,7 @@ // Add the per-symbol offset. CPV = SystemZConstantPoolValue::Create(GV, SystemZCP::DTPOFF); - SDValue DTPOffset = DAG.getConstantPool(CPV, PtrVT, 8); + SDValue DTPOffset = DAG.getConstantPool(CPV, PtrVT, Align(8)); DTPOffset = DAG.getLoad( PtrVT, DL, DAG.getEntryNode(), DTPOffset, MachinePointerInfo::getConstantPool(DAG.getMachineFunction())); @@ -3184,7 +3184,7 @@ SystemZConstantPoolValue *CPV = SystemZConstantPoolValue::Create(GV, SystemZCP::NTPOFF); - Offset = DAG.getConstantPool(CPV, PtrVT, 8); + Offset = DAG.getConstantPool(CPV, PtrVT, Align(8)); Offset = DAG.getLoad( PtrVT, DL, DAG.getEntryNode(), Offset, MachinePointerInfo::getConstantPool(DAG.getMachineFunction())); @@ -3225,11 +3225,11 @@ SDValue Result; if (CP->isMachineConstantPoolEntry()) - Result = DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, - CP->getAlignment()); + Result = + DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, CP->getAlign()); else - Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, - CP->getAlignment(), CP->getOffset()); + Result = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(), + CP->getOffset()); // Use LARL to load the address of the constant pool entry. return DAG.getNode(SystemZISD::PCREL_WRAPPER, DL, PtrVT, Result); diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -297,8 +297,8 @@ MVT::i32, AM.Disp, AM.SymbolFlags); else if (AM.CP) - Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32, - AM.Align, AM.Disp, AM.SymbolFlags); + Disp = CurDAG->getTargetConstantPool(AM.CP, MVT::i32, Align(AM.Align), + AM.Disp, AM.SymbolFlags); else if (AM.ES) { assert(!AM.Disp && "Non-zero displacement is ignored with ES."); Disp = CurDAG->getTargetExternalSymbol(AM.ES, MVT::i32, AM.SymbolFlags); diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -18508,7 +18508,7 @@ auto PtrVT = getPointerTy(DAG.getDataLayout()); SDValue Result = DAG.getTargetConstantPool( - CP->getConstVal(), PtrVT, CP->getAlignment(), CP->getOffset(), OpFlag); + CP->getConstVal(), PtrVT, CP->getAlign(), CP->getOffset(), OpFlag); SDLoc DL(CP); Result = DAG.getNode(getGlobalWrapperKind(), DL, PtrVT, Result); // With PIC, the address is actually $g + Offset. @@ -19446,7 +19446,7 @@ static const uint32_t CV0[] = { 0x43300000, 0x45300000, 0, 0 }; Constant *C0 = ConstantDataVector::get(*Context, CV0); auto PtrVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout()); - SDValue CPIdx0 = DAG.getConstantPool(C0, PtrVT, 16); + SDValue CPIdx0 = DAG.getConstantPool(C0, PtrVT, Align(16)); SmallVector CV1; CV1.push_back( @@ -19456,7 +19456,7 @@ ConstantFP::get(*Context, APFloat(APFloat::IEEEdouble(), APInt(64, 0x4530000000000000ULL)))); Constant *C1 = ConstantVector::get(CV1); - SDValue CPIdx1 = DAG.getConstantPool(C1, PtrVT, 16); + SDValue CPIdx1 = DAG.getConstantPool(C1, PtrVT, Align(16)); // Load the 64-bit value into an XMM register. SDValue XR1 = @@ -19661,7 +19661,7 @@ *DAG.getContext(), APFloat(APFloat::IEEEdouble(), APInt(64, 0x4330000000000000ULL))); auto PtrVT = DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout()); - SDValue CPIdx = DAG.getConstantPool(Bias, PtrVT, /*Alignment*/ 8); + SDValue CPIdx = DAG.getConstantPool(Bias, PtrVT, Align(8)); SDVTList Tys = DAG.getVTList(MVT::v4f64, MVT::Other); SDValue Ops[] = {DAG.getEntryNode(), CPIdx}; SDValue VBias = DAG.getMemIntrinsicNode( diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -329,10 +329,10 @@ SDValue Res; if (CP->isMachineConstantPoolEntry()) { Res = DAG.getTargetConstantPool(CP->getMachineCPVal(), PtrVT, - CP->getAlignment(), CP->getOffset()); + CP->getAlign(), CP->getOffset()); } else { - Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, - CP->getAlignment(), CP->getOffset()); + Res = DAG.getTargetConstantPool(CP->getConstVal(), PtrVT, CP->getAlign(), + CP->getOffset()); } return DAG.getNode(XCoreISD::CPRelativeWrapper, dl, MVT::i32, Res); }