Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated VectorType::getNumElements with new APIs #41144

Merged
merged 2 commits into from
Jun 9, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
fix if-else block
  • Loading branch information
TH3CHARLie committed Jun 9, 2021
commit 5e27d4ea4cf8c5df128635d566e163428938d86b
9 changes: 6 additions & 3 deletions src/llvm-late-gc-lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,14 @@ CountTrackedPointers::CountTrackedPointers(Type *T) {
}
if (isa<ArrayType>(T))
count *= cast<ArrayType>(T)->getNumElements();
else if (isa<VectorType>(T))
else if (isa<VectorType>(T)) {
#if JL_LLVM_VERSION >= 120000
ElementCount EC = cast<VectorType>(T)->getElementCount();
count *= EC.getKnownMinValue();
#else
count *= cast<VectorType>(T)->getNumElements();
#endif
}
}
if (count == 0)
all = false;
Expand All @@ -413,13 +414,14 @@ unsigned getCompositeNumElements(Type *T) {
return ST->getNumElements();
else if (auto *AT = dyn_cast<ArrayType>(T))
return AT->getNumElements();
else
else {
#if JL_LLVM_VERSION >= 120000
ElementCount EC = cast<VectorType>(T)->getElementCount();
return EC.getKnownMinValue();
#else
return cast<VectorType>(T)->getNumElements();
#endif
}
}

// Walk through a Type, and record the element path to every tracked value inside
Expand Down Expand Up @@ -635,13 +637,14 @@ void LateLowerGCFrame::LiftSelect(State &S, SelectInst *SI) {
}
std::vector<int> Numbers;
unsigned NumRoots = 1;
if (auto VTy = dyn_cast<VectorType>(SI->getType()))
if (auto VTy = dyn_cast<VectorType>(SI->getType())) {
#if JL_LLVM_VERSION >= 120000
ElementCount EC = VTy->getElementCount();
Numbers.resize(EC.getKnownMinValue(), -1);
#else
Numbers.resize(VTy->getNumElements(), -1);
#endif
}
else
assert(isa<PointerType>(SI->getType()) && "unimplemented");
assert(!isTrackedValue(SI));
Expand Down