Skip to content
Merged
Changes from all 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);
// Whenever we have a derived ptr(s), their base
// 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