Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/include/llvm/Analysis/MemoryLocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ class LocationSize {
if (isScalable() || Other.isScalable())
return afterPointer();

return upperBound(std::max(getValue(), Other.getValue()));
return upperBound(
std::max(getValue().getFixedValue(), Other.getValue().getFixedValue()));
}

bool hasValue() const {
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/CodeGenTypes/MachineValueType.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace llvm {
/// bitwidth.
MVT changeVectorElementTypeToInteger() const {
MVT EltTy = getVectorElementType();
MVT IntTy = MVT::getIntegerVT(EltTy.getSizeInBits());
MVT IntTy = MVT::getIntegerVT(EltTy.getFixedSizeInBits());
MVT VecTy = MVT::getVectorVT(IntTy, getVectorElementCount());
assert(VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
"Simple vector VT not representable by simple integer vector VT!");
Expand All @@ -224,7 +224,7 @@ namespace llvm {
MVT changeTypeToInteger() {
if (isVector())
return changeVectorElementTypeToInteger();
return MVT::getIntegerVT(getSizeInBits());
return MVT::getIntegerVT(getFixedSizeInBits());
}

/// Return a VT for a vector type with the same element type but
Expand Down
6 changes: 4 additions & 2 deletions llvm/include/llvm/IR/DerivedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ class VectorType : public Type {
/// the input type, and the element type is an integer type of the same width
/// as the input element type.
static VectorType *getInteger(VectorType *VTy) {
unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
unsigned EltBits =
VTy->getElementType()->getPrimitiveSizeInBits().getFixedValue();
assert(EltBits && "Element size must be of a non-zero size");
Type *EltTy = IntegerType::get(VTy->getContext(), EltBits);
return VectorType::get(EltTy, VTy->getElementCount());
Expand Down Expand Up @@ -510,7 +511,8 @@ class VectorType : public Type {
llvm_unreachable("Cannot create narrower fp vector element type");
}
} else {
unsigned EltBits = VTy->getElementType()->getPrimitiveSizeInBits();
unsigned EltBits =
VTy->getElementType()->getPrimitiveSizeInBits().getFixedValue();
assert((EltBits & 1) == 0 &&
"Cannot truncate vector element with odd bit-width");
EltTy = IntegerType::get(VTy->getContext(), EltBits / 2);
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2864,7 +2864,7 @@ uint64_t ConstantDataSequential::getNumElements() const {
}

uint64_t ConstantDataSequential::getElementByteSize() const {
return getElementType()->getPrimitiveSizeInBits() / 8;
return getElementType()->getPrimitiveSizeInBits().getFixedValue() / 8;
}

/// Return the start of the specified element.
Expand Down
8 changes: 6 additions & 2 deletions llvm/lib/IR/Instructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3234,8 +3234,12 @@ CastInst::getCastOpcode(
}

// Get the bit sizes, we'll need these
unsigned SrcBits = SrcTy->getPrimitiveSizeInBits(); // 0 for ptr
unsigned DestBits = DestTy->getPrimitiveSizeInBits(); // 0 for ptr
// FIXME: This doesn't work for scalable vector types with different element
// counts that don't call getElementType above.
unsigned SrcBits =
SrcTy->getPrimitiveSizeInBits().getFixedValue(); // 0 for ptr
unsigned DestBits =
DestTy->getPrimitiveSizeInBits().getFixedValue(); // 0 for ptr

// Run through the possibilities ...
if (DestTy->isIntegerTy()) { // Casting to integral
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4411,7 +4411,7 @@ void Verifier::visitNoaliasAddrspaceMetadata(Instruction &I, MDNode *Range,
}

void Verifier::checkAtomicMemAccessSize(Type *Ty, const Instruction *I) {
unsigned Size = DL.getTypeSizeInBits(Ty);
unsigned Size = DL.getTypeSizeInBits(Ty).getFixedValue();
Check(Size >= 8, "atomic memory access' size must be byte-sized", Ty, I);
Check(!(Size & (Size - 1)),
"atomic memory access' operand must have a power-of-two size", Ty, I);
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Utils/Local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2435,8 +2435,8 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
// Handle integer-to-integer widening and narrowing.
// FIXME: Use DW_OP_convert when it's available everywhere.
if (FromTy->isIntegerTy() && ToTy->isIntegerTy()) {
uint64_t FromBits = FromTy->getPrimitiveSizeInBits();
uint64_t ToBits = ToTy->getPrimitiveSizeInBits();
uint64_t FromBits = FromTy->getIntegerBitWidth();
uint64_t ToBits = ToTy->getIntegerBitWidth();
assert(FromBits != ToBits && "Unexpected no-op conversion");

// When the width of the result grows, assume that a debugger will only
Expand Down
5 changes: 3 additions & 2 deletions llvm/utils/TableGen/Common/DAGISelMatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,9 @@ class EmitIntegerMatcher : public Matcher {

public:
EmitIntegerMatcher(int64_t val, MVT::SimpleValueType vt, unsigned resultNo)
: Matcher(EmitInteger), Val(SignExtend64(val, MVT(vt).getSizeInBits())),
VT(vt), ResultNo(resultNo) {}
: Matcher(EmitInteger),
Val(SignExtend64(val, MVT(vt).getFixedSizeInBits())), VT(vt),
ResultNo(resultNo) {}

int64_t getValue() const { return Val; }
MVT::SimpleValueType getVT() const { return VT; }
Expand Down