[PATCH] D88575: [SVE][CodeGen] Fix implicit TypeSize->uint64_t casts in TypePromotion
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 07:50:26 PDT 2020
david-arm created this revision.
david-arm added reviewers: sdesmalen, ctetreau, c-rhodes.
Herald added subscribers: llvm-commits, psnobl, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
david-arm requested review of this revision.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88575
Files:
llvm/lib/CodeGen/TypePromotion.cpp
Index: llvm/lib/CodeGen/TypePromotion.cpp
===================================================================
--- llvm/lib/CodeGen/TypePromotion.cpp
+++ llvm/lib/CodeGen/TypePromotion.cpp
@@ -134,8 +134,9 @@
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::TryToPromote(Value *V, unsigned PromotedWidth) {
Type *OrigTy = V->getType();
- TypeSize = OrigTy->getPrimitiveSizeInBits();
+ TypeSize = OrigTy->getPrimitiveSizeInBits().getFixedSize();
SafeToPromote.clear();
SafeWrap.clear();
@@ -980,15 +981,14 @@
if (TLI->getTypeAction(ICmp->getContext(), SrcVT) !=
TargetLowering::TypePromoteInteger)
break;
-
EVT PromotedVT = TLI->getTypeToTransformTo(ICmp->getContext(), SrcVT);
- if (RegisterBitWidth < PromotedVT.getSizeInBits()) {
+ if (RegisterBitWidth < PromotedVT.getScalarSizeInBits()) {
LLVM_DEBUG(dbgs() << "IR Promotion: Couldn't find target register "
<< "for promoted type\n");
break;
}
- MadeChange |= TryToPromote(I, PromotedVT.getSizeInBits());
+ MadeChange |= TryToPromote(I, PromotedVT.getScalarSizeInBits());
break;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88575.295283.patch
Type: text/x-patch
Size: 1745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200930/1b84ce59/attachment.bin>
More information about the llvm-commits
mailing list