Skip to content

Commit b0ce9f0

Browse files
committed
[SVE][CodeGen] Fix implicit TypeSize->uint64_t casts in TypePromotion
The TypePromotion pass only operates on scalar types so I've fixed up all places where we were relying upon the implicit cast from TypeSize->uint64_t. Differential Revision: https://reviews.llvm.org/D88575
1 parent b8ce6a6 commit b0ce9f0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/CodeGen/TypePromotion.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ class IRPromoter {
134134
Ctx(C), OrigTy(Ty), PromotedWidth(Width), Visited(visited),
135135
Sources(sources), Sinks(sinks), SafeWrap(wrap) {
136136
ExtTy = IntegerType::get(Ctx, PromotedWidth);
137-
assert(OrigTy->getPrimitiveSizeInBits() < ExtTy->getPrimitiveSizeInBits()
138-
&& "Original type not smaller than extended type");
137+
assert(OrigTy->getPrimitiveSizeInBits().getFixedSize() <
138+
ExtTy->getPrimitiveSizeInBits().getFixedSize() &&
139+
"Original type not smaller than extended type");
139140
}
140141

141142
void Mutate();
@@ -809,7 +810,7 @@ bool TypePromotion::isLegalToPromote(Value *V) {
809810

810811
bool TypePromotion::TryToPromote(Value *V, unsigned PromotedWidth) {
811812
Type *OrigTy = V->getType();
812-
TypeSize = OrigTy->getPrimitiveSizeInBits();
813+
TypeSize = OrigTy->getPrimitiveSizeInBits().getFixedSize();
813814
SafeToPromote.clear();
814815
SafeWrap.clear();
815816

@@ -980,15 +981,14 @@ bool TypePromotion::runOnFunction(Function &F) {
980981
if (TLI->getTypeAction(ICmp->getContext(), SrcVT) !=
981982
TargetLowering::TypePromoteInteger)
982983
break;
983-
984984
EVT PromotedVT = TLI->getTypeToTransformTo(ICmp->getContext(), SrcVT);
985-
if (RegisterBitWidth < PromotedVT.getSizeInBits()) {
985+
if (RegisterBitWidth < PromotedVT.getFixedSizeInBits()) {
986986
LLVM_DEBUG(dbgs() << "IR Promotion: Couldn't find target register "
987987
<< "for promoted type\n");
988988
break;
989989
}
990990

991-
MadeChange |= TryToPromote(I, PromotedVT.getSizeInBits());
991+
MadeChange |= TryToPromote(I, PromotedVT.getFixedSizeInBits());
992992
break;
993993
}
994994
}

0 commit comments

Comments
 (0)