1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[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
This commit is contained in:
David Sherwood 2020-09-30 15:10:03 +01:00
parent 9542ca0d95
commit 6fb9333083

View File

@ -134,8 +134,9 @@ public:
Ctx(C), OrigTy(Ty), PromotedWidth(Width), Visited(visited),
Sources(sources), Sinks(sinks), SafeWrap(wrap) {
ExtTy = IntegerType::get(Ctx, PromotedWidth);
assert(OrigTy->getPrimitiveSizeInBits() < ExtTy->getPrimitiveSizeInBits()
&& "Original type not smaller than extended type");
assert(OrigTy->getPrimitiveSizeInBits().getFixedSize() <
ExtTy->getPrimitiveSizeInBits().getFixedSize() &&
"Original type not smaller than extended type");
}
void Mutate();
@ -809,7 +810,7 @@ bool TypePromotion::isLegalToPromote(Value *V) {
bool TypePromotion::TryToPromote(Value *V, unsigned PromotedWidth) {
Type *OrigTy = V->getType();
TypeSize = OrigTy->getPrimitiveSizeInBits();
TypeSize = OrigTy->getPrimitiveSizeInBits().getFixedSize();
SafeToPromote.clear();
SafeWrap.clear();
@ -980,15 +981,14 @@ bool TypePromotion::runOnFunction(Function &F) {
if (TLI->getTypeAction(ICmp->getContext(), SrcVT) !=
TargetLowering::TypePromoteInteger)
break;
EVT PromotedVT = TLI->getTypeToTransformTo(ICmp->getContext(), SrcVT);
if (RegisterBitWidth < PromotedVT.getSizeInBits()) {
if (RegisterBitWidth < PromotedVT.getFixedSizeInBits()) {
LLVM_DEBUG(dbgs() << "IR Promotion: Couldn't find target register "
<< "for promoted type\n");
break;
}
MadeChange |= TryToPromote(I, PromotedVT.getSizeInBits());
MadeChange |= TryToPromote(I, PromotedVT.getFixedSizeInBits());
break;
}
}