Skip to content

Commit 8350dc6

Browse files
author
git apple-llvm automerger
committed
Merge commit '2615e69ec2b3' from llvm.org/main into next
2 parents 3303ecf + 2615e69 commit 8350dc6

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,9 @@ static bool upgradeArmOrAarch64IntrinsicFunction(bool IsArm, Function *F,
863863
static const Regex LdRegex("^[234](.nxv[a-z0-9]+|$)");
864864
if (LdRegex.match(Name)) {
865865
Type *ScalarTy =
866-
dyn_cast<VectorType>(F->getReturnType())->getElementType();
867-
ElementCount EC = dyn_cast<VectorType>(F->arg_begin()->getType())
868-
->getElementCount();
866+
cast<VectorType>(F->getReturnType())->getElementType();
867+
ElementCount EC =
868+
cast<VectorType>(F->arg_begin()->getType())->getElementCount();
869869
Type *Ty = VectorType::get(ScalarTy, EC);
870870
static const Intrinsic::ID LoadIDs[] = {
871871
Intrinsic::aarch64_sve_ld2_sret,
@@ -4402,8 +4402,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
44024402
.StartsWith("aarch64.sve.ld3", 3)
44034403
.StartsWith("aarch64.sve.ld4", 4)
44044404
.Default(0);
4405-
ScalableVectorType *RetTy =
4406-
dyn_cast<ScalableVectorType>(F->getReturnType());
4405+
auto *RetTy = cast<ScalableVectorType>(F->getReturnType());
44074406
unsigned MinElts = RetTy->getMinNumElements() / N;
44084407
SmallVector<Value *, 2> Args(CI->args());
44094408
Value *NewLdCall = Builder.CreateCall(NewFn, Args);
@@ -4431,8 +4430,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
44314430
DefaultCase();
44324431
return;
44334432
}
4434-
ScalableVectorType *RetTy =
4435-
dyn_cast<ScalableVectorType>(F->getReturnType());
4433+
auto *RetTy = cast<ScalableVectorType>(F->getReturnType());
44364434
unsigned MinElts = RetTy->getMinNumElements();
44374435
unsigned I = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
44384436
Value *NewIdx = ConstantInt::get(Type::getInt64Ty(C), I * MinElts);
@@ -4448,9 +4446,8 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
44484446
return;
44494447
}
44504448
if (Name.starts_with("aarch64.sve.tuple.set")) {
4451-
unsigned I = dyn_cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
4452-
ScalableVectorType *Ty =
4453-
dyn_cast<ScalableVectorType>(CI->getArgOperand(2)->getType());
4449+
unsigned I = cast<ConstantInt>(CI->getArgOperand(1))->getZExtValue();
4450+
auto *Ty = cast<ScalableVectorType>(CI->getArgOperand(2)->getType());
44544451
Value *NewIdx =
44554452
ConstantInt::get(Type::getInt64Ty(C), I * Ty->getMinNumElements());
44564453
NewCall = Builder.CreateCall(
@@ -4464,8 +4461,7 @@ void llvm::UpgradeIntrinsicCall(CallBase *CI, Function *NewFn) {
44644461
.StartsWith("aarch64.sve.tuple.create4", 4)
44654462
.Default(0);
44664463
assert(N > 1 && "Create is expected to be between 2-4");
4467-
ScalableVectorType *RetTy =
4468-
dyn_cast<ScalableVectorType>(F->getReturnType());
4464+
auto *RetTy = cast<ScalableVectorType>(F->getReturnType());
44694465
Value *Ret = llvm::PoisonValue::get(RetTy);
44704466
unsigned MinElts = RetTy->getMinNumElements() / N;
44714467
for (unsigned I = 0; I < N; I++) {

0 commit comments

Comments
 (0)