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

Extra assertions in RS4GC #71201

Merged
merged 5 commits into from
Nov 23, 2023
Merged
Changes from 4 commits
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
8 changes: 8 additions & 0 deletions llvm/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,13 +1251,21 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache,
VerifyStates();
#endif

// get the data layout to compare the sizes of base/derived pointer values
[[maybe_unused]] auto &DL =
cast<llvm::Instruction>(Def)->getModule()->getDataLayout();
// Cache all of our results so we can cheaply reuse them
// NOTE: This is actually two caches: one of the base defining value
// relation and one of the base pointer relation! FIXME
for (auto Pair : States) {
auto *BDV = Pair.first;
Value *Base = Pair.second.getBaseValue();
assert(BDV && Base);
// the assumption is that whenever we have a derived ptr(s), their base
zduka marked this conversation as resolved.
Show resolved Hide resolved
// ptr(s) must be of the same size, not necessarily the same type
assert(DL.getTypeAllocSize(BDV->getType()) ==
DL.getTypeAllocSize(Base->getType()) &&
"Derived and base values should have same size");
// Only values that do not have known bases or those that have differing
// type (scalar versus vector) from a possible known base should be in the
// lattice.
Expand Down